fix_homebrew_paths_in_standalone_zip.py: Remove a superfluous call to open()

This commit is contained in:
Kamil Śliwak 2021-08-23 16:00:35 +02:00
parent 6b7857d56b
commit 941919e8ab

View File

@ -44,21 +44,20 @@ import subprocess
import sys import sys
def readDependencies(fname): def readDependencies(fname):
with open(fname) as f: with subprocess.Popen(['otool', '-L', fname], stdout=subprocess.PIPE) as o:
with subprocess.Popen(['otool', '-L', fname], stdout=subprocess.PIPE) as o: for line in o.stdout:
for line in o.stdout: if line[0] == '\t':
if line[0] == '\t': library = line.split(' ', 1)[0][1:]
library = line.split(' ', 1)[0][1:] if (library.startswith("/usr/local/lib") or
if (library.startswith("/usr/local/lib") or library.startswith("/usr/local/opt") or
library.startswith("/usr/local/opt") or library.startswith("/Users/")):
library.startswith("/Users/")): if (os.path.basename(library) != os.path.basename(fname)):
if (os.path.basename(library) != os.path.basename(fname)): command = "install_name_tool -change " + \
command = "install_name_tool -change " + \ library + " @executable_path/./" + \
library + " @executable_path/./" + \ os.path.basename(library) + " " + fname
os.path.basename(library) + " " + fname print(command)
print(command) os.system("chmod +w " + fname)
os.system("chmod +w " + fname) os.system(command)
os.system(command)
root = sys.argv[1] root = sys.argv[1]
for (dirpath, dirnames, filenames) in os.walk(root): for (dirpath, dirnames, filenames) in os.walk(root):