Fix codesigning

This commit is contained in:
Micah Lee 2020-12-30 14:17:03 -08:00
parent 69ee4a064e
commit ffb622c183
No known key found for this signature in database
GPG key ID: 403C2657CD994F73

View file

@ -6,6 +6,7 @@ import subprocess
import shutil import shutil
import argparse import argparse
import glob import glob
import itertools
root = os.path.dirname( root = os.path.dirname(
os.path.dirname( os.path.dirname(
@ -18,6 +19,24 @@ def run(cmd):
subprocess.run(cmd, cwd=root, check=True) subprocess.run(cmd, cwd=root, check=True)
def codesign(path, entitlements, identity):
run(
[
"codesign",
"--sign",
identity,
"--entitlements",
str(entitlements),
"--timestamp",
"--deep",
str(path),
"--force",
"--options",
"runtime",
]
)
def main(): def main():
# Parse arguments # Parse arguments
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
@ -58,19 +77,14 @@ def main():
) )
entitlements_plist_path = os.path.join(root, "install/macos/entitlements.plist") entitlements_plist_path = os.path.join(root, "install/macos/entitlements.plist")
run( for path in itertools.chain(
[ glob.glob(f"{app_path}/**/*.so", recursive=True),
"codesign", glob.glob(f"{app_path}/**/*.dylib", recursive=True),
"--deep", glob.glob(f"{app_path}/**/Python3", recursive=True),
"-s", [app_path],
identity_name_application, ):
"-o", codesign(path, entitlements_plist_path, identity_name_application)
"runtime", print(f"○ Signed app bundle: {app_path}")
"--entitlements",
entitlements_plist_path,
app_path,
]
)
# Detect if create-dmg is installed # Detect if create-dmg is installed
if not os.path.exists("/usr/local/bin/create-dmg"): if not os.path.exists("/usr/local/bin/create-dmg"):