@@ -14,16 +14,19 @@ class Generator(Enum):
14
14
IFW = 1
15
15
TGZ = 2
16
16
17
- BUNDLED_APPS = ['OpenStudioApp.app' ]
17
+
18
+ BUNDLED_APPS = ["OpenStudioApp.app" ]
18
19
# BUNDLED_APPS = []
19
20
20
21
21
22
# Path.is_relative_to was added only in Python 3.9
22
- if not hasattr (Path , 'is_relative_to' ):
23
+ if not hasattr (Path , "is_relative_to" ):
24
+
23
25
def _is_relative_to (self , other ):
24
26
if not isinstance (other , Path ):
25
27
other = Path (other )
26
28
return other == self or other in self .parents
29
+
27
30
Path .is_relative_to = _is_relative_to
28
31
29
32
@@ -32,13 +35,13 @@ def get_cmake_install_prefix_for_generator(build_dir: Path, generator: Generator
32
35
if not cpack_dir .exists ():
33
36
print (f"Could not find a _CPack_Packages directory for { generator .name } " )
34
37
return None
35
- cmake_install_root = next (x for x in cpack_dir .glob ('*' ) if x .is_dir () and x .suffix != ' .app' )
38
+ cmake_install_root = next (x for x in cpack_dir .glob ("*" ) if x .is_dir () and x .suffix != " .app" )
36
39
if generator == Generator .TGZ :
37
40
return cmake_install_root
38
41
39
- p = cmake_install_root / ' packages'
42
+ p = cmake_install_root / " packages"
40
43
if component :
41
- p = p / component / ' data'
44
+ p = p / component / " data"
42
45
assert p .is_dir ()
43
46
return p
44
47
@@ -67,12 +70,15 @@ def find_executable_files(root_dir: Path) -> List[Path]:
67
70
]
68
71
)
69
72
70
- sos = list ([
71
- x for x in root_dir .glob ('**/*.so' )
72
- if x .is_file ()
73
- and not x .is_symlink ()
74
- and not any ([x .is_relative_to (bundled_p ) for bundled_p in bundled_apps ])
75
- ])
73
+ sos = list (
74
+ [
75
+ x
76
+ for x in root_dir .glob ("**/*.so" )
77
+ if x .is_file ()
78
+ and not x .is_symlink ()
79
+ and not any ([x .is_relative_to (bundled_p ) for bundled_p in bundled_apps ])
80
+ ]
81
+ )
76
82
77
83
print (f"In { root_dir } found { len (files )} executable files and { len (dylibs )} dylibs and { len (sos )} SOs" )
78
84
@@ -133,26 +139,26 @@ def get_linked_libraries(p):
133
139
134
140
m = _OTOOL_ARCHITECTURE_RE .match (lines [0 ])
135
141
assert m
136
- arch = m .groupdict ()[' architecture' ]
142
+ arch = m .groupdict ()[" architecture" ]
137
143
if arch is None :
138
144
lines = lines [1 :]
139
145
else :
140
146
arches = {}
141
- arches [arch ] = {' start' : 1 }
147
+ arches [arch ] = {" start" : 1 }
142
148
for i , line in enumerate (lines ):
143
149
if i == 0 :
144
150
continue
145
151
if m := _OTOOL_ARCHITECTURE_RE .match (line ):
146
- arches [arch ][' end' ] = i
147
- arch = m .groupdict ()[' architecture' ]
148
- arches [arch ] = {' start' : i + 1 }
149
- arches [arch ][' end' ] = len (lines ) - 1
152
+ arches [arch ][" end" ] = i
153
+ arch = m .groupdict ()[" architecture" ]
154
+ arches [arch ] = {" start" : i + 1 }
155
+ arches [arch ][" end" ] = len (lines ) - 1
150
156
151
- in_preference_order = [' arm64' , ' x86_64' , ' i386' ]
157
+ in_preference_order = [" arm64" , " x86_64" , " i386" ]
152
158
for pref_arch in in_preference_order :
153
159
if pref_arch in arches :
154
160
arch = pref_arch
155
- lines = lines [arches [pref_arch ][' start' ]: arches [pref_arch ][' end' ]]
161
+ lines = lines [arches [pref_arch ][" start" ] : arches [pref_arch ][" end" ]]
156
162
print (f"Found multiple architectures, will select { pref_arch } , candidates were { arches .keys ()} " )
157
163
break
158
164
@@ -244,7 +250,7 @@ def otool(p, verify_resolve=False, verbose=False):
244
250
break
245
251
if not found and verify_resolve :
246
252
msg = f"Could not resolve '{ libname } ' for '{ p } '"
247
- if ' Radiance' in p .parts :
253
+ if " Radiance" in p .parts :
248
254
print (msg )
249
255
else :
250
256
raise ValueError (msg )
@@ -274,9 +280,7 @@ def otool(p, verify_resolve=False, verbose=False):
274
280
parser .add_argument (
275
281
"--install" , action = "store_true" , default = False , help = "This is an install dir, not the build_dir"
276
282
)
277
- parser .add_argument (
278
- "--verbose" , action = "store_true" , default = False , help = "Enable verbose output"
279
- )
283
+ parser .add_argument ("--verbose" , action = "store_true" , default = False , help = "Enable verbose output" )
280
284
parser .add_argument (
281
285
"--only-generator" , type = str , help = "Only run for the given generator" , choices = [i .name for i in Generator ]
282
286
)
0 commit comments