From ad2d136e3fe1606f3e4655e5fea4965f32a116b2 Mon Sep 17 00:00:00 2001 From: rattatwinko Date: Fri, 31 Oct 2025 23:07:16 +0100 Subject: [PATCH] import error fix, and pipeline --- .gitea/workflows/run-mucapy.yml | 43 ++++++++++++++++++--------------- mucapy/main.py | 5 +++- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/.gitea/workflows/run-mucapy.yml b/.gitea/workflows/run-mucapy.yml index 193648c..bf54101 100644 --- a/.gitea/workflows/run-mucapy.yml +++ b/.gitea/workflows/run-mucapy.yml @@ -1,3 +1,4 @@ + name: Build MuCaPy Executable on: @@ -7,36 +8,38 @@ on: branches: [ main ] jobs: - build-and-package: + build-windows-exe: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v3 - - name: Set up Python 3.10 - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - - name: Install Python dependencies + - name: Install dependencies for Wine run: | - python -m pip install --upgrade pip - pip install -r requirements.txt + sudo dpkg --add-architecture i386 + sudo apt update + sudo apt install -y wine64 wine32 unzip wget cabextract - - name: Install PyInstaller - run: pip install pyinstaller - - - name: Build executable with PyInstaller + - name: Install Windows Python under Wine run: | - pyinstaller --onefile --windowed mucapy/main.py \ - --add-data "mucapy/styling:styling" \ - --add-data "mucapy/models:models" \ - --add-data "mucapy/todopackage:todopackage" + wget https://www.python.org/ftp/python/3.10.13/python-3.10.13-amd64.exe -O python_installer.exe + wine python_installer.exe /quiet InstallAllUsers=1 PrependPath=1 - - name: Upload executable artifact + - name: Upgrade pip and install PyInstaller (Windows) + run: | + wine python -m pip install --upgrade pip + wine python -m pip install pyinstaller + + - name: Build Windows executable + run: | + wine pyinstaller --onefile --windowed mucapy/main.py \ + --add-data "mucapy/styling;styling" \ + --add-data "mucapy/models;models" \ + --add-data "mucapy/todopackage;todopackage" + + - name: Upload Windows executable uses: actions/upload-artifact@v3 with: - name: mucapy-executable + name: mucapy-windows-exe path: dist/ - diff --git a/mucapy/main.py b/mucapy/main.py index f042662..75b304d 100644 --- a/mucapy/main.py +++ b/mucapy/main.py @@ -1,5 +1,8 @@ import json -import winreg +try: + import winreg +except ImportError: + pass import os import platform import subprocess