|
| 1 | +# -*- mode: python ; coding: utf-8 -*- |
| 2 | + |
| 3 | +# This file is part of Slice. |
| 4 | +# |
| 5 | +# Slice is free software: you can redistribute it and/or modify |
| 6 | +# it under the terms of the GNU General Public License as published by |
| 7 | +# the Free Software Foundation, either version 3 of the License, or |
| 8 | +# (at your option) any later version. |
| 9 | +# |
| 10 | +# Slice is distributed in the hope that it will be useful, |
| 11 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | +# GNU General Public License for more details. |
| 14 | +# |
| 15 | +# You should have received a copy of the GNU General Public License |
| 16 | +# along with Slice. If not, see <https://www.gnu.org/licenses/>. |
| 17 | + |
| 18 | +import json |
| 19 | +from pathlib import Path |
| 20 | + |
| 21 | + |
| 22 | +with open(Path("src/build/settings/base.json")) as f: |
| 23 | + base_json = json.load(f) |
| 24 | + VERSION = base_json["version"] |
| 25 | + APP_NAME = base_json["app_name"] |
| 26 | + MAIN_MODULE_PATH = base_json["main_module"] |
| 27 | + |
| 28 | +with open(Path("src/build/settings/macos.json")) as f_macos: |
| 29 | + macos_json = json.load(f_macos) |
| 30 | + BUNDLE_ID = macos_json["bundle_identifier"] |
| 31 | + |
| 32 | +ICON_PATH = Path("icons/Icon.icns").resolve() |
| 33 | + |
| 34 | + |
| 35 | +block_cipher = None |
| 36 | + |
| 37 | + |
| 38 | +a = Analysis([Path(MAIN_MODULE_PATH).resolve()], |
| 39 | + pathex=[Path('target/PyInstaller-macOS').resolve()], |
| 40 | + binaries=[], |
| 41 | + datas=[], |
| 42 | + hiddenimports=[], |
| 43 | + excludes=[], |
| 44 | + win_no_prefer_redirects=False, |
| 45 | + win_private_assemblies=False, |
| 46 | + cipher=block_cipher, |
| 47 | + noarchive=False) |
| 48 | +pyz = PYZ(a.pure, a.zipped_data, |
| 49 | + cipher=block_cipher) |
| 50 | +exe = EXE(pyz, |
| 51 | + a.scripts, |
| 52 | + [], |
| 53 | + exclude_binaries=True, |
| 54 | + name=APP_NAME, |
| 55 | + debug=False, |
| 56 | + bootloader_ignore_signals=False, |
| 57 | + strip=False, |
| 58 | + upx=False, |
| 59 | + console=False , |
| 60 | + icon=ICON_PATH, |
| 61 | + ) |
| 62 | +coll = COLLECT(exe, |
| 63 | + a.binaries, |
| 64 | + a.zipfiles, |
| 65 | + a.datas, |
| 66 | + strip=False, |
| 67 | + upx=False, |
| 68 | + upx_exclude=[], |
| 69 | + name=APP_NAME) |
| 70 | +app = BUNDLE(coll, |
| 71 | + name=f'{APP_NAME}.app', |
| 72 | + icon=ICON_PATH, |
| 73 | + bundle_identifier=BUNDLE_ID, |
| 74 | + info_plist={ |
| 75 | + 'NSPrincipalClass': 'NSApplication', |
| 76 | + 'NSRequiresAquaSystemAppearance': False, |
| 77 | + 'CFBundleShortVersionString': VERSION, |
| 78 | + }, |
| 79 | + ) |
0 commit comments