diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index f06de53..bf7182f 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -49,7 +49,7 @@ jobs: path: | venv ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- @@ -67,7 +67,7 @@ jobs: python -m venv venv source venv/bin/activate python -m pip install --upgrade pip - pip install --no-cache-dir . + pip install --no-cache-dir -r requirements.txt pip install --no-cache-dir cx_Freeze - name: Prepare build variables @@ -82,13 +82,6 @@ jobs: - name: Create cx_Freeze setup script (Linux) shell: bash run: | - # Create entry point script - cat > ytsage_entry.py <<'ENTRY' - from ytsage.main import main - if __name__ == "__main__": - main() - ENTRY - cat > setup_cxfreeze.py <<'PY' import os import sys @@ -99,32 +92,32 @@ jobs: # Prepare include_files list include_files_list = [ - ("ytsage/assets/Icon", "lib/assets/Icon"), - ("ytsage/assets/sound", "lib/assets/sound"), - ("ytsage/languages", "lib/languages"), - ("branding/icons", "lib/assets/branding/icons"), + ("src", "src"), + ("assets/branding/icons", "lib/assets/branding/icons"), + ("assets/Icon", "lib/assets/Icon"), + ("assets/sound", "lib/assets/sound"), + ("languages", "lib/languages"), ("ytsage.desktop", "share/applications/ytsage.desktop"), - ("branding/icons/icon.png", "share/pixmaps/ytsage.png"), + ("assets/branding/icons/icon.png", "share/pixmaps/ytsage.png"), ] build_exe_options = dict( optimize=2, packages=[ - "ytsage", "PySide6.QtCore", "PySide6.QtGui", "PySide6.QtWidgets", - "PySide6.QtMultimedia", - "PySide6.QtNetwork", "requests", "PIL", "packaging", "markdown", + "pyglet", "loguru", "setuptools", ], excludes=[ "PySide6.QtBluetooth", + "PySide6.QtNetwork", "PySide6.QtOpenGL", "PySide6.QtPrintSupport", "PySide6.QtSvg", @@ -132,6 +125,7 @@ jobs: "PySide6.QtXml", "PySide6.QtSql", "PySide6.QtHelp", + "PySide6.QtMultimedia", "PySide6.QtQml", "PySide6.QtQuick", "PySide6.QtWebEngineCore", @@ -157,9 +151,9 @@ jobs: executables = [ Executable( - script="ytsage_entry.py", + script="main.py", target_name="ytsage", - icon="branding/icons/icon.png", + icon="assets/branding/icons/icon.png", ) ] @@ -263,7 +257,7 @@ jobs: # Install desktop file and icon install -m 0644 ${workspace_root}/ytsage.desktop %{buildroot}/usr/share/applications/ytsage.desktop - install -m 0644 ${workspace_root}/branding/icons/icon.png %{buildroot}/usr/share/pixmaps/ytsage.png + install -m 0644 ${workspace_root}/assets/branding/icons/icon.png %{buildroot}/usr/share/pixmaps/ytsage.png %files /opt/ytsage @@ -343,7 +337,7 @@ jobs: # Desktop file and icon install -m 0644 ytsage.desktop "$pkgroot/usr/share/applications/ytsage.desktop" - install -m 0644 branding/icons/icon.png "$pkgroot/usr/share/pixmaps/ytsage.png" + install -m 0644 assets/branding/icons/icon.png "$pkgroot/usr/share/pixmaps/ytsage.png" # Control file cat > "$pkgroot/DEBIAN/control" < ytsage_entry.py <<'ENTRY' - from ytsage.main import main - if __name__ == "__main__": - main() - ENTRY - cat > setup_cxfreeze.py <<'PY' import os from cx_Freeze import setup, Executable @@ -96,21 +89,20 @@ jobs: build_exe_options = dict( optimize=2, packages=[ - "ytsage", "PySide6.QtCore", "PySide6.QtGui", "PySide6.QtWidgets", - "PySide6.QtMultimedia", - "PySide6.QtNetwork", "requests", "PIL", "packaging", "markdown", + "pyglet", "loguru", "setuptools", ], excludes=[ "PySide6.QtBluetooth", + "PySide6.QtNetwork", "PySide6.QtOpenGL", "PySide6.QtPrintSupport", "PySide6.QtSvg", @@ -118,6 +110,7 @@ jobs: "PySide6.QtXml", "PySide6.QtSql", "PySide6.QtHelp", + "PySide6.QtMultimedia", "PySide6.QtQml", "PySide6.QtQuick", "PySide6.QtWebEngineCore", @@ -134,18 +127,19 @@ jobs: "tests", ], include_files=[ - ("ytsage/assets/Icon", "lib/assets/Icon"), - ("ytsage/assets/sound", "lib/assets/sound"), - ("ytsage/languages", "lib/languages"), - ("branding/icons", "lib/assets/branding/icons"), + ("src", "src"), + ("assets/branding/icons", "lib/assets/branding/icons"), + ("assets/Icon", "lib/assets/Icon"), + ("assets/sound", "lib/assets/sound"), + ("languages", "lib/languages"), ], ) executables = [ Executable( - script="ytsage_entry.py", + script="main.py", target_name=f"YTSage-v{version}", - icon="branding/icons/icon.icns", + icon="assets/branding/icons/icon.icns", ) ] @@ -156,7 +150,7 @@ jobs: options={ "build_exe": build_exe_options, "bdist_mac": { - "iconfile": "branding/icons/icon.icns", + "iconfile": "assets/branding/icons/icon.icns", "bundle_name": f"YTSage-v{version}", }, "bdist_dmg": { diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index ca70cbc..b64a4b3 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -49,7 +49,7 @@ jobs: path: | venv ~\AppData\Local\pip\Cache - key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- @@ -59,7 +59,7 @@ jobs: python -m venv venv .\venv\Scripts\Activate.ps1 python -m pip install --upgrade pip - pip install --no-cache-dir . + pip install --no-cache-dir -r requirements.txt pip install --no-cache-dir cx_Freeze - name: Prepare build variables @@ -72,14 +72,6 @@ jobs: - name: Create cx_Freeze setup script shell: powershell run: | - # Create entry point script - $entryContent = @' - from ytsage.main import main - if __name__ == "__main__": - main() - '@ - Set-Content -Path "ytsage_entry.py" -Value $entryContent - # Create setup script for cx_Freeze New-Item -Path "setup_cxfreeze.py" -ItemType File -Force Add-Content -Path "setup_cxfreeze.py" -Value "import os" @@ -90,21 +82,20 @@ jobs: Add-Content -Path "setup_cxfreeze.py" -Value "build_exe_options = dict(" Add-Content -Path "setup_cxfreeze.py" -Value " optimize=2," Add-Content -Path "setup_cxfreeze.py" -Value " packages=[" - Add-Content -Path "setup_cxfreeze.py" -Value ' "ytsage",' Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtCore",' Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtGui",' Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtWidgets",' - Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtMultimedia",' - Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtNetwork",' Add-Content -Path "setup_cxfreeze.py" -Value ' "requests",' Add-Content -Path "setup_cxfreeze.py" -Value ' "PIL",' Add-Content -Path "setup_cxfreeze.py" -Value ' "packaging",' Add-Content -Path "setup_cxfreeze.py" -Value ' "markdown",' + Add-Content -Path "setup_cxfreeze.py" -Value ' "pyglet",' Add-Content -Path "setup_cxfreeze.py" -Value ' "loguru",' Add-Content -Path "setup_cxfreeze.py" -Value ' "setuptools",' Add-Content -Path "setup_cxfreeze.py" -Value " ]," Add-Content -Path "setup_cxfreeze.py" -Value " excludes=[" Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtBluetooth",' + Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtNetwork",' Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtOpenGL",' Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtPrintSupport",' Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtSvg",' @@ -112,6 +103,7 @@ jobs: Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtXml",' Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtSql",' Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtHelp",' + Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtMultimedia",' Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtQml",' Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtQuick",' Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtWebEngineCore",' @@ -128,19 +120,20 @@ jobs: Add-Content -Path "setup_cxfreeze.py" -Value ' "tests",' Add-Content -Path "setup_cxfreeze.py" -Value " ]," Add-Content -Path "setup_cxfreeze.py" -Value " include_files=[" - Add-Content -Path "setup_cxfreeze.py" -Value ' ("ytsage/assets/Icon", "lib/assets/Icon"),' - Add-Content -Path "setup_cxfreeze.py" -Value ' ("ytsage/assets/sound", "lib/assets/sound"),' - Add-Content -Path "setup_cxfreeze.py" -Value ' ("ytsage/languages", "lib/languages"),' - Add-Content -Path "setup_cxfreeze.py" -Value ' ("branding/icons", "lib/assets/branding/icons"),' + Add-Content -Path "setup_cxfreeze.py" -Value ' ("src", "src"),' + Add-Content -Path "setup_cxfreeze.py" -Value ' ("assets/branding/icons", "lib/assets/branding/icons"),' + Add-Content -Path "setup_cxfreeze.py" -Value ' ("assets/Icon", "lib/assets/Icon"),' + Add-Content -Path "setup_cxfreeze.py" -Value ' ("assets/sound", "lib/assets/sound"),' + Add-Content -Path "setup_cxfreeze.py" -Value ' ("languages", "lib/languages"),' Add-Content -Path "setup_cxfreeze.py" -Value " ]," Add-Content -Path "setup_cxfreeze.py" -Value ")" Add-Content -Path "setup_cxfreeze.py" -Value "" Add-Content -Path "setup_cxfreeze.py" -Value "executables = [" Add-Content -Path "setup_cxfreeze.py" -Value " Executable(" - Add-Content -Path "setup_cxfreeze.py" -Value ' script="ytsage_entry.py",' + Add-Content -Path "setup_cxfreeze.py" -Value ' script="main.py",' Add-Content -Path "setup_cxfreeze.py" -Value ' target_name=f"YTSage-v{version}.exe",' Add-Content -Path "setup_cxfreeze.py" -Value ' base="gui",' - Add-Content -Path "setup_cxfreeze.py" -Value ' icon="branding/icons/YTSage.ico",' + Add-Content -Path "setup_cxfreeze.py" -Value ' icon="assets/branding/icons/YTSage.ico",' Add-Content -Path "setup_cxfreeze.py" -Value " )" Add-Content -Path "setup_cxfreeze.py" -Value "]" Add-Content -Path "setup_cxfreeze.py" -Value ""