14 os.chdir(os.path.join(os.environ[
'LIB3_DIR'],
"lib"))
15 for fileName
in os.listdir(
'.'):
16 if os.path.isfile(fileName):
17 if ".dylib" in fileName:
19 p = subprocess.Popen([
"otool",
"-D", fileName], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
20 out, err = p.communicate()
22 parts = out.decode(
"utf-8").split()
23 parts = parts[1].split(
"/")
25 if not "@rpath" in parts[0]:
26 name = parts[len(parts)-1]
29 subprocess.call([
"install_name_tool",
"-id", id, fileName])
31 p = subprocess.Popen([
"otool",
"-L", fileName], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
32 out, err = p.communicate()
34 lines = out.decode(
"utf-8").split(
'\n')
36 if '/opt/local/lib/' in line
or '/opt/X11/lib/' in line
or os.environ[
'LIB3_DIR']
in line
or (
'/' not in line
and 'compatibility' in line):
38 libPath = line.split()[0]
39 parts = libPath.split(
'/')
40 libName = parts[len(parts)-1]
41 newName =
'@rpath/' + libName
43 subprocess.call([
"install_name_tool",
"-change", libPath, newName, fileName])
44 if os.environ[
'LIB3_DIR']
not in libPath:
45 if not os.path.isfile(os.environ[
'LIB3_DIR'] +
"/lib/" + libName):
47 print(
"copying", libPath, os.environ[
'LIB3_DIR'] +
"/lib" )
48 shutil.copy(libPath, os.environ[
'LIB3_DIR'] +
"/lib")
52 os.chdir(os.path.join(os.environ[
'LIB3_DIR'],
"bin"))
53 for fileName
in os.listdir(
'.'):
54 if os.path.isfile(fileName):
55 line = subprocess.check_output([
'file', fileName]).decode(
"utf-8")
56 if "Mach-O 64-bit executable" in line:
58 p = subprocess.Popen([
"otool",
"-L", fileName], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
59 out, err = p.communicate()
61 lines = out.decode(
"utf-8").split(
'\n')
63 if '/opt/local/lib/' in line
or '/opt/X11/lib/' in line
or os.environ[
'LIB3_DIR']
in line:
65 libPath = line.split()[0]
66 parts = libPath.split(
'/')
67 libName = parts[len(parts)-1]
68 newName =
'@rpath/' + libName
70 subprocess.call([
"install_name_tool",
"-change", libPath, newName, fileName])
71 if os.environ[
'LIB3_DIR']
not in libPath:
72 if not os.path.isfile(os.environ[
'LIB3_DIR'] +
"/lib/" + libName):
74 print(
"copying", libPath, os.environ[
'LIB3_DIR'] +
"/lib" )
75 shutil.copy(libPath, os.environ[
'LIB3_DIR'] +
"/lib")
79 os.chdir(os.path.join(os.environ[
'OCSSWROOT'],
"lib"))
80 for fileName
in os.listdir(
'.'):
81 if os.path.isfile(fileName):
82 if ".dylib" in fileName:
84 p = subprocess.Popen([
"otool",
"-D", fileName], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
85 out, err = p.communicate()
87 parts = out.decode(
"utf-8").split()
88 parts = parts[1].split(
"/")
90 if not "@rpath" in parts[0]:
91 name = parts[len(parts)-1]
94 subprocess.call([
"install_name_tool",
"-id", id, fileName])
96 p = subprocess.Popen([
"otool",
"-L", fileName], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
97 out, err = p.communicate()
99 lines = out.decode(
"utf-8").split(
'\n')
101 if '/opt/local/lib/' in line
or '/opt/X11/lib/' in line
or os.environ[
'LIB3_DIR']
in line:
103 libPath = line.split()[0]
104 parts = libPath.split(
'/')
105 libName = parts[len(parts)-1]
106 newName =
'@rpath/' + libName
108 subprocess.call([
"install_name_tool",
"-change", libPath, newName, fileName])
109 if os.environ[
'LIB3_DIR']
not in libPath:
110 if not os.path.isfile(os.environ[
'LIB3_DIR'] +
"/lib/" + libName):
112 print(
"copying", libPath, os.environ[
'LIB3_DIR'] +
"/lib" )
113 shutil.copy(libPath, os.environ[
'LIB3_DIR'] +
"/lib")
117 os.chdir(os.path.join(os.environ[
'OCSSWROOT'],
"bin"))
118 for fileName
in os.listdir(
'.'):
119 if os.path.isfile(fileName):
120 line = subprocess.check_output([
'file', fileName]).decode(
"utf-8")
121 if "Mach-O 64-bit executable" in line:
123 p = subprocess.Popen([
"otool",
"-L", fileName], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
124 out, err = p.communicate()
126 lines = out.decode(
"utf-8").split(
'\n')
128 if '/opt/local/lib/' in line
or '/opt/X11/lib/' in line
or os.environ[
'LIB3_DIR']
in line
or '%s/lib' % (os.environ[
'OCSSWROOT'])
in line:
130 libPath = line.split()[0]
131 parts = libPath.split(
'/')
132 libName = parts[len(parts)-1]
133 newName =
'@rpath/' + libName
135 subprocess.call([
"install_name_tool",
"-change", libPath, newName, fileName])
136 if os.environ[
'LIB3_DIR']
not in libPath:
137 if not os.path.isfile(os.environ[
'LIB3_DIR'] +
"/lib/" + libName):
139 print(
"copying", libPath, os.environ[
'LIB3_DIR'] +
"/lib" )
140 shutil.copy(libPath, os.environ[
'LIB3_DIR'] +
"/lib")
144 os.chdir(os.path.join(os.environ[
'OCSSWROOT'],
"../viirs_l1/bin"))
145 for fileName
in os.listdir(
'.'):
146 if os.path.isfile(fileName):
147 line = subprocess.check_output([
'file', fileName]).decode(
"utf-8")
148 if "Mach-O 64-bit executable" in line:
150 p = subprocess.Popen([
"otool",
"-L", fileName], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
151 out, err = p.communicate()
153 lines = out.decode(
"utf-8").split(
'\n')
155 if '/opt/local/lib/' in line
or '/opt/X11/lib/' in line
or os.environ[
'LIB3_DIR']
in line
or '%s/lib' % (os.environ[
'OCSSWROOT'])
in line:
157 libPath = line.split()[0]
158 parts = libPath.split(
'/')
159 libName = parts[len(parts)-1]
160 newName =
'@rpath/' + libName
162 subprocess.call([
"install_name_tool",
"-change", libPath, newName, fileName])
163 if os.environ[
'LIB3_DIR']
not in libPath:
164 if not os.path.isfile(os.environ[
'LIB3_DIR'] +
"/lib/" + libName):
166 print(
"copying", libPath, os.environ[
'LIB3_DIR'] +
"/lib" )
167 shutil.copy(libPath, os.environ[
'LIB3_DIR'] +
"/lib")