def find_binutils_libs(self, libdir, lib_ext):
bfd_expr = re.compile("<STR_LIT>" % lib_ext)<EOL>libs = {}<EOL>for root, dirs, files in os.walk(libdir):<EOL><INDENT>for f in files:<EOL><INDENT>m = bfd_expr.search(f)<EOL>if m:<EOL><INDENT>lib, version = m.groups()<EOL>fp = os.path.join(root, f)<EOL>if version in libs:<EOL><INDENT>libs[version].append(fp)<EOL><DEDENT>else:<EOL><INDENT>libs[version] = [fp, ]<EOL><DEDENT><DEDENT><DEDENT><DEDENT>multiarch_libs = dict([(v, _l) for v, _l in list(libs.items())<EOL>if v.find("<STR_LIT>") != -<NUM_LIT:1>])<EOL>if len(multiarch_libs) > <NUM_LIT:1>:<EOL><INDENT>print(<EOL>"<STR_LIT>")<EOL>return list(multiarch_libs.values())[<NUM_LIT:0>]<EOL><DEDENT>if len(multiarch_libs) == <NUM_LIT:1>:<EOL><INDENT>return list(multiarch_libs.values())[<NUM_LIT:0>]<EOL><DEDENT>return libs.get("<STR_LIT>", [])<EOL>
Find Binutils libraries.