scripts: add ignore-codesign-paths feature

QtDesignStudio packages Qt into the dmg
which is already codesigned.

Change-Id: I8d0f0d6df1e8792e44ef93ab6f871e6eecad7183
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Tim Jenssen
2023-03-01 11:08:22 +01:00
parent 3425b55352
commit cc4914ff83
2 changed files with 15 additions and 4 deletions

View File

@@ -228,16 +228,22 @@ def conditional_sign_recursive(path, filter):
if is_mac_platform():
os_walk(path, filter, lambda fp: codesign_executable(fp))
def codesign(app_path):
def is_filtered(path, ignore_paths):
for ignore_path in ignore_paths:
if path.startswith(ignore_path):
return True
return False
def codesign(app_path, filter_paths):
codesign = codesign_call()
if not codesign or not is_mac_platform():
return
# sign all executables in Resources
conditional_sign_recursive(os.path.join(app_path, 'Contents', 'Resources'),
lambda ff: os.access(ff, os.X_OK))
lambda ff: os.access(ff, os.X_OK) and not is_filtered(ff, filter_paths))
# sign all libraries in Imports
conditional_sign_recursive(os.path.join(app_path, 'Contents', 'Imports'),
lambda ff: ff.endswith('.dylib'))
lambda ff: ff.endswith('.dylib') and not is_filtered(ff, filter_paths))
# sign the whole bundle
entitlements_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'dist',