From e5d35f95bb176c3f41a1ad80df6c23967e57d6a7 Mon Sep 17 00:00:00 2001 From: nicoboss Date: Mon, 2 Jan 2023 15:22:31 +0100 Subject: [PATCH] Added support for pyinstaller --- dev/PyInstallerBuild.sh | 8 ++++++ dev/requirements-pyinstaller.txt | 9 ++++++ nsz/__init__.spec | 47 ++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 dev/PyInstallerBuild.sh create mode 100644 dev/requirements-pyinstaller.txt create mode 100644 nsz/__init__.spec diff --git a/dev/PyInstallerBuild.sh b/dev/PyInstallerBuild.sh new file mode 100644 index 0000000..fb737d1 --- /dev/null +++ b/dev/PyInstallerBuild.sh @@ -0,0 +1,8 @@ +pip3 install -r ./requirements-pyinstaller.txt +cd ../nsz +rm -rf build +rm -rf dist +pyinstaller ./__init__.spec +cd dist/__init__ +read -p "Press any key to test ..." +./nsz.exe diff --git a/dev/requirements-pyinstaller.txt b/dev/requirements-pyinstaller.txt new file mode 100644 index 0000000..3f2a372 --- /dev/null +++ b/dev/requirements-pyinstaller.txt @@ -0,0 +1,9 @@ +pycryptodome +zstandard +enlighten +pywin32;platform_system == "Windows" +pypiwin32;platform_system == "Windows" +kivy +opencv-python +pyenchant +pyinstaller diff --git a/nsz/__init__.spec b/nsz/__init__.spec new file mode 100644 index 0000000..a45bf58 --- /dev/null +++ b/nsz/__init__.spec @@ -0,0 +1,47 @@ +# -*- mode: python ; coding: utf-8 -*- + +from kivy_deps import sdl2, glew +import cv2 +import enchant +block_cipher = None + +a = Analysis(['__init__.py'], + pathex=['C:\\Users\\Administrator\\Documents\\nsz\\nsz'], + binaries=[], + datas=[ + ('gui/json/*.json', 'nsz/gui/json'), + ('gui/layout/*.kv', 'nsz/gui/layout'), + ('gui/shaders/*.shader', 'nsz/gui/shaders'), + ('gui/fonts/*', 'nsz/gui/fonts'), + ('gui/txt/*.txt', 'nsz/gui/txt'), + ('gui/nsZip.png', 'nsz/gui/nsZip.png')], + hiddenimports=['win32timezone'], + hookspath=[], + runtime_hooks=[], + excludes=[], + win_no_prefer_redirects=False, + win_private_assemblies=False, + cipher=block_cipher, + noarchive=False) +pyz = PYZ(a.pure, a.zipped_data, + cipher=block_cipher) +exe = EXE(pyz, + a.scripts, + [], + exclude_binaries=True, + name='nsz', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + console=True ) +coll = COLLECT(exe, + a.scripts, + a.binaries, + a.zipfiles, + a.datas, + *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)], + strip=False, + upx=True, + upx_exclude=[], + name='__init__')