From bc8932542f2ec4b99a72902ea99df37ec69aacd4 Mon Sep 17 00:00:00 2001 From: Cian Hughes Date: Mon, 14 Feb 2022 13:56:54 +0000 Subject: [PATCH] Fixed error in previous commit --- .gitignore | 2 +- spec/Melter-Desktop.spec | 92 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 spec/Melter-Desktop.spec diff --git a/.gitignore b/.gitignore index b6e4761..fab75a0 100644 --- a/.gitignore +++ b/.gitignore @@ -31,7 +31,7 @@ MANIFEST # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest -*.spec +# *.spec # .spec files should be included as they are custom in this build # Installer logs pip-log.txt diff --git a/spec/Melter-Desktop.spec b/spec/Melter-Desktop.spec new file mode 100644 index 0000000..bd4533f --- /dev/null +++ b/spec/Melter-Desktop.spec @@ -0,0 +1,92 @@ +# -*- mode: python ; coding: utf-8 -*- +import platform +import kivy.tools.packaging.pyinstaller_hooks as pyinstaller_hooks + + +os = platform.system() +block_cipher = None + + +# Carry out platform specific imports +if os == "Windows": + from kivy_deps import sdl2, glew + +# Set platform specific constants +if os == "Linux": + icon = "../Icons/app-icon.svg" +elif os == "Windows": + icon = "../Icons/app-icon.ico" +else: + icon = None + + +a_kwargs = { + "pathex": [], + "binaries": [], + "datas": [ + ("../Templates/melter_desktop.kv", "Templates"), + ("../Templates/input_output_chooser.kv", "Templates"), + ("../Templates/file_chooser_popup.kv", "Templates"), + (icon, "Icons"), + ("../Fonts/DroidSansMono.ttf", "Fonts"), + ], + "hiddenimports": [ + "Templates", + "Templates.input_output_chooser", + "Templates.dropdown_button", + "Templates.console_output", + ], + "hookspath": [], + "hooksconfig": {}, + "runtime_hooks": [], + "excludes": [ + ".git" + ], + "win_no_prefer_redirects": False, + "win_private_assemblies": False, + "cipher": block_cipher, + "noarchive": False +} + + +# Add platform specific kwargs to a_kwargs +if os == "Windows": + a_kwargs["hiddenimports"].append("win32timezone") +# Add kivy deps and hooks to existing kwargs +for k, v in pyinstaller_hooks.get_deps_all().items(): + if k in a_kwargs: + a_kwargs[k] += v + else: + a_kwargs[k] = v + + +a = Analysis(["../Melter.py"], **a_kwargs) + +pyz = PYZ(a.pure, a.zipped_data, + cipher=block_cipher) + +exe = EXE(pyz, + a.scripts, + [], + exclude_binaries=True, + name="Melter", + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + console=True, + disable_windowed_traceback=False, + target_arch=None, + codesign_identity=None, + entitlements_file=None , icon=icon) + +# Prepare platform dependant args for COLLECT +c_args = [exe, a.binaries, a.zipfiles, a.datas] +if os == "Windows": + c_args += [Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)] + +coll = COLLECT(*c_args, + strip=False, + upx=True, + upx_exclude=[], + name="Melter")