From 8114feccacb73e722ba072a6f94c9734e1cbdaa6 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Mon, 3 May 2021 17:22:23 +0200 Subject: [PATCH] Pyinstaller build ready. --- .gitignore | 1 + CHANGELOG.md | 8 ++ README.md | 9 +- parsetools.py | 10 +- pesterchum.py | 18 +-- pesterchum.spec | 85 +++++------- pesterchum.spec.old.txt | 52 +++++++ pyinstaller.py | 301 ++++++++++++++++++++++++++++++++++++++++ setup.py | 1 - version.py | 4 +- 10 files changed, 416 insertions(+), 73 deletions(-) create mode 100644 pesterchum.spec.old.txt create mode 100644 pyinstaller.py diff --git a/.gitignore b/.gitignore index a7e0f65..1b9a479 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ Pesterchum.dmg subscript.txt package-lock.json package.json +pesterchum.spec \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 073a12a..c4264a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ # Changelog (This document uses YYYY-MM-DD as per ISO 8601) +## [v2.1.3] - 2021-5-3 + +### Added +- pyinstaller.py script to make building with pyinstaller more convenient. + +### Changed +- Honk emote now only triggers when typing ':honk:' instead of on every 'honk'. + ## [v2.1.2] - 2021-4-16 ### Added diff --git a/README.md b/README.md index 74cfed0..86cfc14 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,11 @@ You can install them with Python's pip or your package manager if you're on linu [python-magic]: https://pypi.org/project/python-magic/ [ostools]: https://pypi.org/project/ostools/ [requests]: https://pypi.org/project/requests/ + +### PYINSTALLER BUILDING +My preferred method of generating binary releases. +``python pyinstaller.py`` + ### CX_FREEZE BUILDING #### Windows: @@ -65,10 +70,6 @@ or #### Mac: ``python setup.py build`` -### PYINSTALLER BUILDING -#### Linux (might also work on other platforms!!): -``pyinstaller pesterchum.spec`` - ## SMILIES Just for easy reference. :3 (Taken from docs/README-karxi.mkdn) diff --git a/parsetools.py b/parsetools.py index 10ec2e5..cf19f28 100644 --- a/parsetools.py +++ b/parsetools.py @@ -213,10 +213,11 @@ class honker(lexercon.Chunk): def __init__(self, string): self.string = string def convert(self, format): - if format == "html": - return "" - else: - return self.string + # No more 'honk' turning into an emote because everyone hated that :') + #if format == "html": + # return "" + #else: + return self.string class mecmd(lexercon.Chunk): def __init__(self, string, mecmd, suffix): @@ -998,6 +999,7 @@ smiledict = { ":suckers:": "Suckers.gif", ":scorpio:": "scorpio.gif", ":shades:": "shades.png", + ":honk:": "honk.png", } if ostools.isOSXBundle(): diff --git a/pesterchum.py b/pesterchum.py index 5b766ac..80cec58 100644 --- a/pesterchum.py +++ b/pesterchum.py @@ -103,7 +103,7 @@ else: reqmissing = [] optmissing = [] try: - from PyQt5 import QtCore, QtGui, QtMultimedia, QtWidgets + from PyQt5 import QtCore, QtGui, QtWidgets except ImportError as e: module = str(e) if module.startswith("No module named ") or \ @@ -1933,20 +1933,9 @@ class PesterWindow(MovingWindow): if (pygame and pygame.mixer): # We have pygame, so we may as well use it. soundclass = pygame.mixer.Sound - # QSound.isAvailable no longer exists in pyqt5 :( - # This deserves a better solution - #elif QtMultimedia.QSound.isAvailable(): - # # We don't have pygame; try to use QSound. - # soundclass = QtMultimedia.QSound - #else: - # # We don't have any options...just use fillers. - # soundclass = NoneSound else: logging.warning("Failed to define pygame mixer, is pygame imported?") - try: - soundclass = QtMultimedia.QSound - except: - soundclass = NoneSound + soundclass = NoneSound self.sound_type = soundclass @@ -1982,8 +1971,7 @@ class PesterWindow(MovingWindow): if pygame and pygame.mixer and \ isinstance(sound, pygame.mixer.Sound):#pygame.mixer.Sound is case sensitive!! sound.set_volume(vol) - elif not isinstance(sound, QtMultimedia.QSound): - # We can't set a volume on those.... + else: sound.setVolume(vol) except Exception as err: # Why was this set as "info"? ?w? diff --git a/pesterchum.spec b/pesterchum.spec index c9e2001..6be23ea 100644 --- a/pesterchum.spec +++ b/pesterchum.spec @@ -1,47 +1,38 @@ -# -*- mode: python ; coding: utf-8 -*- - -block_cipher = None - -added_files = [ - ( "quirks", 'quirks' ), - ( "smilies", 'smilies' ), - ( "themes", 'themes' ), - ( "docs", 'docs' ), - ( "README.md", '.' ), - ( "LICENSE", '.' ), - ( "CHANGELOG.md", '.' ), - ( "PCskins.png", '.' ), - ( "Pesterchum.png", '.' ) - ] - -a = Analysis(['pesterchum.py'], - binaries=[], - datas=added_files, - hiddenimports=[], - 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='Pesterchum', - debug=False, - bootloader_ignore_signals=False, - strip=False, - upx=True, - console=False ) -coll = COLLECT(exe, - a.binaries, - a.zipfiles, - a.datas, - strip=False, - upx=True, - upx_exclude=[], - name='Pesterchum') +# -*- mode: python ; coding: utf-8 -*- + + +block_cipher = None + + +a = Analysis(['pesterchum.py'], + pathex=['C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86', 'd:\\Documents\\PchumAttempt\\qt5\\pesterchum-alt-servers'], + binaries=[('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-console-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-console-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-console-l1-2-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-datetime-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-debug-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-errorhandling-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-file-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-file-l1-2-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-file-l2-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-handle-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-heap-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-interlocked-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-libraryloader-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-localization-l1-2-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-memory-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-namedpipe-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-processenvironment-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-processthreads-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-processthreads-l1-1-1.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-profile-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-rtlsupport-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-string-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-synch-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-synch-l1-2-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-sysinfo-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-timezone-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-util-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\API-MS-Win-core-xstate-l2-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-crt-conio-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-crt-convert-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-crt-environment-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-crt-filesystem-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-crt-heap-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-crt-locale-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-crt-math-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-crt-multibyte-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-crt-private-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-crt-process-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-crt-runtime-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-crt-stdio-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-crt-string-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-crt-time-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-crt-utility-l1-1-0.dll', '.'), ('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\ucrtbase.dll', '.')], + datas=[('quirks', 'quirks'), ('smilies', 'smilies'), ('themes', 'themes'), ('docs', 'docs'), ('README.md', '.'), ('LICENSE', '.'), ('CHANGELOG.md', '.'), ('PCskins.png', '.'), ('Pesterchum.png', '.')], + hiddenimports=[], + hookspath=[], + runtime_hooks=[], + excludes=['collections.sys', 'collections._sre', 'collections._json', 'collections._locale', 'collections._struct', 'collections.array', 'collections._weakref', 'PyQt5.QtMultimedia', 'PyQt5.QtDBus', 'PyQt5.QtDeclarative', 'PyQt5.QtHelp', 'PyQt5.QtNetwork', 'PyQt5.QtSql', 'PyQt5.QtSvg', 'PyQt5.QtTest', 'PyQt5.QtWebKit', 'PyQt5.QtXml', 'PyQt5.QtXmlPatterns', 'PyQt5.phonon', 'PyQt5.QtAssistant', 'PyQt5.QtDesigner', 'PyQt5.QAxContainer'], + 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='Pesterchum', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + console=False , icon='pesterchum.ico') +coll = COLLECT(exe, + a.binaries, + a.zipfiles, + a.datas, + strip=False, + upx=True, + upx_exclude=['qwindows.dll', 'qwindows.dll', 'Qt5Core.dll', 'qt5core.dll', 'Qt5Gui.dll', 'qt5gui.dll', 'vcruntime140.dll', 'vcruntime140.dll', 'MSVCP140.dll', 'msvcp140.dll', 'MSVCP140_1.dllapi-ms-win-core-console-l1-1-0.dll', 'msvcp140_1.dllapi-ms-win-core-console-l1-1-0.dll', 'api-ms-win-core-console-l1-1-0.dll', 'api-ms-win-core-console-l1-1-0.dll', 'api-ms-win-core-console-l1-2-0.dll', 'api-ms-win-core-console-l1-2-0.dll', 'api-ms-win-core-datetime-l1-1-0.dll', 'api-ms-win-core-datetime-l1-1-0.dll', 'api-ms-win-core-debug-l1-1-0.dll', 'api-ms-win-core-debug-l1-1-0.dll', 'api-ms-win-core-errorhandling-l1-1-0.dll', 'api-ms-win-core-errorhandling-l1-1-0.dll', 'api-ms-win-core-file-l1-1-0.dll', 'api-ms-win-core-file-l1-1-0.dll', 'api-ms-win-core-file-l1-2-0.dll', 'api-ms-win-core-file-l1-2-0.dll', 'api-ms-win-core-file-l2-1-0.dll', 'api-ms-win-core-file-l2-1-0.dll', 'api-ms-win-core-handle-l1-1-0.dll', 'api-ms-win-core-handle-l1-1-0.dll', 'api-ms-win-core-heap-l1-1-0.dll', 'api-ms-win-core-heap-l1-1-0.dll', 'api-ms-win-core-interlocked-l1-1-0.dll', 'api-ms-win-core-interlocked-l1-1-0.dll', 'api-ms-win-core-libraryloader-l1-1-0.dll', 'api-ms-win-core-libraryloader-l1-1-0.dll', 'api-ms-win-core-localization-l1-2-0.dll', 'api-ms-win-core-localization-l1-2-0.dll', 'api-ms-win-core-memory-l1-1-0.dll', 'api-ms-win-core-memory-l1-1-0.dll', 'api-ms-win-core-namedpipe-l1-1-0.dll', 'api-ms-win-core-namedpipe-l1-1-0.dll', 'api-ms-win-core-processenvironment-l1-1-0.dll', 'api-ms-win-core-processenvironment-l1-1-0.dll', 'api-ms-win-core-processthreads-l1-1-0.dll', 'api-ms-win-core-processthreads-l1-1-0.dll', 'api-ms-win-core-processthreads-l1-1-1.dll', 'api-ms-win-core-processthreads-l1-1-1.dll', 'api-ms-win-core-profile-l1-1-0.dll', 'api-ms-win-core-profile-l1-1-0.dll', 'api-ms-win-core-rtlsupport-l1-1-0.dll', 'api-ms-win-core-rtlsupport-l1-1-0.dll', 'api-ms-win-core-string-l1-1-0.dll', 'api-ms-win-core-string-l1-1-0.dll', 'api-ms-win-core-synch-l1-1-0.dll', 'api-ms-win-core-synch-l1-1-0.dll', 'api-ms-win-core-synch-l1-2-0.dll', 'api-ms-win-core-synch-l1-2-0.dll', 'api-ms-win-core-sysinfo-l1-1-0.dll', 'api-ms-win-core-sysinfo-l1-1-0.dll', 'api-ms-win-core-timezone-l1-1-0.dll', 'api-ms-win-core-timezone-l1-1-0.dll', 'api-ms-win-core-util-l1-1-0.dll', 'api-ms-win-core-util-l1-1-0.dll', 'API-MS-Win-core-xstate-l2-1-0.dll', 'api-ms-win-core-xstate-l2-1-0.dll', 'api-ms-win-crt-conio-l1-1-0.dll', 'api-ms-win-crt-conio-l1-1-0.dll', 'api-ms-win-crt-convert-l1-1-0.dll', 'api-ms-win-crt-convert-l1-1-0.dll', 'api-ms-win-crt-environment-l1-1-0.dll', 'api-ms-win-crt-environment-l1-1-0.dll', 'api-ms-win-crt-filesystem-l1-1-0.dll', 'api-ms-win-crt-filesystem-l1-1-0.dll', 'api-ms-win-crt-heap-l1-1-0.dll', 'api-ms-win-crt-heap-l1-1-0.dll', 'api-ms-win-crt-locale-l1-1-0.dll', 'api-ms-win-crt-locale-l1-1-0.dll', 'api-ms-win-crt-math-l1-1-0.dll', 'api-ms-win-crt-math-l1-1-0.dll', 'api-ms-win-crt-multibyte-l1-1-0.dll', 'api-ms-win-crt-multibyte-l1-1-0.dll', 'api-ms-win-crt-private-l1-1-0.dll', 'api-ms-win-crt-private-l1-1-0.dll', 'api-ms-win-crt-process-l1-1-0.dll', 'api-ms-win-crt-process-l1-1-0.dll', 'api-ms-win-crt-runtime-l1-1-0.dll', 'api-ms-win-crt-runtime-l1-1-0.dll', 'api-ms-win-crt-stdio-l1-1-0.dll', 'api-ms-win-crt-stdio-l1-1-0.dll', 'api-ms-win-crt-string-l1-1-0.dll', 'api-ms-win-crt-string-l1-1-0.dll', 'api-ms-win-crt-time-l1-1-0.dll', 'api-ms-win-crt-time-l1-1-0.dll', 'api-ms-win-crt-utility-l1-1-0.dll', 'api-ms-win-crt-utility-l1-1-0.dll', 'ucrtbase.dll', 'ucrtbase.dll'], + name='Pesterchum') diff --git a/pesterchum.spec.old.txt b/pesterchum.spec.old.txt new file mode 100644 index 0000000..e1b44cc --- /dev/null +++ b/pesterchum.spec.old.txt @@ -0,0 +1,52 @@ +# -*- mode: python ; coding: utf-8 -*- + +block_cipher = None + +added_binaries = [ + ( "C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86\\api-ms-win-core-console-l1-1-0.dll", '.' ), + #( "api-ms-win-core-file-l1-1-0.dll", '.' ), + ] + +added_files = [ + ( "quirks", 'quirks' ), + ( "smilies", 'smilies' ), + ( "themes", 'themes' ), + ( "docs", 'docs' ), + ( "README.md", '.' ), + ( "LICENSE", '.' ), + ( "CHANGELOG.md", '.' ), + ( "PCskins.png", '.' ), + ( "Pesterchum.png", '.' ) + ] + +a = Analysis(['pesterchum.py'], + #binaries=added_binaries, + datas=added_files, + hiddenimports=[], + 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, + icon='pesterchum.ico', + exclude_binaries=True, + name='Pesterchum', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + console=False ) +coll = COLLECT(exe, + #a.binaries, + a.zipfiles, + a.datas, + strip=False, + upx=True, + upx_exclude=['qwindows.dll', 'Qt5Multimedia.dll', 'Qt5Gui.dll', 'Qt5Core.dll', 'vcruntime140.dll', 'MSVCP140.dll', 'Qt5Multimedia.dll'.lower(), 'Qt5Gui.dll'.lower(), 'Qt5Core.dll'.lower(), 'vcruntime140.dll'.lower(), 'MSVCP140.dll'.lower()], # UPX corrupts DLLs sometimes = (3, 9, 0)) & (sys.platform == 'win32'): + print("WARNING!!!! Building with python 3.9 will make your builds not run on windows 7 and previous versions.") + +def is_64bit() -> bool: + return sys.maxsize > 2**32 + +is_64bit = is_64bit() + +try: + print("Pyinstaller script to make everything a bit more conventient, just being able to run \"pyinstaller\" \ +is a lot more useable than having to include all command line arguments every time.\n") + + delete_builddist = input("Delete build & dist folders? (Y/N): ") + if delete_builddist.lower() == "y": + try: + shutil.rmtree('dist') + except FileNotFoundError as e: + print(e) + try: + shutil.rmtree('build') + except FileNotFoundError as e: + print(e) + + print("\nUPX corrupts DLLs when it feels like it, try disabling it if your build doesn't run.") + if is_64bit == True: + upx_dir = input("UPX directory [D:\\upx-3.96-win64]: ") + if upx_dir == '': + upx_dir = "D:\\upx-3.96-win64" # Default dir for me :) + else: + upx_dir = input("UPX directory [D:\\upx-3.96-win32]: ") + if upx_dir == '': + upx_dir = "D:\\upx-3.96-win32" # Default dir for me :) + print("upx_dir = " + upx_dir) + print("\nUniversal CRT needs to be included if you don't want to run into compatibility issues when building on Windows 10. ( https://pyinstaller.readthedocs.io/en/stable/usage.html?highlight=sdk#windows )") + if is_64bit == True: + crt_path = input("Universal CRT: [C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x64]: ") + if crt_path == '': + crt_path = "C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x64" # Default directory. + else: + crt_path = input("Extra path: [C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86]: ") + if crt_path == '': + crt_path = "C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86" # Default directory. + print("crt_path = " + crt_path) +except KeyboardInterrupt as e: + sys.exit("KeyboardInterrupt") + +exclude_modules = ['collections.sys', + 'collections._sre', + 'collections._json', + 'collections._locale', + 'collections._struct', + 'collections.array', + 'collections._weakref', + 'PyQt5.QtMultimedia', + 'PyQt5.QtDBus', + 'PyQt5.QtDeclarative', + 'PyQt5.QtHelp', + 'PyQt5.QtNetwork', + 'PyQt5.QtSql', + 'PyQt5.QtSvg', + 'PyQt5.QtTest', + 'PyQt5.QtWebKit', + 'PyQt5.QtXml', + 'PyQt5.QtXmlPatterns', + 'PyQt5.phonon', + 'PyQt5.QtAssistant', + 'PyQt5.QtDesigner', + 'PyQt5.QAxContainer',] + +add_data = ['quirks;quirks', + 'smilies;smilies', + 'themes;themes', + 'docs;docs', + 'README.md;.', + 'LICENSE;.', + 'CHANGELOG.md;.', + 'PCskins.png;.', + 'Pesterchum.png;.'] + +upx_exclude = ["qwindows.dll", + "Qt5Core.dll", + "Qt5Gui.dll", + "vcruntime140.dll", + "MSVCP140.dll", + "MSVCP140_1.dll" + "api-ms-win-core-console-l1-1-0.dll",\ + "api-ms-win-core-console-l1-1-0.dll",\ + "api-ms-win-core-console-l1-2-0.dll",\ + "api-ms-win-core-datetime-l1-1-0.dll",\ + "api-ms-win-core-debug-l1-1-0.dll",\ + "api-ms-win-core-errorhandling-l1-1-0.dll",\ + "api-ms-win-core-file-l1-1-0.dll",\ + "api-ms-win-core-file-l1-2-0.dll",\ + "api-ms-win-core-file-l2-1-0.dll",\ + "api-ms-win-core-handle-l1-1-0.dll",\ + "api-ms-win-core-heap-l1-1-0.dll",\ + "api-ms-win-core-interlocked-l1-1-0.dll",\ + "api-ms-win-core-libraryloader-l1-1-0.dll",\ + "api-ms-win-core-localization-l1-2-0.dll",\ + "api-ms-win-core-memory-l1-1-0.dll",\ + "api-ms-win-core-namedpipe-l1-1-0.dll",\ + "api-ms-win-core-processenvironment-l1-1-0.dll",\ + "api-ms-win-core-processthreads-l1-1-0.dll",\ + "api-ms-win-core-processthreads-l1-1-1.dll",\ + "api-ms-win-core-profile-l1-1-0.dll",\ + "api-ms-win-core-rtlsupport-l1-1-0.dll",\ + "api-ms-win-core-string-l1-1-0.dll",\ + "api-ms-win-core-synch-l1-1-0.dll",\ + "api-ms-win-core-synch-l1-2-0.dll",\ + "api-ms-win-core-sysinfo-l1-1-0.dll",\ + "api-ms-win-core-timezone-l1-1-0.dll",\ + "api-ms-win-core-util-l1-1-0.dll",\ + "API-MS-Win-core-xstate-l2-1-0.dll",\ + "api-ms-win-crt-conio-l1-1-0.dll",\ + "api-ms-win-crt-convert-l1-1-0.dll",\ + "api-ms-win-crt-environment-l1-1-0.dll",\ + "api-ms-win-crt-filesystem-l1-1-0.dll",\ + "api-ms-win-crt-heap-l1-1-0.dll",\ + "api-ms-win-crt-locale-l1-1-0.dll",\ + "api-ms-win-crt-math-l1-1-0.dll",\ + "api-ms-win-crt-multibyte-l1-1-0.dll",\ + "api-ms-win-crt-private-l1-1-0.dll",\ + "api-ms-win-crt-process-l1-1-0.dll",\ + "api-ms-win-crt-runtime-l1-1-0.dll",\ + "api-ms-win-crt-stdio-l1-1-0.dll",\ + "api-ms-win-crt-string-l1-1-0.dll",\ + "api-ms-win-crt-time-l1-1-0.dll",\ + "api-ms-win-crt-utility-l1-1-0.dll",\ + "ucrtbase.dll"] + +#Windows +if sys.platform == 'win32': + run_win32 = [ + 'pesterchum.py', + '--name=Pesterchum', + '--paths=%s' % crt_path, + #'--noconfirm', # Overwrite output directory. + '--upx-dir=%s' % upx_dir, # Set Upx directory. (I think it also works from path.) + '--windowed', # Hide console + #'--onefile', + '--icon=pesterchum.ico', + #'--clean', # Clear cache + + #'--hidden-import=pkg_resources.py2_warn', + #'--hidden-import=PyQt5.sip', + + #'--add-data=quirks;quirks', + #'--add-data=smilies;smilies', + #'--add-data=themes;themes', + #'--add-data=docs;docs', + #'--add-data=README.md;.', + #'--add-data=LICENSE;.', + #'--add-data=CHANGELOG.md;.', + #'--add-data=PCskins.png;.', + #'--add-data=Pesterchum.png;.', + + #'--upx-exclude=qwindows.dll', + #'--upx-exclude=Qt5Multimedia.dll', + #'--upx-exclude=Qt5Gui.dll', + #'--upx-exclude=Qt5Core.dll', + #'--upx-exclude=vcruntime140.dll', + #'--upx-exclude=MSVCP140.dll', + #'--upx-exclude=MSVCP140_1.dll', + #'--upx-exclude=' + 'Qt5Multimedia.dll'.lower(), + #'--upx-exclude=' + 'Qt5Gui.dll'.lower(), + #'--upx-exclude=' + 'Qt5Core.dll'.lower(), + #'--upx-exclude=' + 'vcruntime140.dll'.lower(), + #'--upx-exclude=' + 'MSVCP140.dll'.lower() + ] + + for x in upx_exclude: + run_win32.append('--upx-exclude=%s' % x ) + # Lower case variants are required. + run_win32.append('--upx-exclude=%s' % x.lower() ) + + for x in exclude_modules: + run_win32.append('--exclude-module=%s' % x ) + + for x in add_data: + run_win32.append('--add-data=%s' % x ) + + if os.path.exists(crt_path): + run_win32.append('--add-binary=%s\\api-ms-win-core-console-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-console-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-console-l1-2-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-datetime-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-debug-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-errorhandling-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-file-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-file-l1-2-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-file-l2-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-handle-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-heap-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-interlocked-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-libraryloader-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-localization-l1-2-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-memory-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-namedpipe-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-processenvironment-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-processthreads-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-processthreads-l1-1-1.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-profile-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-rtlsupport-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-string-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-synch-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-synch-l1-2-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-sysinfo-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-timezone-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-core-util-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\API-MS-Win-core-xstate-l2-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-crt-conio-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-crt-convert-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-crt-environment-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-crt-filesystem-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-crt-heap-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-crt-locale-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-crt-math-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-crt-multibyte-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-crt-private-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-crt-process-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-crt-runtime-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-crt-stdio-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-crt-string-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-crt-time-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\api-ms-win-crt-utility-l1-1-0.dll;.' % crt_path) + run_win32.append('--add-binary=%s\\ucrtbase.dll;.' % crt_path) + + PyInstaller.__main__.run(run_win32) +#MacOS +elif sys.platform == 'darwin' : + run_darwin =[ + 'pesterchum.py', + '--windowed', # Hide console + #'--noconfirm', # Overwrite output directory. + '--icon=trayicon32.icns', # Icon + + '--upx-dir=%s' % upx_dir # Set Upx directory. (I think it also works from path.) + ] + + for x in upx_exclude: + run_darwin.append('--upx-exclude=%s' % x ) + # Lower case variants are required. + run_darwin.append('--upx-exclude=%s' % x.lower() ) + + for x in exclude_modules: + run_darwin.append('--exclude-module=%s' % x ) + + for x in add_data: + run_darwin.append('--add-data=%s' % x.replace(';',':') ) + + PyInstaller.__main__.run(run_darwin) +#Linux +elif sys.platform == 'linux' : + run_linux =[ + 'pesterchum.py', + '--onedir', # Hide console + #'--noconfirm', # Overwrite output directory. + '--icon=trayicon32.icns', # Icon + + '--upx-dir=%s' % upx_dir # Set Upx directory. (I think it also works from path.) + ] + + for x in upx_exclude: + run_linux.append('--upx-exclude=%s' % x ) + # Lower case variants are required. + run_linux.append('--upx-exclude=%s' % x.lower() ) + + for x in exclude_modules: + run_linux.append('--exclude-module=%s' % x ) + + for x in add_data: + run_linux.append('--add-data=%s' % x.replace(';',':') ) + + PyInstaller.__main__.run(run_linux) +else: + print("Unknown platform.") + + run_generic =[ + 'pesterchum.py', + '--upx-dir=%s' % upx_dir # Set Upx directory. (I think it also works from path.) + ] + + for x in upx_exclude: + run_generic.append('--upx-exclude=%s' % x ) + # Lower case variants are required. + run_generic.append('--upx-exclude=%s' % x.lower() ) + + for x in exclude_modules: + run_generic.append('--exclude-module=%s' % x ) + + for x in add_data: + run_generic.append('--add-data=%s' % x.replace(';',':') ) + + PyInstaller.__main__.run(run_generic) diff --git a/setup.py b/setup.py index 7d6a6a2..aa00a14 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,6 @@ build_exe_options = { "includes": [""], ## "includes": ["PyQt5.QtCore", ## "PyQt5.QtGui", -## "PyQt5.QtMultimedia", ## "PyQt5.QtWidgets", ## "pygame", ## "feedparser", diff --git a/version.py b/version.py index 35a5b45..4202432 100644 --- a/version.py +++ b/version.py @@ -1,2 +1,2 @@ -_pcVersion = "Alt. v2.1.2" -buildVersion = "v2.1.2" +_pcVersion = "Alt. v2.1.3" +buildVersion = "v2.1.3"