Compare commits

...

8 Commits

5 changed files with 151 additions and 52 deletions
+134 -41
View File
@@ -15,7 +15,7 @@ permissions:
contents: write
env:
PYTHON_VERSION: "3.11"
PYTHON_VERSION: "3.12"
APP_NAME: "SoftwareManager"
jobs:
@@ -57,7 +57,7 @@ jobs:
- name: Install Python dependencies
run: |
uv pip install -r requirements.txt
uv pip install pyinstaller backports.tarfile pillow
uv pip install nuitka
env:
UV_SYSTEM_PYTHON: 1
@@ -82,56 +82,136 @@ jobs:
}
EOF
- name: Build executable with PyInstaller (Windows)
- name: Install UPX
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
curl -sL https://github.com/upx/upx/releases/download/v5.1.0/upx-5.1.0-win64.zip -o upx.zip
7z x upx.zip -oupx-dir
UPX_DIR="$(pwd)/upx-dir/upx-5.1.0-win64"
echo "$UPX_DIR" >> $GITHUB_PATH
export PATH="$UPX_DIR:$PATH"
echo "UPX_BINARY=$UPX_DIR/upx.exe" >> $GITHUB_ENV
elif [ "$RUNNER_OS" == "Linux" ]; then
curl -sL https://github.com/upx/upx/releases/download/v5.1.0/upx-5.1.0-amd64_linux.tar.xz -o upx.tar.xz
tar xf upx.tar.xz
UPX_DIR="$(pwd)/upx-5.1.0-amd64_linux"
echo "$UPX_DIR" >> $GITHUB_PATH
export PATH="$UPX_DIR:$PATH"
echo "UPX_BINARY=$UPX_DIR/upx" >> $GITHUB_ENV
else
brew install upx
echo "UPX_BINARY=$(which upx)" >> $GITHUB_ENV
fi
upx --version | head -1
- name: Build with Nuitka (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
pyinstaller --onefile --windowed \
--add-data "build_info.json;." \
--add-data "build_info.json;core" \
--add-data "build_info.json;core/interface" \
--add-data "core/interface/assets;core/interface/assets" \
--icon "core/interface/assets/logo.png" \
--exclude-module PyQt6 \
--exclude-module PyQt5 \
--hidden-import=backports.tarfile \
--hidden-import=backports \
--hidden-import=jaraco.context \
--hidden-import=jaraco.text \
--hidden-import=jaraco.functools \
--name ${{ env.APP_NAME }} \
python -m nuitka \
--onefile \
--onefile-no-compression \
--onefile-tempdir-spec="{CACHE_DIR}/${{ env.APP_NAME }}/${{ env.VERSION }}" \
--assume-yes-for-downloads \
--windows-console-mode=disable \
--enable-plugin=pyside6 \
--enable-plugin=upx \
--upx-binary="${{ env.UPX_BINARY }}" \
--noinclude-qt-translations \
--noinclude-dlls='Qt6WebEngine*' \
--noinclude-dlls='Qt6Multimedia*' \
--noinclude-dlls='Qt6Quick*' \
--noinclude-dlls='Qt6Qml*' \
--noinclude-dlls='Qt6Designer*' \
--noinclude-dlls='Qt63D*' \
--noinclude-dlls='Qt6Bluetooth*' \
--noinclude-dlls='Qt6Nfc*' \
--noinclude-dlls='Qt6Sensors*' \
--noinclude-dlls='Qt6Serial*' \
--noinclude-dlls='Qt6Test*' \
--noinclude-dlls='Qt6Location*' \
--noinclude-dlls='Qt6Pdf*' \
--include-data-dir=core/interface/assets=core/interface/assets \
--include-data-files=build_info.json=build_info.json \
--include-data-files=build_info.json=core/build_info.json \
--include-data-files=build_info.json=core/interface/build_info.json \
--output-filename=${{ env.APP_NAME }}.exe \
main.py
- name: Build executable with PyInstaller (Unix)
if: runner.os != 'Windows'
- name: Build with Nuitka (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
pyinstaller --onefile --windowed \
--add-data "build_info.json:." \
--add-data "build_info.json:core" \
--add-data "build_info.json:core/interface" \
--add-data "core/interface/assets:core/interface/assets" \
--icon "core/interface/assets/logo.png" \
--exclude-module PyQt6 \
--exclude-module PyQt5 \
--hidden-import=backports.tarfile \
--hidden-import=backports \
--hidden-import=jaraco.context \
--hidden-import=jaraco.text \
--hidden-import=jaraco.functools \
--name ${{ env.APP_NAME }} \
python -m nuitka \
--onefile \
--onefile-tempdir-spec="{CACHE_DIR}/${{ env.APP_NAME }}/${{ env.VERSION }}" \
--assume-yes-for-downloads \
--enable-plugin=pyside6 \
--enable-plugin=upx \
--upx-binary="${{ env.UPX_BINARY }}" \
--noinclude-qt-translations \
--noinclude-dlls='libQt6WebEngine*' \
--noinclude-dlls='libQt6Multimedia*' \
--noinclude-dlls='libQt6Quick*' \
--noinclude-dlls='libQt6Qml*' \
--noinclude-dlls='libQt6Designer*' \
--noinclude-dlls='libQt63D*' \
--noinclude-dlls='libQt6Bluetooth*' \
--noinclude-dlls='libQt6Nfc*' \
--noinclude-dlls='libQt6Sensors*' \
--noinclude-dlls='libQt6Serial*' \
--noinclude-dlls='libQt6Test*' \
--noinclude-dlls='libQt6Location*' \
--noinclude-dlls='libQt6Pdf*' \
--include-data-dir=core/interface/assets=core/interface/assets \
--include-data-files=build_info.json=build_info.json \
--include-data-files=build_info.json=core/build_info.json \
--include-data-files=build_info.json=core/interface/build_info.json \
--output-filename=${{ env.APP_NAME }} \
main.py
- name: Make executable (Unix)
if: runner.os != 'Windows'
run: chmod +x dist/${{ env.APP_NAME }}
- name: Rename artifact
- name: Build with Nuitka (macOS)
if: runner.os == 'macOS'
shell: bash
run: |
cd dist
mv ${{ env.APP_NAME }}${{ runner.os == 'Windows' && '.exe' || '' }} ${{ matrix.artifact_name }}
ls -la
python -m nuitka \
--onefile \
--onefile-tempdir-spec="{CACHE_DIR}/${{ env.APP_NAME }}/${{ env.VERSION }}" \
--assume-yes-for-downloads \
--enable-plugin=pyside6 \
--noinclude-qt-translations \
--noinclude-dlls='libQt6WebEngine*' \
--noinclude-dlls='libQt6Multimedia*' \
--noinclude-dlls='libQt6Quick*' \
--noinclude-dlls='libQt6Qml*' \
--noinclude-dlls='libQt6Designer*' \
--noinclude-dlls='libQt63D*' \
--noinclude-dlls='libQt6Bluetooth*' \
--noinclude-dlls='libQt6Nfc*' \
--noinclude-dlls='libQt6Sensors*' \
--noinclude-dlls='libQt6Serial*' \
--noinclude-dlls='libQt6Test*' \
--noinclude-dlls='libQt6Location*' \
--noinclude-dlls='libQt6Pdf*' \
--include-data-dir=core/interface/assets=core/interface/assets \
--include-data-files=build_info.json=build_info.json \
--include-data-files=build_info.json=core/build_info.json \
--include-data-files=build_info.json=core/interface/build_info.json \
--output-filename=${{ env.APP_NAME }} \
main.py
- name: Prepare artifact
shell: bash
run: |
mkdir -p dist
if [ "$RUNNER_OS" == "Windows" ]; then
mv ${{ env.APP_NAME }}.exe dist/${{ matrix.artifact_name }}
else
mv ${{ env.APP_NAME }} dist/${{ matrix.artifact_name }}
chmod +x dist/${{ matrix.artifact_name }}
fi
ls -la dist/
- name: Upload build artifact
uses: actions/upload-artifact@v4
@@ -162,9 +242,16 @@ jobs:
chmod +x release/SoftwareManager-dev-*-linux release/SoftwareManager-dev-*-macos
ls -la release/
- name: Generate checksums
run: |
cd release
sha256sum * > SHA256SUMS.txt
cat SHA256SUMS.txt
- name: Generate release notes
run: |
SHORT_SHA="${{ needs.build.outputs.short_sha }}"
CHECKSUMS=$(cat release/SHA256SUMS.txt)
cat > release_notes.md << EOF
## Development Build
@@ -177,6 +264,11 @@ jobs:
- Linux: \`SoftwareManager-dev-${SHORT_SHA}-linux\`
- Windows: \`SoftwareManager-dev-${SHORT_SHA}-windows.exe\`
- macOS: \`SoftwareManager-dev-${SHORT_SHA}-macos\`
### SHA-256 Checksums
\`\`\`
${CHECKSUMS}
\`\`\`
EOF
cat release_notes.md
@@ -190,5 +282,6 @@ jobs:
release/SoftwareManager-dev-${{ needs.build.outputs.short_sha }}-linux
release/SoftwareManager-dev-${{ needs.build.outputs.short_sha }}-windows.exe
release/SoftwareManager-dev-${{ needs.build.outputs.short_sha }}-macos
release/SHA256SUMS.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+7 -6
View File
@@ -73,15 +73,16 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
self.log_signal.connect(self._on_log_signal)
def get_asset_path(filename):
if getattr(sys, 'frozen', False):
base_path = sys._MEIPASS
else:
base_path = os.path.dirname(__file__)
asset_path = os.path.join(base_path, 'core', 'interface', 'assets', filename)
base_path = os.path.dirname(os.path.abspath(__file__))
asset_path = os.path.join(base_path, 'assets', filename)
if os.path.exists(asset_path):
return asset_path
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
asset_path = os.path.join(sys._MEIPASS, 'core', 'interface', 'assets', filename)
if os.path.exists(asset_path):
return asset_path
return os.path.join('core', 'interface', 'assets', filename)
self.setWindowIcon(QIcon(get_asset_path("logo.png")))
+3 -3
View File
@@ -36,7 +36,7 @@ def init_session():
settings["listen_interfaces"] = f"{interface_ip}:6881"
consoleLog(f"Binding to Interface IP: {interface_ip}")
else:
consoleLog(f"Error finding IP for Interface {state.bound_interface}")
consoleLog(f"Skipping Binding, no Interface set. ({state.bound_interface})")
state.dl_session.apply_settings(settings)
@@ -51,7 +51,7 @@ def add_download(magnet_uri, dl_path=state.download_path):
init_session()
if magnet_uri in state.active_downloads:
consoleLog("Skipping, download already running...")
consoleLog("Skipping Downloading, download already running...")
return
magnetdl = lt.parse_magnet_uri(magnet_uri)
@@ -114,7 +114,7 @@ def update_settings():
settings["listen_interfaces"] = f"{interface_ip}:6881"
consoleLog(f"Binding to Interface IP: {interface_ip}")
else:
consoleLog(f"Error finding IP for Interface {state.bound_interface}")
consoleLog(f"Skipping Binding, no Interface set. ({state.bound_interface})")
state.dl_session.apply_settings(settings)
+6 -1
View File
@@ -24,7 +24,12 @@ def add_download_log(title, url, magnet_uri, completed) -> DownloadList:
if any(d.magnet_uri == magnet_uri or d.url == url for d in downloads):
consoleLog("Skipped Logging, download already in file")
if magnet_uri in state.active_downloads:
consoleLog("Skipping Logging, download already running...")
return
consoleLog("File already in Log, updating Download State...")
hash = extract_hash_from_magnet(magnet_uri)
update_download_completed_by_hash(hash, False)
return DownloadList(data=downloads, count=len(downloads)) # thanks again claude (im stupid)
+1 -1
View File
@@ -1,5 +1,5 @@
requests==2.32.2
PySide6==6.10.1
PySide6-Essentials==6.10.1
beautifulsoup4==4.13.5
darkdetect==0.7.1
pyinstaller==6.15.0