|
| 1 | +# -*- mode: python ; coding: utf-8 -*- |
| 2 | +import argparse |
| 3 | +import os |
| 4 | +import platform |
| 5 | + |
| 6 | +parser = argparse.ArgumentParser() |
| 7 | +parser.add_argument("--debug", action="store_true") |
| 8 | +parser.add_argument("--verbose", action="store_true") |
| 9 | +options = parser.parse_args() |
| 10 | + |
| 11 | +python_options = [ |
| 12 | + ("W ignore", None, "OPTION"), |
| 13 | +] |
| 14 | +if options.verbose: |
| 15 | + python_options.append(("v", None, "OPTION")) |
| 16 | + |
| 17 | +a = Analysis( |
| 18 | + ["run-activity-browser.py"], |
| 19 | + pathex=[], |
| 20 | + binaries=[], |
| 21 | + datas=[], |
| 22 | + hiddenimports=["activity_browser"], |
| 23 | + hookspath=[], |
| 24 | + hooksconfig={}, |
| 25 | + runtime_hooks=[], |
| 26 | + excludes=[], |
| 27 | + noarchive=False, |
| 28 | + optimize=0, |
| 29 | +) |
| 30 | +a.datas += Tree("activity_browser/static", prefix="activity_browser/static") |
| 31 | +pyz = PYZ(a.pure) |
| 32 | + |
| 33 | +if options.debug: |
| 34 | + exe = EXE( |
| 35 | + pyz, |
| 36 | + a.scripts, |
| 37 | + python_options, |
| 38 | + exclude_binaries=True, |
| 39 | + name="activity-browser", |
| 40 | + debug=False, |
| 41 | + bootloader_ignore_signals=False, |
| 42 | + strip=False, |
| 43 | + upx=True, |
| 44 | + console=False, |
| 45 | + disable_windowed_traceback=False, |
| 46 | + argv_emulation=False, |
| 47 | + target_arch=None, |
| 48 | + codesign_identity=None, |
| 49 | + entitlements_file=None, |
| 50 | + ) |
| 51 | + coll = COLLECT( |
| 52 | + exe, |
| 53 | + a.binaries, |
| 54 | + a.datas, |
| 55 | + strip=False, |
| 56 | + upx=True, |
| 57 | + upx_exclude=[], |
| 58 | + name="activity-browser", |
| 59 | + ) |
| 60 | + target = coll |
| 61 | +else: |
| 62 | + exe = EXE( |
| 63 | + pyz, |
| 64 | + a.scripts, |
| 65 | + python_options, |
| 66 | + a.binaries, |
| 67 | + a.datas, |
| 68 | + name="activity-browser", |
| 69 | + console=False, |
| 70 | + ) |
| 71 | + target = exe |
| 72 | + |
| 73 | +if platform.system() == "Darwin": |
| 74 | + app = BUNDLE( |
| 75 | + target, |
| 76 | + name="Activity Browser.app", |
| 77 | + icon="activity_browser/static/icons/activity-browser.icns", |
| 78 | + bundle_identifier=None, |
| 79 | + version=os.environ.get("VERSION", "0.0.0"), |
| 80 | + info_plist={ |
| 81 | + "NSPrincipalClass": "NSApplication", |
| 82 | + "NSAppleScriptEnabled": False, |
| 83 | + "CFBundleDocumentTypes": [ |
| 84 | + { |
| 85 | + "CFBundleTypeName": "Icon", |
| 86 | + "CFBundleTypeIconFile": "activity_browser/static/icons/activity-browser.icns", |
| 87 | + "LSItemContentTypes": [ |
| 88 | + "com.github.lca_activity_browser.activity_browser" |
| 89 | + ], |
| 90 | + "LSHandlerRank": "Owner", |
| 91 | + } |
| 92 | + ], |
| 93 | + }, |
| 94 | + ) |
0 commit comments