Skip to content

Commit e84f930

Browse files
committed
Integrate suggestions from Sunya
1 parent d857716 commit e84f930

1 file changed

Lines changed: 28 additions & 15 deletions

File tree

build_scripts/apple_utils.py

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# Licensed under the terms set forth in the LICENSE.txt file available at
55
# https://openusd.org/license.
66
#
7-
87
# Utilities for managing Apple OS build concerns.
98
#
109
# NOTE: This file and its contents may change significantly as we continue
@@ -19,6 +18,7 @@
1918
import platform
2019
import shlex
2120
import subprocess
21+
import glob
2222
from typing import Optional, List, Dict
2323

2424
TARGET_NATIVE = "native"
@@ -278,30 +278,43 @@ def Codesign(install_path, identifier=None, force=False, verbose_output=False) -
278278
if not MacOS():
279279
return False
280280

281-
codeSignID = identifier or GetCodeSignID()
281+
identifier = identifier or GetCodeSignID()
282282

283283
if verbose_output:
284284
global devout
285285
devout = sys.stdout
286286
print(f"Code-signing files in {install_path} with {identifier}", file=devout)
287287

288288
try:
289-
team_identifier = GetDevelopmentTeamID(codeSignID)
289+
team_identifier = GetDevelopmentTeamID(identifier)
290290
except:
291+
if verbose_output:
292+
print("Could not get team_identifier")
291293
team_identifier = None
292294

293-
for root, dirs, files in os.walk(install_path, topdown=True):
294-
for f in files:
295-
296-
_, ext = os.path.splitext(f)
297-
if ext in (".dylib", ".so"):
298-
path = os.path.join(root, f)
299-
result = CodesignPath(path, identifier, team_identifier=team_identifier, force=force, is_framework=False)
300-
if verbose_output:
301-
if result:
302-
print(f"Code-signed binary: {path}")
303-
else:
304-
print(f"Did not code-sign binary: {path}")
295+
codesignPaths = [
296+
os.path.join(install_path, 'lib'),
297+
os.path.join(install_path, 'plugin'),
298+
os.path.join(install_path, 'share/usd'),
299+
os.path.join(install_path, "frameworks")
300+
]
301+
302+
for basePath in codesignPaths:
303+
if not os.path.exists(basePath):
304+
continue
305+
306+
for root, dirs, files in os.walk(basePath, topdown=True):
307+
for f in files:
308+
309+
_, ext = os.path.splitext(f)
310+
if ext in (".dylib", ".so"):
311+
path = os.path.join(root, f)
312+
result = CodesignPath(path, identifier, team_identifier=team_identifier, force=force, is_framework=False)
313+
if verbose_output:
314+
if result:
315+
print(f"Code-signed binary: {path}")
316+
else:
317+
print(f"Did not code-sign binary: {path}")
305318

306319
# Bit annoying to have to do this twice, but seems the fastest way to skip traversing frameworks
307320
frameworks = [d for d in dirs if d.endswith(".framework")]

0 commit comments

Comments
 (0)