Skip to content

Commit 0983b32

Browse files
committed
Address notes from Sunya
1 parent 326bc61 commit 0983b32

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

build_scripts/apple_utils.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def GetCodeSignID() -> str:
215215

216216

217217
def GetDevelopmentTeamID(identifier=None):
218-
if os.environ.get("DEVELOPMENT_TEAM"):
218+
if "DEVELOPMENT_TEAM" in os.environ:
219219
return os.environ.get("DEVELOPMENT_TEAM")
220220

221221
if not identifier:
@@ -243,19 +243,21 @@ def GetDevelopmentTeamID(identifier=None):
243243
return team
244244

245245

246-
def CodesignPath(path, identifier, team_identifier, force=False) -> bool:
246+
def CodesignPath(path, identifier, team_identifier, force=False, is_framework=False) -> bool:
247247
resign = force
248248
if not force:
249249
codesigning_info = GetCommandOutput(["codesign", "-vd", path])
250250
if not codesigning_info:
251251
resign = True
252252
else:
253+
# The output has multiple lines here
253254
for line in codesigning_info.splitlines():
254255
if line.startswith("TeamIdentifier="):
255256
current_team_identifier = line.split("=")[-1]
256-
if not team_identifier and "not set" in team_identifier:
257+
if not current_team_identifier or "not set" in current_team_identifier:
258+
resign = True
257259
break
258-
elif team_identifier == current_team_identifier:
260+
elif current_team_identifier == team_identifier:
259261
break
260262
else:
261263
resign = True
@@ -264,8 +266,8 @@ def CodesignPath(path, identifier, team_identifier, force=False) -> bool:
264266
return False
265267

266268
# Frameworks need to be signed with different parameters than loose binaries
267-
if path.endswith(".framework"):
268-
subprocess.check_output(
269+
if is_framework:
270+
subprocess.check_call(
269271
["codesign", "--force", "--sign", identifier, "--generate-entitlement-der", "--verbose", path])
270272
else:
271273
subprocess.check_call(["codesign", "--force", "--sign", identifier, path], stdout=devout, stderr=devout)
@@ -294,7 +296,7 @@ def Codesign(install_path, identifier=None, force=False, verbose_output=False) -
294296
_, ext = os.path.splitext(f)
295297
if ext in (".dylib", ".so"):
296298
path = os.path.join(root, f)
297-
result = CodesignPath(path, identifier, team_identifier=team_identifier, force=force)
299+
result = CodesignPath(path, identifier, team_identifier=team_identifier, force=force, is_framework=False)
298300
if verbose_output:
299301
if result:
300302
print(f"Code-signed binary: {path}")
@@ -307,7 +309,7 @@ def Codesign(install_path, identifier=None, force=False, verbose_output=False) -
307309

308310
for framework in frameworks:
309311
path = os.path.join(root, framework)
310-
result = CodesignPath(path, identifier, team_identifier=team_identifier, force=force)
312+
result = CodesignPath(path, identifier, team_identifier=team_identifier, force=force, is_framework=True)
311313
if verbose_output:
312314
if result:
313315
print(f"Code-signed framework: {path}")
@@ -362,9 +364,6 @@ def ConfigureCMakeExtraArgs(context, args:List[str]) -> List[str]:
362364
if TargetEmbeddedOS(context):
363365
system_name = context.buildTarget
364366

365-
if context.macOSCodesign:
366-
args.append(f"-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY={context.macOSCodesign}")
367-
368367
if system_name:
369368
args.append(f"-DCMAKE_SYSTEM_NAME={system_name}")
370369
args.append(f"-DCMAKE_OSX_SYSROOT={GetSDKRoot(context)}")

build_scripts/build_usd.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2082,7 +2082,8 @@ def InstallUSD(context, force, buildArgs):
20822082
default=codesignDefault, action="store_true",
20832083
help=("Enable code signing for macOS builds "
20842084
"(defaults to enabled on Apple Silicon)"))
2085-
group.add_argument("--codesign-id", dest="macos_codesign_id", type=str)
2085+
group.add_argument("--codesign-id", dest="macos_codesign_id", type=str,
2086+
help="A specific code-sign ID to use. If not provided, the build will try and find one or use '-'")
20862087

20872088
if Linux():
20882089
group.add_argument("--use-cxx11-abi", type=int, choices=[0, 1],

0 commit comments

Comments
 (0)