diff --git a/.gitea/workflows/build-nightlly.yml b/.gitea/workflows/build-nightlly.yml index 55c388f..f4dc357 100644 --- a/.gitea/workflows/build-nightlly.yml +++ b/.gitea/workflows/build-nightlly.yml @@ -2,8 +2,14 @@ name: Nightly Build - AppImage, Arch, Fedora on: workflow_dispatch: + inputs: + branch: + description: 'Branch to build' + required: false + default: 'main' env: + BUILD_BRANCH: ${{ inputs.branch || 'main' }} PKGDEST: "/tmp/portprotonqt" PACKAGE: "portprotonqt" @@ -22,6 +28,8 @@ jobs: pacman -Syu --noconfirm --disable-download-timeout --needed git wget gnupg nodejs npm xorg-server-xvfb zsync - uses: https://gitea.com/actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 + with: + ref: ${{ env.BUILD_BRANCH }} - name: Install appimage dependencies run: | @@ -55,9 +63,8 @@ jobs: steps: - name: Install build dependencies run: | - dnf install -y git rpmdevtools python3-devel python3-wheel python3-pip \ - python3-build pyproject-rpm-macros systemd-rpm-macros python3-setuptools \ - redhat-rpm-config nodejs npm + dnf install -y git rpmdevtools meson ninja-build python3-devel \ + systemd-rpm-macros redhat-rpm-config nodejs npm - name: Setup rpmbuild environment run: | @@ -68,10 +75,13 @@ jobs: - name: Checkout repo uses: https://gitea.com/actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 + with: + ref: ${{ env.BUILD_BRANCH }} - name: Copy fedora.spec run: | - cp build-aux/fedora-git.spec /home/rpmbuild/SPECS/${{ env.PACKAGE }}.spec + sed "s|git clone https://git.linux-gaming.ru/Boria138/PortProtonQt.git|git clone -b ${{ env.BUILD_BRANCH }} https://git.linux-gaming.ru/Boria138/PortProtonQt.git|" \ + build-aux/fedora-git.spec > /home/rpmbuild/SPECS/${{ env.PACKAGE }}.spec chown -R rpmbuild:users /home/rpmbuild - name: Build RPM @@ -118,13 +128,16 @@ jobs: - name: Build run: | cd /__w/portproton-repo - git clone https://git.linux-gaming.ru/Boria138/PortProtonQt.git + git clone -b ${{ env.BUILD_BRANCH }} https://git.linux-gaming.ru/Boria138/PortProtonQt.git cd /__w/portproton-repo/PortProtonQt/build-aux + sed -i "s|source=(\"git+https://git.linux-gaming.ru/Boria138/PortProtonQt.git\")|source=(\"git+https://git.linux-gaming.ru/Boria138/PortProtonQt.git#branch=${{ env.BUILD_BRANCH }}\")|" PKGBUILD-git chown user -R .. su user -c "yes '' | makepkg --noconfirm -s -p PKGBUILD-git" - name: Checkout uses: https://gitea.com/actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 + with: + ref: ${{ env.BUILD_BRANCH }} - name: Upload Arch package uses: https://gitea.com/actions/gitea-upload-artifact@v4 diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index f7d73c0..6e73280 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -109,9 +109,8 @@ jobs: steps: - name: Install build dependencies run: | - dnf install -y git rpmdevtools python3-devel python3-wheel python3-pip \ - python3-build pyproject-rpm-macros systemd-rpm-macros python3-setuptools \ - redhat-rpm-config nodejs npm + dnf install -y git rpmdevtools meson ninja-build python3-devel \ + systemd-rpm-macros redhat-rpm-config nodejs npm - name: Setup rpmbuild environment run: | diff --git a/.gitea/workflows/code-build.yml b/.gitea/workflows/code-build.yml index a7694cf..375589d 100644 --- a/.gitea/workflows/code-build.yml +++ b/.gitea/workflows/code-build.yml @@ -108,9 +108,8 @@ jobs: steps: - name: Install build dependencies run: | - dnf install -y git rpmdevtools python3-devel python3-wheel python3-pip \ - python3-build pyproject-rpm-macros python3-setuptools \ - redhat-rpm-config nodejs npm + dnf install -y git rpmdevtools meson ninja-build python3-devel \ + systemd-rpm-macros redhat-rpm-config nodejs npm - name: Setup rpmbuild environment run: | diff --git a/build-aux/PKGBUILD b/build-aux/PKGBUILD index 8ba1850..b548b7b 100644 --- a/build-aux/PKGBUILD +++ b/build-aux/PKGBUILD @@ -7,18 +7,15 @@ url="https://git.linux-gaming.ru/Boria138/PortProtonQt" license=('GPL-3.0') depends=('python-requests' 'python-babel' 'python-evdev' 'python-pyudev' 'python-orjson' 'python-psutil' 'python-tqdm' 'python-vdf' 'python-libarchive-c' 'pyside6' 'python-rapidfuzz' 'icoextract' 'python-pillow' 'perl-image-exiftool' 'xdg-utils' 'python-beautifulsoup4' 'python-websocket-client' 'cabextract' 'unzip' 'curl' 'unrar' 'qt6-svg') -makedepends=('python-'{'build','installer','setuptools','wheel'}) +makedepends=('meson' 'ninja') source=("git+https://git.linux-gaming.ru/Boria138/PortProtonQt#tag=v$pkgver") sha256sums=('SKIP') build() { - cd "$srcdir/PortProtonQt" - python -m build --wheel --no-isolation + arch-meson PortProtonQt build + meson compile -C build } package() { - cd "$srcdir/PortProtonQt" - python -m installer --destdir="$pkgdir" dist/*.whl - cp -r build-aux/share "$pkgdir/usr/" - cp -r build-aux/lib "$pkgdir/usr/" + meson install -C build --destdir "$pkgdir" } diff --git a/build-aux/PKGBUILD-git b/build-aux/PKGBUILD-git index 9567815..ba88a16 100644 --- a/build-aux/PKGBUILD-git +++ b/build-aux/PKGBUILD-git @@ -7,7 +7,7 @@ url="https://git.linux-gaming.ru/Boria138/PortProtonQt" license=('GPL-3.0') depends=('python-requests' 'python-babel' 'python-evdev' 'python-pyudev' 'python-orjson' 'python-psutil' 'python-tqdm' 'python-vdf' 'python-libarchive-c' 'pyside6' 'icoextract' 'python-pillow' 'python-rapidfuzz' 'perl-image-exiftool' 'xdg-utils' 'python-beautifulsoup4' 'python-websocket-client' 'cabextract' 'unzip' 'curl' 'unrar' 'qt6-svg') -makedepends=('python-'{'build','installer','setuptools','wheel'}) +makedepends=('meson' 'ninja') source=("git+https://git.linux-gaming.ru/Boria138/PortProtonQt.git") sha256sums=('SKIP') @@ -17,13 +17,10 @@ pkgver() { } build() { - cd "$srcdir/PortProtonQt" - python -m build --wheel --no-isolation + arch-meson PortProtonQt build + meson compile -C build } package() { - cd "$srcdir/PortProtonQt" - python -m installer --destdir="$pkgdir" dist/*.whl - cp -r build-aux/share "$pkgdir/usr/" - cp -r build-aux/lib "$pkgdir/usr/" + meson install -C build --destdir "$pkgdir" } diff --git a/build-aux/fedora-git.spec b/build-aux/fedora-git.spec index 315be96..68f5386 100644 --- a/build-aux/fedora-git.spec +++ b/build-aux/fedora-git.spec @@ -1,12 +1,11 @@ %global pypi_name portprotonqt -%global pypi_version 0.1.1 +%global pypi_version 0.1.10 %global oname PortProtonQt %global build_timestamp %(date +"%Y%m%d") -%global _python_no_extras_requires 1 %global rel_build 1.git.%{build_timestamp}%{?dist} -Name: python-%{pypi_name}-git +Name: %{pypi_name}-git Version: %{pypi_version} Release: %{rel_build} Summary: Modern GUI for managing and launching games from PortProton, Steam, and Epic Games Store (development build) @@ -15,21 +14,15 @@ License: GPL-3.0 URL: https://git.linux-gaming.ru/Boria138/PortProtonQt BuildArch: noarch +BuildRequires: meson >= 0.61.2 +BuildRequires: ninja-build BuildRequires: python3-devel -BuildRequires: python3-wheel -BuildRequires: python3-pip -BuildRequires: python3-build -BuildRequires: pyproject-rpm-macros -BuildRequires: python3dist(setuptools) BuildRequires: git BuildRequires: systemd-rpm-macros -%description -%{summary} +Obsoletes: python3-%{pypi_name}-git < %{version}-%{release} +Provides: python3-%{pypi_name}-git = %{version}-%{release} -%package -n python3-%{pypi_name}-git -Summary: %{summary} -%{?python_provide:%python_provide python3-%{pypi_name}} Requires: python3-babel Requires: python3-evdev Requires: python3-icoextract @@ -55,27 +48,25 @@ Requires: unzip Requires: curl Requires: unrar -%description -n python3-%{pypi_name}-git +%description This application provides a sleek, intuitive graphical interface for managing and launching games from PortProton, Steam, and Epic Games Store. It consolidates your game libraries into a single, user-friendly hub for seamless navigation and organization. Its lightweight structure and cross-platform support deliver a cohesive gaming experience, eliminating the need for multiple launchers. Unique PortProton integration enhances Linux gaming, enabling effortless play of Windows-based titles with minimal setup. -%{?python_disable_dependency_generator} - %prep git clone https://git.linux-gaming.ru/Boria138/PortProtonQt.git %build cd %{oname} -%pyproject_wheel +%meson -Dpython_libdir=%{python3_sitelib} -Dudevdir=%{_udevrulesdir} +%meson_build %install cd %{oname} -%pyproject_install -%pyproject_save_files %{pypi_name} -cp -r build-aux/share %{buildroot}/usr/ -cp -r build-aux/lib %{buildroot}/usr/ +%meson_install +%find_lang %{pypi_name} -%files -n python3-%{pypi_name}-git -f %{pyproject_files} +%files -f %{oname}/%{pypi_name}.lang %{_bindir}/%{pypi_name} +%{python3_sitelib}/%{pypi_name}/ %{_datadir}/icons/hicolor/scalable/apps/ru.linux_gaming.PortProtonQt.svg %{_metainfodir}/ru.linux_gaming.PortProtonQt.metainfo.xml %{_udevrulesdir}/60-portprotonqt.rules diff --git a/build-aux/fedora.spec b/build-aux/fedora.spec index dfde695..dce4f29 100644 --- a/build-aux/fedora.spec +++ b/build-aux/fedora.spec @@ -1,9 +1,8 @@ %global pypi_name portprotonqt %global pypi_version 0.1.10 %global oname PortProtonQt -%global _python_no_extras_requires 1 -Name: python-%{pypi_name} +Name: %{pypi_name} Version: %{pypi_version} Release: 1%{?dist} Summary: Modern GUI for managing and launching games from PortProton, Steam, and Epic Games Store @@ -12,21 +11,15 @@ License: GPL-3.0 URL: https://git.linux-gaming.ru/Boria138/PortProtonQt BuildArch: noarch +BuildRequires: meson >= 0.61.2 +BuildRequires: ninja-build BuildRequires: python3-devel -BuildRequires: python3-wheel -BuildRequires: python3-pip -BuildRequires: python3-build -BuildRequires: pyproject-rpm-macros -BuildRequires: python3dist(setuptools) BuildRequires: git BuildRequires: systemd-rpm-macros -%description -%{summary} +Obsoletes: python3-%{pypi_name} < %{version}-%{release} +Provides: python3-%{pypi_name} = %{version}-%{release} -%package -n python3-%{pypi_name} -Summary: %{summary} -%{?python_provide:%python_provide python3-%{pypi_name}} Requires: python3-babel Requires: python3-evdev Requires: python3-icoextract @@ -52,11 +45,9 @@ Requires: unzip Requires: curl Requires: unrar -%description -n python3-%{pypi_name} +%description This application provides a sleek, intuitive graphical interface for managing and launching games from PortProton, Steam, and Epic Games Store. It consolidates your game libraries into a single, user-friendly hub for seamless navigation and organization. Its lightweight structure and cross-platform support deliver a cohesive gaming experience, eliminating the need for multiple launchers. Unique PortProton integration enhances Linux gaming, enabling effortless play of Windows-based titles with minimal setup. -%{?python_disable_dependency_generator} - %prep git clone https://git.linux-gaming.ru/Boria138/PortProtonQt cd %{oname} @@ -64,17 +55,17 @@ git checkout v%{pypi_version} %build cd %{oname} -%pyproject_wheel +%meson -Dpython_libdir=%{python3_sitelib} -Dudevdir=%{_udevrulesdir} +%meson_build %install cd %{oname} -%pyproject_install -%pyproject_save_files %{pypi_name} -cp -r build-aux/share %{buildroot}/usr/ -cp -r build-aux/lib %{buildroot}/usr/ +%meson_install +%find_lang %{pypi_name} -%files -n python3-%{pypi_name} -f %{pyproject_files} +%files -f %{oname}/%{pypi_name}.lang %{_bindir}/%{pypi_name} +%{python3_sitelib}/%{pypi_name}/ %{_datadir}/icons/hicolor/scalable/apps/ru.linux_gaming.PortProtonQt.svg %{_metainfodir}/ru.linux_gaming.PortProtonQt.metainfo.xml %{_udevrulesdir}/60-portprotonqt.rules diff --git a/build-aux/portprotonqt b/build-aux/portprotonqt new file mode 100644 index 0000000..f60a4de --- /dev/null +++ b/build-aux/portprotonqt @@ -0,0 +1,9 @@ +#!@PYTHON@ + +import sys + +from portprotonqt.app import main + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/dev-scripts/bump_ver.py b/dev-scripts/bump_ver.py index 46fc256..2ac52f3 100755 --- a/dev-scripts/bump_ver.py +++ b/dev-scripts/bump_ver.py @@ -13,6 +13,7 @@ APPIMAGE_RECIPE = BASE_DIR / "build-aux" / "AppImageBuilder.yml" ARCH_PKGBUILD = BASE_DIR / "build-aux" / "PKGBUILD" FEDORA_SPEC = BASE_DIR / "build-aux" / "fedora.spec" PYPROJECT = BASE_DIR / "pyproject.toml" +MESON_BUILD = BASE_DIR / "meson.build" APP_PY = BASE_DIR / "portprotonqt" / "app.py" GITEA_WORKFLOW = BASE_DIR / ".gitea" / "workflows" / "build.yml" CHANGELOG = BASE_DIR / "CHANGELOG.md" @@ -69,6 +70,19 @@ def bump_pyproject(path: Path, old: str, new: str) -> bool: path.write_text(new_text, encoding='utf-8') return bool(count) +def bump_meson(path: Path, old: str, new: str) -> bool: + """ + Update version in meson.build + """ + if not path.exists(): + return False + text = path.read_text(encoding='utf-8') + pattern = re.compile(r"(version:\s*)'" + re.escape(old) + r"'") + new_text, count = pattern.subn(lambda m: m.group(1) + f"'{new}'", text) + if count: + path.write_text(new_text, encoding='utf-8') + return bool(count) + def bump_app_py(path: Path, old: str, new: str) -> bool: """ Update __app_version__ in app.py @@ -121,6 +135,7 @@ def main(): (ARCH_PKGBUILD, bump_arch), (FEDORA_SPEC, bump_fedora), (PYPROJECT, bump_pyproject), + (MESON_BUILD, bump_meson), (APP_PY, bump_app_py), (GITEA_WORKFLOW, bump_workflow), (CHANGELOG, bump_changelog) diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..715a13a --- /dev/null +++ b/meson.build @@ -0,0 +1,83 @@ +project('portprotonqt', + version: '0.1.10', + meson_version: '>= 0.61.2', + license: 'GPL-3.0', +) + +# Project directories +prefix = get_option('prefix') +datadir = prefix / get_option('datadir') +bindir = prefix / get_option('bindir') + +# Python module for site-packages path +python = import('python') +python3 = python.find_installation('python3') +pythondir = join_paths(prefix, python3.get_path('purelib')) + +python_libdir = get_option('python_libdir') +if python_libdir == '' + python_installdir = pythondir +else + python_installdir = python_libdir +endif + +pkgdatadir = python_installdir / meson.project_name() + +conf = configuration_data() +conf.set('PYTHON', python.find_installation('python3').full_path()) + +# Install Python package +subdir('portprotonqt') + +# Install entry point script with proper name to avoid conflict in build directory +configured_portprotonqt = configure_file( + input: 'build-aux/portprotonqt', + output: 'portprotonqt-script', + configuration: conf, +) + +# Install the configured script with the correct name +install_data(configured_portprotonqt, + install_dir: bindir, + install_mode: 'rwxr-xr-x', + rename: 'portprotonqt') + +# Install desktop file +install_data( + 'build-aux/share/applications/ru.linux_gaming.PortProtonQt.desktop', + install_dir: datadir / 'applications', +) + +# Install icon +install_data( + 'build-aux/share/icons/hicolor/scalable/apps/ru.linux_gaming.PortProtonQt.svg', + install_dir: datadir / 'icons/hicolor/scalable/apps', +) + +# Install metainfo +install_data( + 'build-aux/share/metainfo/ru.linux_gaming.PortProtonQt.metainfo.xml', + install_dir: datadir / 'metainfo', +) + +# Install bash completion +install_data( + 'build-aux/share/bash-completion/completions/portprotonqt', + install_dir: datadir / 'bash-completion/completions', +) + +# Install udev rules +udevdir = get_option('udevdir') +if udevdir == '' + udev = dependency('udev', required: false) + if udev.found() + udevdir = udev.get_variable(pkgconfig: 'udevdir') / 'rules.d' + else + udevdir = prefix / get_option('libdir') / 'udev/rules.d' + endif +endif + +install_data( + 'build-aux/lib/udev/rules.d/60-portprotonqt.rules', + install_dir: udevdir, +) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..ff8c92e --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,11 @@ +option('udevdir', + type: 'string', + value: '', + description: 'Directory for udev rules (auto-detected if empty)', +) + +option('python_libdir', + type: 'string', + value: '', + description: 'Python site-packages directory (auto-detected if empty)', +) diff --git a/portprotonqt/localization.py b/portprotonqt/localization.py index 2f4f9c7..2ddbf84 100644 --- a/portprotonqt/localization.py +++ b/portprotonqt/localization.py @@ -33,11 +33,21 @@ LOCALE_MAP = { 'el': 'greek', } -translate = gettext.translation( - domain="messages", - localedir = Path(__file__).parent / "locales", - fallback=True, -) +# Try system locale directory first, fallback to local for development +_system_localedir = Path("/usr/share/locale") +_local_localedir = Path(__file__).parent / "locales" + +try: + translate = gettext.translation( + domain="portprotonqt", + localedir=_system_localedir, + ) +except FileNotFoundError: + translate = gettext.translation( + domain="messages", + localedir=_local_localedir, + fallback=True, + ) _ = translate.gettext def get_system_locale(): diff --git a/portprotonqt/meson.build b/portprotonqt/meson.build new file mode 100644 index 0000000..22b83e5 --- /dev/null +++ b/portprotonqt/meson.build @@ -0,0 +1,60 @@ +# Install Python source files +install_data( + '__init__.py', + 'animations.py', + 'app.py', + 'cli.py', + 'config_utils.py', + 'context_menu_manager.py', + 'custom_widgets.py', + 'detail_pages.py', + 'dialogs.py', + 'downloader.py', + 'egs_api.py', + 'game_card.py', + 'game_library_manager.py', + 'get_wine_module.py', + 'howlongtobeat_api.py', + 'image_utils.py', + 'input_manager.py', + 'keyboard_layouts.py', + 'localization.py', + 'logger.py', + 'main_window.py', + 'portproton_api.py', + 'preloader.py', + 'search_utils.py', + 'settings_manager.py', + 'steam_api.py', + 'system_overlay.py', + 'theme_manager.py', + 'theme_security.py', + 'time_utils.py', + 'tray_manager.py', + 'version_utils.py', + 'virtual_keyboard.py', + install_dir: pkgdatadir, +) + +# Install themes +install_subdir( + 'themes', + install_dir: pkgdatadir, + exclude_directories: ['__pycache__'], + exclude_files: ['*.pyc'], +) + +# Install locales to standard location +localedir = get_option('prefix') / get_option('localedir') +locale_map = { + 'de': 'de_DE', + 'es': 'es_ES', + 'ru': 'ru_RU', +} +foreach short_lang, src_lang : locale_map + install_data( + 'locales' / src_lang / 'LC_MESSAGES' / 'messages.mo', + install_dir: localedir / short_lang / 'LC_MESSAGES', + rename: 'portprotonqt.mo', + ) +endforeach