AppImageCrafters / appimage-builder

GNU/Linux packaging solution using the AppImage format
MIT License
308 stars 58 forks source link

Compiling pyqt5 project #172

Closed stupid-kid-af closed 2 years ago

stupid-kid-af commented 2 years ago

Docs is very confusing. How I can compile pyqt5 projects/app to appimage. Repo => https://github.com/ankydv/Dice-Simulator

Any help would be highly appreciated.

ahsand97 commented 2 years ago

I did a while ago a Pyqt5 application and deployed to an AppImage using this docker image

This is the recipe used to produce the AppImage, the inclusion/exclusion list is very confusing but with that setup I've got it working out (wmctrl and xdotool are not necessary, I needed them for my software) , the inclusion of qt5ct and Kvantum and the env var QT_QPA_PLATFORMTHEME: '${QT_QPA_PLATFORMTHEME}' is to make the app get the configuration from your system and display same colors, themes and fonts that u have configured for Qt.

The exclusion of libfontconfig1, libfreetype6 and libharfbuzz0b were necessary since the AppImage was crashing on ArchLinux but u can play including/excluding till u have everything necessary working

As a side note for some desktop environtments that don't use qt5ct to style qt apps (lxqt) but u still want to apply your kvantum config you can launch your Qt-AppImage using something like QT_STYLE_OVERRIDE=kvantum QT_QPA_PLATFORMTHEME=gtk3 /yourAppImage

Click to expand! ```yml version: 1 script: # Remove any previous build - rm -rf AppDir | true # Make usr and icons dirs - mkdir -p AppDir/usr/src # Copy the python application code into the AppDir - cp dofus-windows-switcher.py AppDir/usr/src -r - cp tabs.png AppDir/usr/src -r - mkdir -p AppDir/usr/share/icons/hicolor/512x512/apps - cp tabs.png AppDir/usr/share/icons/hicolor/512x512/apps -r # Install application dependencies - python3 -m pip install --ignore-installed --prefix=/usr --root=AppDir -r ./requirements.txt AppDir: path: ./AppDir app_info: id: ahsan-appimages.dofus-windows-switcher name: Dofus-Windows-Switcher icon: tabs version: 1.0.0 # Set the python executable as entry point exec: "usr/bin/python3" # Set the application main script path as argument. Use '$@' to forward CLI parameters exec_args: "$APPDIR/usr/src/dofus-windows-switcher.py $@" apt: arch: amd64 sources: - sourceline: 'deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse' key_url: 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3b4fe6acc0b21f32' # Repository for Kvantum - sourceline: 'deb http://ppa.launchpad.net/papirus/papirus/ubuntu/ bionic main' key_url: 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x9461999446faf0df770bfc9ae58a9d36647cae7f' include: - python3 - python3-pyqt5 - qt5ct - wmctrl - xdotool #QT5 related packages - libcanberra-gtk3-module - qt5-style-plugins - qt5-gtk-platformtheme - qt5-style-kvantum - qt5-style-kvantum-themes exclude: - libfontconfig1 - libfreetype6 - libharfbuzz0b runtime: env: PATH: '${APPDIR}/usr/bin:${PATH}' # Set python home # See https://docs.python.org/3/using/cmdline.html#envvar-PYTHONHOME PYTHONHOME: '${APPDIR}/usr' # Path to the site-packages dir or other modules dirs # See https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPATH PYTHONPATH: '${APPDIR}/usr/lib/python3.6/site-packages' QT_QPA_PLATFORMTHEME: '${QT_QPA_PLATFORMTHEME}' test: fedora: image: appimagecrafters/tests-env:fedora-30 command: ./AppRun use_host_x: true debian: image: appimagecrafters/tests-env:debian-stable command: ./AppRun use_host_x: true arch: image: appimagecrafters/tests-env:archlinux-latest command: ./AppRun use_host_x: true centos: image: appimagecrafters/tests-env:centos-7 command: ./AppRun use_host_x: true ubuntu: image: appimagecrafters/tests-env:ubuntu-xenial command: ./AppRun use_host_x: true AppImage: update-information: 'None' sign-key: None arch: x86_64 ```
azubieta commented 2 years ago

Please refer to https://appimage-builder.readthedocs.io/en/latest/examples/pyqt.html

Proceeding to close as this is a question, please reopen if needed.