Compare commits

..

5 Commits

3 changed files with 68 additions and 112 deletions
+42 -84
View File
@@ -57,13 +57,7 @@ jobs:
- name: Install Python dependencies - name: Install Python dependencies
run: | run: |
uv pip install -r requirements.txt uv pip install -r requirements.txt
uv pip install Pillow uv pip install nuitka
env:
UV_SYSTEM_PYTHON: 1
- name: Install Nuitka (Windows only)
if: runner.os == 'Windows'
run: uv pip install nuitka
env: env:
UV_SYSTEM_PYTHON: 1 UV_SYSTEM_PYTHON: 1
@@ -88,29 +82,29 @@ jobs:
} }
EOF EOF
- name: Install UPX (Windows) - name: Install UPX
if: runner.os == 'Windows'
shell: bash shell: bash
run: | run: |
curl -sL https://github.com/upx/upx/releases/download/v5.1.0/upx-5.1.0-win64.zip -o upx.zip if [ "$RUNNER_OS" == "Windows" ]; then
7z x upx.zip -oupx-dir curl -sL https://github.com/upx/upx/releases/download/v5.1.0/upx-5.1.0-win64.zip -o upx.zip
UPX_DIR="$(pwd)/upx-dir/upx-5.1.0-win64" 7z x upx.zip -oupx-dir
echo "$UPX_DIR" >> $GITHUB_PATH UPX_DIR="$(pwd)/upx-dir/upx-5.1.0-win64"
export PATH="$UPX_DIR:$PATH" echo "$UPX_DIR" >> $GITHUB_PATH
echo "UPX_BINARY=$UPX_DIR/upx.exe" >> $GITHUB_ENV 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 upx --version | head -1
- name: Convert icon for Windows
if: runner.os == 'Windows'
shell: bash
run: |
python -c "
from PIL import Image
img = Image.open('core/interface/assets/logo.png')
img.save('app_icon.ico', format='ICO', sizes=[(256,256),(128,128),(64,64),(48,48),(32,32),(16,16)])
print('Icon converted successfully')
"
- name: Build with Nuitka (Windows) - name: Build with Nuitka (Windows)
if: runner.os == 'Windows' if: runner.os == 'Windows'
shell: bash shell: bash
@@ -121,11 +115,9 @@ jobs:
--onefile-tempdir-spec="{CACHE_DIR}/${{ env.APP_NAME }}/${{ env.VERSION }}" \ --onefile-tempdir-spec="{CACHE_DIR}/${{ env.APP_NAME }}/${{ env.VERSION }}" \
--assume-yes-for-downloads \ --assume-yes-for-downloads \
--windows-console-mode=disable \ --windows-console-mode=disable \
--windows-icon-from-ico=app_icon.ico \
--enable-plugin=pyside6 \ --enable-plugin=pyside6 \
--enable-plugin=upx \ --enable-plugin=upx \
--upx-binary="${{ env.UPX_BINARY }}" \ --upx-binary="${{ env.UPX_BINARY }}" \
--noinclude-qt-translations \
--include-data-dir=core/interface/assets=core/interface/assets \ --include-data-dir=core/interface/assets=core/interface/assets \
--include-data-files=build_info.json=build_info.json \ --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/build_info.json \
@@ -133,63 +125,42 @@ jobs:
--output-filename=${{ env.APP_NAME }}.exe \ --output-filename=${{ env.APP_NAME }}.exe \
main.py main.py
- name: Build with PyInstaller (Linux) - name: Build with Nuitka (Unix)
if: runner.os == 'Linux' if: runner.os != 'Windows'
shell: bash shell: bash
run: | run: |
pyinstaller --onefile --windowed \ python -m nuitka \
--add-data "build_info.json:." \ --onefile \
--add-data "build_info.json:core" \ --onefile-no-compression \
--add-data "build_info.json:core/interface" \ --onefile-tempdir-spec="{CACHE_DIR}/${{ env.APP_NAME }}/${{ env.VERSION }}" \
--add-data "core/interface/assets:core/interface/assets" \ --assume-yes-for-downloads \
--icon "core/interface/assets/logo.png" \ --enable-plugin=pyside6 \
--exclude-module PyQt6 \ --enable-plugin=upx \
--exclude-module PyQt5 \ --upx-binary="${{ env.UPX_BINARY }}" \
--hidden-import=backports.tarfile \ --include-data-dir=core/interface/assets=core/interface/assets \
--hidden-import=backports \ --include-data-files=build_info.json=build_info.json \
--hidden-import=jaraco.context \ --include-data-files=build_info.json=core/build_info.json \
--hidden-import=jaraco.text \ --include-data-files=build_info.json=core/interface/build_info.json \
--hidden-import=jaraco.functools \ --output-filename=${{ env.APP_NAME }} \
--name ${{ env.APP_NAME }} \
main.py main.py
- name: Build with PyInstaller (macOS) - name: Prepare artifact
if: runner.os == 'macOS'
shell: bash shell: bash
run: | run: |
pyinstaller --onefile \ mkdir -p dist
--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 }} \
main.py
- name: Rename artifact
shell: bash
run: |
mkdir -p dist-final
if [ "$RUNNER_OS" == "Windows" ]; then if [ "$RUNNER_OS" == "Windows" ]; then
mv ${{ env.APP_NAME }}.exe dist-final/${{ matrix.artifact_name }} mv ${{ env.APP_NAME }}.exe dist/${{ matrix.artifact_name }}
else else
chmod +x dist/${{ env.APP_NAME }} mv ${{ env.APP_NAME }} dist/${{ matrix.artifact_name }}
mv dist/${{ env.APP_NAME }} dist-final/${{ matrix.artifact_name }} chmod +x dist/${{ matrix.artifact_name }}
fi fi
ls -la dist-final/ ls -la dist/
- name: Upload build artifact - name: Upload build artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: ${{ matrix.os }}-build name: ${{ matrix.os }}-build
path: dist-final/${{ matrix.artifact_name }} path: dist/${{ matrix.artifact_name }}
retention-days: 1 retention-days: 1
release: release:
@@ -214,16 +185,9 @@ jobs:
chmod +x release/SoftwareManager-dev-*-linux release/SoftwareManager-dev-*-macos chmod +x release/SoftwareManager-dev-*-linux release/SoftwareManager-dev-*-macos
ls -la release/ ls -la release/
- name: Generate checksums
run: |
cd release
sha256sum * > SHA256SUMS.txt
cat SHA256SUMS.txt
- name: Generate release notes - name: Generate release notes
run: | run: |
SHORT_SHA="${{ needs.build.outputs.short_sha }}" SHORT_SHA="${{ needs.build.outputs.short_sha }}"
CHECKSUMS=$(cat release/SHA256SUMS.txt)
cat > release_notes.md << EOF cat > release_notes.md << EOF
## Development Build ## Development Build
@@ -236,11 +200,6 @@ jobs:
- Linux: \`SoftwareManager-dev-${SHORT_SHA}-linux\` - Linux: \`SoftwareManager-dev-${SHORT_SHA}-linux\`
- Windows: \`SoftwareManager-dev-${SHORT_SHA}-windows.exe\` - Windows: \`SoftwareManager-dev-${SHORT_SHA}-windows.exe\`
- macOS: \`SoftwareManager-dev-${SHORT_SHA}-macos\` - macOS: \`SoftwareManager-dev-${SHORT_SHA}-macos\`
### SHA-256 Checksums
\`\`\`
${CHECKSUMS}
\`\`\`
EOF EOF
cat release_notes.md cat release_notes.md
@@ -254,6 +213,5 @@ jobs:
release/SoftwareManager-dev-${{ needs.build.outputs.short_sha }}-linux 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 }}-windows.exe
release/SoftwareManager-dev-${{ needs.build.outputs.short_sha }}-macos release/SoftwareManager-dev-${{ needs.build.outputs.short_sha }}-macos
release/SHA256SUMS.txt
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+25 -27
View File
@@ -29,7 +29,6 @@ import libtorrent as lt
import time import time
import sys import sys
import json import json
import asyncio
from core.utils.general.logs import consoleLog, remove_download_log, flush_log_buffer from core.utils.general.logs import consoleLog, remove_download_log, flush_log_buffer
from core.utils.general.wrappers import run_thread from core.utils.general.wrappers import run_thread
from core.utils.data.state import state from core.utils.data.state import state
@@ -74,16 +73,15 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
self.log_signal.connect(self._on_log_signal) self.log_signal.connect(self._on_log_signal)
def get_asset_path(filename): def get_asset_path(filename):
base_path = os.path.dirname(os.path.abspath(__file__)) if getattr(sys, 'frozen', False):
asset_path = os.path.join(base_path, 'assets', filename) base_path = sys._MEIPASS
else:
base_path = os.path.dirname(__file__)
asset_path = os.path.join(base_path, 'core', 'interface', 'assets', filename)
if os.path.exists(asset_path): if os.path.exists(asset_path):
return 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) return os.path.join('core', 'interface', 'assets', filename)
self.setWindowIcon(QIcon(get_asset_path("logo.png"))) self.setWindowIcon(QIcon(get_asset_path("logo.png")))
@@ -104,22 +102,23 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
state.version = build_info.get("version") state.version = build_info.get("version")
# Check for updates on Windows # Check for updates on Windows
if state.ignore_updates is False and platform.system() == "Windows": if state.ignore_updates is False:
result = check_for_updates() if platform.system() == "Windows":
if result != (None, None): result = check_for_updates()
assets, latest_version = result if result != (None, None):
assets, latest_version = result
if assets: if assets:
msg = QMessageBox() msg = QMessageBox()
msg.setIcon(QMessageBox.Icon.Information) msg.setIcon(QMessageBox.Icon.Information)
msg.setWindowTitle("Update Available") msg.setWindowTitle("Update Available")
msg.setText("A new version is available.") msg.setText("A new version is available.")
msg.setInformativeText("Press Ok to download the update.") msg.setInformativeText("Press Ok to download the update.")
msg.setStandardButtons(QMessageBox.StandardButton.Ok | QMessageBox.StandardButton.Ignore) msg.setStandardButtons(QMessageBox.StandardButton.Ok | QMessageBox.StandardButton.Ignore)
response = msg.exec_() response = msg.exec_()
if response == QMessageBox.StandardButton.Ok: if response == QMessageBox.StandardButton.Ok:
download_update(latest_version) download_update(latest_version)
self.setWindowTitle("Software Manager") self.setWindowTitle("Software Manager")
self.setGeometry(100, 100, 800, 600) self.setGeometry(100, 100, 800, 600)
@@ -476,11 +475,10 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
MainWindow._instance.log_signal.emit(text) MainWindow._instance.log_signal.emit(text)
def _on_log_signal(self, text): def _on_log_signal(self, text):
if hasattr(self, 'consoleLog'): self.consoleLog.append(text)
self.consoleLog.append(text) self.consoleLog.verticalScrollBar().setValue(
self.consoleLog.verticalScrollBar().setValue( self.consoleLog.verticalScrollBar().maximum()
self.consoleLog.verticalScrollBar().maximum() )
)
def update_image_overlay(self, new_image_path): def update_image_overlay(self, new_image_path):
self.image = QImage(new_image_path) self.image = QImage(new_image_path)
+1 -1
View File
@@ -1,5 +1,5 @@
requests==2.32.2 requests==2.32.2
PySide6-Essentials==6.10.1 PySide6==6.10.1
beautifulsoup4==4.13.5 beautifulsoup4==4.13.5
darkdetect==0.7.1 darkdetect==0.7.1
pyinstaller==6.15.0 pyinstaller==6.15.0