Merge pull request #243 from loathingKernel/fixups
Enable console output on windows if it is a test build
This commit is contained in:
commit
212f8b8f7b
84
.github/workflows/release-tests.yml
vendored
84
.github/workflows/release-tests.yml
vendored
|
@ -5,7 +5,6 @@ name: "Release Tests"
|
|||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
|
||||
jobs:
|
||||
deb-package:
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -29,7 +28,7 @@ jobs:
|
|||
mv *.deb Rare.deb
|
||||
|
||||
- name: Upload to Artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Rare.deb
|
||||
path: build/Rare.deb
|
||||
|
@ -64,86 +63,109 @@ jobs:
|
|||
nuitka:
|
||||
runs-on: "windows-latest"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions/setup-python@v2
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.9'
|
||||
architecture: x64
|
||||
- name: Install build dependencies
|
||||
run: pip3 install nuitka ordered-set
|
||||
- name: Install target dependencies
|
||||
run: |
|
||||
pip3 install -r requirements.txt
|
||||
pip3 install -r requirements-presence.txt
|
||||
- name: Version
|
||||
- name: Versions
|
||||
id: version
|
||||
shell: bash
|
||||
run: |
|
||||
git fetch --prune --unshallow
|
||||
echo "::set-output name=tag_offset::$(git describe --long --tags)"
|
||||
tag_abbrev=$(git describe --tags --abbrev=0)
|
||||
echo "::set-output name=tag_abbrev::${tag_abbrev%%-rc*}"
|
||||
echo "::set-output name=tag_offset::$(git rev-list $tag_abbrev..HEAD --count)"
|
||||
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
||||
echo "::set-output name=full_desc::$(git describe --long --tags)"
|
||||
- name: Build
|
||||
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
|
||||
--msvc=latest
|
||||
--lto=yes
|
||||
--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
|
||||
--windows-disable-console
|
||||
--windows-company-name=Rare
|
||||
--windows-product-name=Rare
|
||||
--windows-file-description=rare.exe
|
||||
--windows-file-version=${{ steps.version.outputs.tag_abbrev }}.${{ steps.version.outputs.tag_offset }}
|
||||
--windows-product-version=${{ steps.version.outputs.tag_abbrev }}.${{ steps.version.outputs.tag_offset }}
|
||||
--enable-console
|
||||
rare
|
||||
|
||||
- name: Upload to Artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Rare-Windows-${{ steps.version.outputs.tag_offset }}
|
||||
name: Rare-Windows-${{ steps.version.outputs.tag_abbrev }}.${{ steps.version.outputs.tag_offset }}
|
||||
path: rare.dist
|
||||
|
||||
cx_freeze:
|
||||
runs-on: "windows-latest"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions/setup-python@v2
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.9'
|
||||
architecture: x64
|
||||
- name: Install Build Dependencies
|
||||
run: pip3 install --upgrade cx_freeze wheel
|
||||
- name: Install Target Dependencies
|
||||
run: |
|
||||
pip3 install -r requirements.txt
|
||||
pip3 install -r requirements-presence.txt
|
||||
- name: Version
|
||||
- name: Versions
|
||||
id: version
|
||||
shell: bash
|
||||
run: |
|
||||
git fetch --prune --unshallow
|
||||
echo "::set-output name=tag_offset::$(git describe --long --tags)"
|
||||
tag_abbrev=$(git describe --tags --abbrev=0)
|
||||
echo "::set-output name=tag_abbrev::${tag_abbrev%%-rc*}"
|
||||
echo "::set-output name=tag_offset::$(git rev-list $tag_abbrev..HEAD --count)"
|
||||
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
||||
echo "::set-output name=full_desc::$(git describe --long --tags)"
|
||||
- name: Build
|
||||
run: |
|
||||
python freeze.py bdist_msi
|
||||
mv dist/*.msi dist/Rare-Windows.msi
|
||||
|
||||
- name: Upload to Artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Rare-Windows-${{ steps.version.outputs.tag_offset }}.msi
|
||||
name: Rare-Windows-${{ steps.version.outputs.tag_abbrev }}.${{ steps.version.outputs.tag_offset }}.msi
|
||||
path: dist/*.msi
|
||||
|
||||
mac_os:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- uses: actions/setup-python@v2
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.9'
|
||||
|
||||
|
@ -160,15 +182,17 @@ jobs:
|
|||
pyinstaller -F --name Rare
|
||||
--add-data "rare/resources/languages/*:rare/resources/languages"
|
||||
--add-data "rare/resources/images/*:rare/resources/images/"
|
||||
--windowed --icon rare/resources/images/Rare.icns
|
||||
--hidden-import=legendary __main__.py
|
||||
--windowed
|
||||
--icon rare/resources/images/Rare.icns
|
||||
--hidden-import=legendary
|
||||
__main__.py
|
||||
|
||||
- name: create dmg
|
||||
run: |
|
||||
git clone https://github.com/create-dmg/create-dmg
|
||||
create-dmg/create-dmg Rare-${{github.ref}}.dmg dist/Rare.App --volname Rare --volicon rare/resources/images/Rare.icns
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Rare-MacOS.dmg
|
||||
path: ./*.dmg
|
||||
|
|
55
.github/workflows/release.yml
vendored
55
.github/workflows/release.yml
vendored
|
@ -12,13 +12,13 @@ jobs:
|
|||
if: "!github.event.release.prerelease"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.8'
|
||||
python-version: '3.9'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
|
@ -102,12 +102,13 @@ jobs:
|
|||
nuitka:
|
||||
runs-on: "windows-latest"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions/setup-python@v2
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.9'
|
||||
architecture: x64
|
||||
- name: Install build dependencies
|
||||
run: pip3 install nuitka ordered-set
|
||||
- name: Install target dependencies
|
||||
|
@ -118,16 +119,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
|
||||
--msvc=latest
|
||||
--lto=yes
|
||||
--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: |
|
||||
|
@ -145,12 +161,13 @@ jobs:
|
|||
cx_freeze:
|
||||
runs-on: "windows-latest"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions/setup-python@v2
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.9'
|
||||
architecture: x64
|
||||
- name: Install Build Dependencies
|
||||
run: pip3 install --upgrade cx_freeze wheel
|
||||
- name: Install Target Dependencies
|
||||
|
@ -174,11 +191,11 @@ jobs:
|
|||
mac_os:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- uses: actions/setup-python@v2
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.9'
|
||||
|
||||
|
@ -195,8 +212,10 @@ jobs:
|
|||
pyinstaller -F --name Rare
|
||||
--add-data "rare/resources/languages/*:rare/resources/languages"
|
||||
--add-data "rare/resources/images/*:rare/resources/images/"
|
||||
--windowed --icon rare/resources/images/Rare.icns
|
||||
--hidden-import=legendary __main__.py
|
||||
--windowed
|
||||
--icon rare/resources/images/Rare.icns
|
||||
--hidden-import=legendary
|
||||
__main__.py
|
||||
|
||||
- name: create dmg
|
||||
run: |
|
||||
|
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -10,9 +10,7 @@ __pycache__
|
|||
/deb_dist
|
||||
*.tar.gz
|
||||
/Rare.egg-info/
|
||||
/venv
|
||||
/venv310/
|
||||
/venv311/
|
||||
/venv*
|
||||
/test.py
|
||||
/.eggs
|
||||
/appimage-builder-cache/
|
||||
|
|
33
misc/nuitka_build.bat
Normal file
33
misc/nuitka_build.bat
Normal file
|
@ -0,0 +1,33 @@
|
|||
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" ^
|
||||
--nofollow-import-to="distutils" ^
|
||||
--nofollow-import-to="unittest" ^
|
||||
--nofollow-import-to="pydoc" ^
|
||||
--nofollow-import-to="tkinter" ^
|
||||
--nofollow-import-to="test" ^
|
||||
--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
|
33
misc/nuitka_build.sh
Normal file
33
misc/nuitka_build.sh
Normal file
|
@ -0,0 +1,33 @@
|
|||
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" \
|
||||
--nofollow-import-to="distutils" \
|
||||
--nofollow-import-to="unittest" \
|
||||
--nofollow-import-to="pydoc" \
|
||||
--nofollow-import-to="tkinter" \
|
||||
--nofollow-import-to="test" \
|
||||
--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
|
|
@ -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
|
|
@ -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()
|
||||
|
|
|
@ -143,18 +143,28 @@ class RareSettings(QWidget, Ui_RareSettings):
|
|||
self.log_dir_clean_button.clicked.connect(self.clean_logdir)
|
||||
|
||||
# get size of logdir
|
||||
size = 0
|
||||
for i in os.listdir(log_dir()):
|
||||
size += os.path.getsize(os.path.join(log_dir(), i))
|
||||
|
||||
size = sum(
|
||||
log_dir().joinpath(f).stat().st_size
|
||||
for f in log_dir().iterdir()
|
||||
if log_dir().joinpath(f).is_file()
|
||||
)
|
||||
self.log_dir_size_label.setText(get_size(size))
|
||||
# self.log_dir_clean_button.setVisible(False)
|
||||
# self.log_dir_size_label.setVisible(False)
|
||||
|
||||
def clean_logdir(self):
|
||||
for i in os.listdir(log_dir()):
|
||||
os.remove(os.path.join(log_dir(), f"{i}"))
|
||||
self.log_dir_size_label.setText("0KB")
|
||||
for f in log_dir().iterdir():
|
||||
try:
|
||||
if log_dir().joinpath(f).is_file():
|
||||
log_dir().joinpath(f).unlink()
|
||||
except PermissionError as e:
|
||||
logger.error(e)
|
||||
size = sum(
|
||||
log_dir().joinpath(f).stat().st_size
|
||||
for f in log_dir().iterdir()
|
||||
if log_dir().joinpath(f).is_file()
|
||||
)
|
||||
self.log_dir_size_label.setText(get_size(size))
|
||||
|
||||
def create_start_menu_link(self):
|
||||
try:
|
||||
|
|
|
@ -30,7 +30,7 @@ class LegendaryCLI(LegendaryCLIReal):
|
|||
# noinspection PyMissingConstructor
|
||||
def __init__(self, core: LegendaryCore):
|
||||
self.core = core
|
||||
self.logger = logging.getLogger('Api')
|
||||
self.logger = logging.getLogger('Cli')
|
||||
self.logging_queue = None
|
||||
self.ql = self.setup_threaded_logging()
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
Loading…
Reference in a new issue