Convert osx-fix-libs to py3

This commit is contained in:
Ryan Lucia 2019-05-16 18:11:03 -04:00
parent 5005d6d2a2
commit 5ed4838d00
1 changed files with 17 additions and 17 deletions

View File

@ -32,21 +32,21 @@ def collectlibs(lib, masterlist, targetdir):
badlist.append(l) badlist.append(l)
if ((not is_sys_lib(l)) or is_bad_lib(l)) and not l in masterlist: if ((not is_sys_lib(l)) or is_bad_lib(l)) and not l in masterlist:
locallist.append(l) locallist.append(l)
print "found %s:" % l print("found %s:" % l)
check = l check = l
link_list = [] link_list = []
while check: while check:
if os.path.isfile(check) and not os.path.islink(check): if os.path.isfile(check) and not os.path.islink(check):
os.system("cp '%s' '%s'" % (check, targetdir)) os.system("cp '%s' '%s'" % (check, targetdir))
print " FILE %s ... copied to target" % check print(" FILE %s ... copied to target" % check)
if link_list: if link_list:
for link in link_list: for link in link_list:
link_map[link] = os.path.basename(check) link_map[link] = os.path.basename(check)
break break
if os.path.islink(check): if os.path.islink(check):
print " LINK %s" % check print(" LINK %s" % check)
link_list.append(os.path.basename(check)) link_list.append(os.path.basename(check))
check = os.path.dirname(check) + "/" + os.readlink(check) check = os.path.dirname(check) + "/" + os.readlink(check)
@ -60,20 +60,20 @@ def collectlibs(lib, masterlist, targetdir):
exit; exit;
binname = sys.argv[1] binname = sys.argv[1]
targetdir = os.path.dirname(binname) targetdir = os.path.dirname(binname)
print "Searching for libraries in ", binname, "..." print("Searching for libraries in ", binname, "...")
libs = [binname] libs = [binname]
collectlibs(sys.argv[1], libs, targetdir) collectlibs(sys.argv[1], libs, targetdir)
print print()
print "System libraries used..." print("System libraries used...")
goodlist.sort() goodlist.sort()
for l in goodlist: for l in goodlist:
print l print(l)
print print()
print "Fixing library install names..." print("Fixing library install names...")
in_tool_cmdline = "install_name_tool " in_tool_cmdline = "install_name_tool "
for lib in libs: for lib in libs:
libbase = os.path.basename(lib) libbase = os.path.basename(lib)
@ -85,19 +85,19 @@ for lib in libs:
if libbase in link_map: if libbase in link_map:
libbase = link_map[libbase] libbase = link_map[libbase]
print "%s -> @executable_path/%s (REMAPPED)" % (lib, libbase) print("%s -> @executable_path/%s (REMAPPED)" % (lib, libbase))
else: else:
print "%s -> @executable_path/%s" % (lib, libbase) print("%s -> @executable_path/%s" % (lib, libbase))
os.system("%s -id '@executable_path/%s' '%s/%s'" % (in_tool_cmdline, libbase, targetdir, libbase)) os.system("%s -id '@executable_path/%s' '%s/%s'" % (in_tool_cmdline, libbase, targetdir, libbase))
sys.stdout.flush() sys.stdout.flush()
if badlist: if badlist:
print print()
print "WARNING: The following libraries have blacklisted paths:" print("WARNING: The following libraries have blacklisted paths:")
for lib in sorted(badlist): for lib in sorted(badlist):
print lib print(lib)
print "These paths normally have files from a package manager, which means that end result may not work if copied to another machine." print("These paths normally have files from a package manager, which means that end result may not work if copied to another machine.")
print print()
print "All done!" print("All done!")