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