Build: enable console output on windows if it is a test build

This commit is contained in:
Stelios Tsampas 2022-09-12 14:19:24 +03:00 committed by loathingKernel
parent e45f392652
commit 9d28680804
7 changed files with 79 additions and 15 deletions

View File

@ -86,16 +86,31 @@ jobs:
run: >-
python -m nuitka
--assume-yes-for-downloads
--follow-imports --prefer-source-code --mingw64 --lto=no --jobs=2 --static-libpython=no --standalone
--enable-plugin=anti-bloat --enable-plugin=pyqt5 --show-anti-bloat-changes --nofollow-import-to="*.tests"
--nofollow-import-to="*.distutils" --include-package-data=qtawesome
--mingw64
--lto=no
--jobs=2
--static-libpython=no
--standalone
--enable-plugin=anti-bloat
--enable-plugin=pyqt5
--show-modules
--show-anti-bloat-changes
--follow-stdlib
--follow-imports
--nofollow-import-to="*.tests"
--nofollow-import-to="*.distutils"
--prefer-source-code
--include-package=pypresence
--include-package-data=qtawesome
--include-data-dir=rare\resources\images=rare\resources\images
--include-data-files=rare\resources\languages=rare\resources\languages="*.qm"
--windows-icon-from-ico=rare\resources\images\Rare.ico
--windows-company-name=Rare --windows-product-name=Rare --windows-file-description=rare.exe
--windows-company-name=Rare
--windows-product-name=Rare
--windows-file-description=rare.exe
--windows-file-version=0.0.0.0
--windows-product-version=0.0.0.0
--windows-disable-console
--enable-console
rare
- name: Upload to Artifacts

View File

@ -118,16 +118,31 @@ jobs:
run: >-
python -m nuitka
--assume-yes-for-downloads
--follow-imports --prefer-source-code --mingw64 --lto=no --jobs=2 --static-libpython=no --standalone
--enable-plugin=anti-bloat --enable-plugin=pyqt5 --show-anti-bloat-changes --nofollow-import-to="*.tests"
--nofollow-import-to="*.distutils" --include-package-data=qtawesome
--mingw64
--lto=no
--jobs=2
--static-libpython=no
--standalone
--enable-plugin=anti-bloat
--enable-plugin=pyqt5
--show-modules
--show-anti-bloat-changes
--follow-stdlib
--follow-imports
--nofollow-import-to="*.tests"
--nofollow-import-to="*.distutils"
--prefer-source-code
--include-package=pypresence
--include-package-data=qtawesome
--include-data-dir=rare\resources\images=rare\resources\images
--include-data-files=rare\resources\languages=rare\resources\languages="*.qm"
--windows-icon-from-ico=rare\resources\images\Rare.ico
--windows-company-name=Rare --windows-product-name=Rare --windows-file-description=rare.exe
--windows-company-name=Rare
--windows-product-name=Rare
--windows-file-description=rare.exe
--windows-file-version=${{ github.event.release.tag_name }}
--windows-product-version=${{ github.event.release.tag_name }}
--windows-disable-console
--disable-console
rare
- name: Compress
run: |

28
misc/nuitka_build.bat Normal file
View File

@ -0,0 +1,28 @@
python -m nuitka ^
--assume-yes-for-downloads ^
--mingw64 ^
--lto=no ^
--jobs=2 ^
--static-libpython=no ^
--standalone ^
--enable-plugin=anti-bloat ^
--enable-plugin=pyqt5 ^
--show-modules ^
--show-anti-bloat-changes ^
--follow-stdlib ^
--follow-imports ^
--nofollow-import-to="*.tests" ^
--nofollow-import-to="*.distutils" ^
--prefer-source-code ^
--include-package=pypresence ^
--include-package-data=qtawesome ^
--include-data-dir=rare\resources\images=rare\resources\images ^
--include-data-files=rare\resources\languages=rare\resources\languages="*.qm" ^
--windows-icon-from-ico=rare\resources\images\Rare.ico ^
--windows-company-name=Rare ^
--windows-product-name=Rare ^
--windows-file-description=rare.exe ^
--windows-file-version=0.0.0.0 ^
--windows-product-version=0.0.0.0 ^
--enable-console ^
rare

View File

@ -1 +0,0 @@
python -m nuitka --assume-yes-for-downloads --follow-imports --prefer-source-code --mingw64 --lto=no --jobs=2 --static-libpython=no --standalone --enable-plugin=anti-bloat --enable-plugin=pyqt5 --show-anti-bloat-changes --nofollow-import-to="*.tests" --nofollow-import-to="*.distutils" --include-package-data=qtawesome --include-data-dir=rare\resources\images=rare\resources\images --include-data-files=rare\resources\languages=rare\resources\languages="*.qm" --windows-icon-from-ico=rare\resources\images\Rare.ico --windows-company-name=Rare --windows-product-name=Rare --windows-file-description=rare.exe --windows-file-version=1.9.0 --windows-product-version=1.9.0 --windows-disable-console rare

View File

@ -117,12 +117,15 @@ if __name__ == "__main__":
if "__compiled__" not in globals():
sys.path.insert(0, str(pathlib.Path(__file__).parents[1].absolute()))
# If we are on Windows, and we are in a "compiled" GUI application form
# If we are on Windows, and we are in a "compiled" GUI application form
# stdout (and stderr?) will be None. So to avoid `'NoneType' object has no attribute 'write'`
# errors, redirect both of them to devnull
if os.name == "nt" and (getattr(sys, "frozen", False) or ("__compiled__" in globals())):
f = open(os.devnull, 'w')
sys.stdout = f
sys.stderr = f
# Check if stdout and stderr are None before redirecting
# This is useful in the case of test builds that enable console
if sys.stdout is None:
sys.stdout = open(os.devnull, 'w')
if sys.stderr is None:
sys.stderr = open(os.devnull, 'w')
main()

View File

@ -6,5 +6,7 @@ setuptools
legendary-gl
pywin32; platform_system == "Windows"
pywebview[qt]; platform_system == "Linux"
pythonnet>=3.0.0rc4; platform_system == "Windows"
cefpython3; platform_system == "Windows"
pywebview[cef]; platform_system == "Windows"
pypresence

View File

@ -1,3 +1,5 @@
pywebview[qt]; platform_system == "Linux"
pythonnet>=3.0.0rc4; platform_system == "Windows"
cefpython3; platform_system == "Windows"
pywebview[cef]; platform_system == "Windows"