Configure Gitea Workflows and Add Build Scripts
- Update build-linux.yaml to use standard Ubuntu runner. - Update build-windows.yaml to use tobix/pywine container for cross-compilation on Linux. - Add build_app.py and check_ttx6.py helper scripts.
This commit is contained in:
@@ -5,12 +5,7 @@ jobs:
|
||||
build:
|
||||
name: Build Linux
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: catthehacker/ubuntu:act-latest
|
||||
steps:
|
||||
- name: Configure Git Redirect
|
||||
run: git config --global url."http://192.168.50.24:3333/".insteadOf "http://server:3000/"
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
@@ -21,7 +16,7 @@ jobs:
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
python --version
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: Build Executable
|
||||
|
||||
@@ -4,26 +4,21 @@ on: [push, pull_request]
|
||||
jobs:
|
||||
build:
|
||||
name: Build Windows
|
||||
runs-on: windows-latest
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: tobix/pywine:3.10
|
||||
steps:
|
||||
- name: Configure Git Redirect
|
||||
run: git config --global url."http://192.168.50.24:3000/".insteadOf "http://server:3000/"
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
pip install -r requirements.txt
|
||||
wine python -m pip install --upgrade pip
|
||||
wine pip install -r requirements.txt
|
||||
|
||||
- name: Build Executable
|
||||
run: |
|
||||
pyinstaller --onefile --windowed --name TeletextEditor_Windows.exe --paths src src/main.py
|
||||
wine pyinstaller --onefile --windowed --name TeletextEditor_Windows.exe --paths src src/main.py
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
|
||||
60
build_app.py
Normal file
60
build_app.py
Normal file
@@ -0,0 +1,60 @@
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
import shutil
|
||||
import platform
|
||||
|
||||
def clean_build_dirs():
|
||||
"""Removes build and dist directories if they exist."""
|
||||
for d in ["build", "dist"]:
|
||||
if os.path.exists(d):
|
||||
print(f"Cleaning {d}...")
|
||||
shutil.rmtree(d)
|
||||
|
||||
spec_file = "TeletextEditor_Linux.spec" if platform.system() == "Linux" else "TeletextEditor_Windows.spec"
|
||||
if os.path.exists(spec_file):
|
||||
os.remove(spec_file)
|
||||
|
||||
def build():
|
||||
system = platform.system()
|
||||
print(f"Detected OS: {system}")
|
||||
|
||||
base_cmd = [
|
||||
sys.executable, "-m", "PyInstaller",
|
||||
"--onefile",
|
||||
"--windowed",
|
||||
"--paths", "src",
|
||||
"src/main.py"
|
||||
]
|
||||
|
||||
if system == "Linux":
|
||||
name = "TeletextEditor_Linux"
|
||||
elif system == "Windows":
|
||||
name = "TeletextEditor_Windows.exe"
|
||||
else:
|
||||
print(f"Unsupported platform: {system}")
|
||||
return
|
||||
|
||||
cmd = base_cmd + ["--name", name]
|
||||
|
||||
print("Running build command:")
|
||||
print(" ".join(cmd))
|
||||
|
||||
try:
|
||||
subprocess.check_call(cmd)
|
||||
print("\n" + "="*40)
|
||||
print(f"Build successful! Executable is in 'dist/{name}'")
|
||||
print("="*40)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Build failed with error code {e.returncode}")
|
||||
sys.exit(1)
|
||||
|
||||
# Cross-compilation note
|
||||
if system == "Linux":
|
||||
print("\nNote: To build the Windows executable, please run this script on Windows.")
|
||||
elif system == "Windows":
|
||||
print("\nNote: To build the Linux executable, please run this script on Linux.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
clean_build_dirs()
|
||||
build()
|
||||
28
check_ttx6.py
Normal file
28
check_ttx6.py
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Add src to path
|
||||
sys.path.append(os.path.join(os.getcwd(), 'src'))
|
||||
|
||||
from teletext.io import load_t42
|
||||
|
||||
def check_file(filename):
|
||||
if not os.path.exists(filename):
|
||||
print(f"File {filename} not found")
|
||||
return
|
||||
|
||||
service = load_t42(filename)
|
||||
print(f"Analysis of {filename}:")
|
||||
print(f"Total packets: {len(service.all_packets)}")
|
||||
print(f"Total pages: {len(service.pages)}")
|
||||
|
||||
language_names = ["English", "German", "Swedish/Finnish", "Italian", "French", "Portuguese/Spanish", "Turkish", "Romania"]
|
||||
|
||||
for i, page in enumerate(service.pages):
|
||||
lang_idx = page.language
|
||||
lang_name = language_names[lang_idx] if 0 <= lang_idx < len(language_names) else f"Unknown ({lang_idx})"
|
||||
print(f"Page {i+1}: Mag {page.magazine} Num {page.page_number:02d}, Lang: {lang_idx} ({lang_name})")
|
||||
|
||||
if __name__ == "__main__":
|
||||
check_file("TTX-6_RAW.t42")
|
||||
Reference in New Issue
Block a user