@@ -36,7 +36,7 @@ def build_analysis(name, location, binaries=[], datas=[], hiddenimports=[]):
3636 )
3737
3838
39- def build_collect (analysis , name , console = True ):
39+ def build_collect (analysis , name , console = True , entitlements = None ):
4040 """Used to build the COLLECT statements for each module"""
4141 pyz = PYZ (analysis .pure , analysis .zipped_data )
4242 exe = EXE (
@@ -49,7 +49,7 @@ def build_collect(analysis, name, console=True):
4949 upx = True ,
5050 console = console ,
5151 contents_directory = "." ,
52- entitlements_file = entitlements_file ,
52+ entitlements_file = entitlements or entitlements_file ,
5353 codesign_identity = codesign_identity ,
5454 )
5555 return COLLECT (
@@ -74,6 +74,7 @@ print("bundling activitywatch version " + current_release)
7474
7575# Get entitlements and codesign identity
7676entitlements_file = Path ("." ) / "scripts" / "package" / "entitlements.plist"
77+ app_entitlements_file = Path ("." ) / "scripts" / "package" / "app-entitlements.plist"
7778codesign_identity = os .environ .get ("APPLE_PERSONALID" , "" ).strip ()
7879if not codesign_identity :
7980 print ("Environment variable APPLE_PERSONALID not set. Releases won't be signed." )
@@ -92,6 +93,8 @@ awi_location = Path("aw-watcher-input")
9293aw_notify_location = Path ("aw-notify" )
9394
9495if platform .system () == "Darwin" :
96+ from PyInstaller .utils import osx as osxutils
97+
9598 icon = aw_qt_location / "media/logo/logo.icns"
9699else :
97100 icon = aw_qt_location / "media/logo/logo.ico"
@@ -208,6 +211,7 @@ awq_coll = build_collect(
208211 aw_qt_a ,
209212 "aw-qt" ,
210213 console = False if platform .system () == "Windows" else True ,
214+ entitlements = app_entitlements_file ,
211215)
212216
213217# aw-watcher-input
@@ -244,3 +248,8 @@ if platform.system() == "Darwin":
244248 # "CFBundleShortVersionString": current_release.lstrip('v'),
245249 },
246250 )
251+
252+ # BUNDLE inherits signing settings from the last COLLECT and deep-signs the
253+ # assembled bundle with them. Re-sign the application layer so its responsible
254+ # executable retains app-only capabilities without propagating them to helpers.
255+ osxutils .sign_binary (app .name , codesign_identity , app_entitlements_file )
0 commit comments