Rare: Update scripts to use the new entry point
This commit is contained in:
parent
bdbb61d3a6
commit
ff2b9f2605
9
.github/workflows/release-tests.yml
vendored
9
.github/workflows/release-tests.yml
vendored
|
@ -31,7 +31,7 @@ jobs:
|
|||
|
||||
deb-package:
|
||||
needs: version
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Install Makedeb
|
||||
run: |
|
||||
|
@ -41,9 +41,9 @@ jobs:
|
|||
sudo apt install makedeb
|
||||
- name: Prepare source directory
|
||||
run: |
|
||||
git clone https://mpr.hunterwittenborn.com/rare.git build
|
||||
git clone https://mpr.makedeb.org/rare build
|
||||
sed -i 's/source=.*/source=("rare-test::git+$url")/g' build/PKGBUILD
|
||||
sed -i "s/\$pkgver/test/g" build/PKGBUILD
|
||||
sed -i "s/\$pkgver/${{ needs.version.outputs.tag_abbrev }}.${{ needs.version.outputs.tag_offset }}/g" build/PKGBUILD
|
||||
|
||||
- name: build deb
|
||||
run: |
|
||||
|
@ -73,7 +73,6 @@ jobs:
|
|||
sudo pip3 install appimage-builder
|
||||
- name: Build
|
||||
run: |
|
||||
cp rare/__main__.py .
|
||||
appimage-builder --skip-test
|
||||
mv Rare-*.AppImage Rare.AppImage
|
||||
mv Rare-*.AppImage.zsync Rare.AppImage.zsync
|
||||
|
@ -198,7 +197,7 @@ jobs:
|
|||
pip3 install -r requirements-presence.txt
|
||||
pip3 install .
|
||||
- name: Build
|
||||
run: cxfreeze -c rare/__main__.py --target-dir dist --target-name rare --icon rare/resources/images/Rare.ico -OO --base-name Win32GUI
|
||||
run: cxfreeze -c rare/main.py --target-dir dist --target-name rare --icon rare/resources/images/Rare.ico -OO --base-name Win32GUI
|
||||
- name: Compress
|
||||
run: |
|
||||
python -c "import shutil; shutil.make_archive('Rare-Windows', 'zip', 'dist')"
|
||||
|
|
5
.github/workflows/release.yml
vendored
5
.github/workflows/release.yml
vendored
|
@ -35,7 +35,7 @@ jobs:
|
|||
twine upload dist/*
|
||||
|
||||
deb-package:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Install Makedeb
|
||||
run: |
|
||||
|
@ -78,7 +78,6 @@ jobs:
|
|||
sudo pip3 install appimage-builder
|
||||
- name: Build
|
||||
run: |
|
||||
cp rare/__main__.py .
|
||||
appimage-builder --skip-test
|
||||
mv Rare-*.AppImage Rare.AppImage
|
||||
mv Rare-*.AppImage.zsync Rare.AppImage.zsync
|
||||
|
@ -212,7 +211,7 @@ jobs:
|
|||
pip3 install -r requirements-presence.txt
|
||||
pip3 install .
|
||||
- name: Build
|
||||
run: cxfreeze -c rare/__main__.py --target-dir dist --target-name rare --icon rare/resources/images/Rare.ico -OO --base-name Win32GUI
|
||||
run: cxfreeze -c rare/main.py --target-dir dist --target-name rare --icon rare/resources/images/Rare.ico -OO --base-name Win32GUI
|
||||
- name: Compress
|
||||
run: |
|
||||
python -c "import shutil; shutil.make_archive('Rare-Windows', 'zip', 'dist')"
|
||||
|
|
|
@ -3,13 +3,12 @@ version: 1
|
|||
|
||||
script:
|
||||
# Remove any previous build
|
||||
- rm -rf AppDir Rare | true
|
||||
- rm -rf AppDir | true
|
||||
# Make usr and icons dirs
|
||||
- mkdir -p AppDir/usr/src
|
||||
- mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps/
|
||||
# Copy source files
|
||||
- cp -r rare AppDir/usr/src/rare
|
||||
- mv AppDir/usr/src/rare/__main__.py AppDir/usr/src/
|
||||
# copy Logo
|
||||
- cp AppDir/usr/src/rare/resources/images/Rare.png AppDir/usr/share/icons/hicolor/256x256/apps/
|
||||
# Install application dependencies
|
||||
|
@ -23,7 +22,7 @@ AppDir:
|
|||
icon: Rare
|
||||
version: 1.10.7
|
||||
exec: usr/bin/python3
|
||||
exec_args: $APPDIR/usr/src/__main__.py $@
|
||||
exec_args: $APPDIR/usr/src/rare/main.py $@
|
||||
apt:
|
||||
arch: amd64
|
||||
allow_unauthenticated: true
|
||||
|
|
|
@ -31,9 +31,11 @@ bdist_msi_options = {
|
|||
base = "Win32GUI"
|
||||
|
||||
exe = Executable(
|
||||
"rare/__main__.py",
|
||||
base=base, icon="rare/resources/images/Rare.ico",
|
||||
target_name="Rare")
|
||||
"rare/main.py",
|
||||
base=base,
|
||||
icon="rare/resources/images/Rare.ico",
|
||||
target_name=name
|
||||
)
|
||||
|
||||
setup(
|
||||
name=name,
|
||||
|
|
|
@ -35,7 +35,7 @@ legendary-gl = "^0.20.34"
|
|||
typing-extensions = "^4.3.0"
|
||||
|
||||
[tool.poetry.scripts]
|
||||
start = "rare.__main__:main"
|
||||
start = "rare.main:main"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
Nuitka = "^1.0.6"
|
||||
|
|
|
@ -4,7 +4,5 @@ __codename__ = "Garlic Crab"
|
|||
# For PyCharm profiler
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
from argparse import Namespace
|
||||
from rare import client
|
||||
status = client.start(Namespace(debug=True, silent=False, offline=False, test_start=False))
|
||||
sys.exit(status)
|
||||
from rare.main import main
|
||||
sys.exit(main())
|
||||
|
|
27
rare/__main__.py
Executable file → Normal file
27
rare/__main__.py
Executable file → Normal file
|
@ -1,29 +1,4 @@
|
|||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
from rare.main import main
|
||||
|
||||
# run from source
|
||||
# insert raw legendary submodule
|
||||
# sys.path.insert(
|
||||
# 0, os.path.join(pathlib.Path(__file__).parent.absolute(), "legendary")
|
||||
# )
|
||||
|
||||
# insert source directory
|
||||
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
|
||||
# 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())):
|
||||
# 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')
|
||||
|
||||
sys.exit(main())
|
||||
|
|
28
rare/main.py
Normal file → Executable file
28
rare/main.py
Normal file → Executable file
|
@ -1,9 +1,22 @@
|
|||
import multiprocessing
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
from argparse import ArgumentParser
|
||||
|
||||
|
||||
def main() -> int:
|
||||
# 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())):
|
||||
# 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')
|
||||
|
||||
# fix cx_freeze
|
||||
multiprocessing.freeze_support()
|
||||
|
||||
|
@ -101,3 +114,18 @@ def main() -> int:
|
|||
|
||||
from rare.components import start
|
||||
return start(args)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# run from source
|
||||
# insert raw legendary submodule
|
||||
# sys.path.insert(
|
||||
# 0, os.path.join(pathlib.Path(__file__).parent.absolute(), "legendary")
|
||||
# )
|
||||
|
||||
# insert source directory if running `main.py` as python script
|
||||
# Required by AppImage
|
||||
if "__compiled__" not in globals():
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).parents[1].absolute()))
|
||||
|
||||
sys.exit(main())
|
||||
|
|
|
@ -142,7 +142,7 @@ def get_rare_executable() -> List[str]:
|
|||
if sys.executable == os.path.abspath(sys.argv[0]):
|
||||
executable = [sys.executable]
|
||||
else:
|
||||
executable = [sys.executable, os.path.abspath(sys.argv[0])]
|
||||
executable = [os.path.abspath(sys.argv[0])]
|
||||
elif platform.system() == "Windows":
|
||||
executable = [sys.executable]
|
||||
|
||||
|
|
Loading…
Reference in a new issue