diff --git a/.gitignore b/.gitignore index e3c74a2..80504ee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ build/ dist/ +linux/flatpak/AppDir +linux/flatpak/.flatpak-builder *.snap *.spec *.zip @@ -16,7 +18,6 @@ build docs/html .directory *.kdev4 -*.json *.lpf *.lgg *.spec diff --git a/README.md b/README.md index f13d764..e6aec18 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,8 @@ For all builds, you need [Python 3](https://python.org) with [PySide2](https://p - Run the `package-macosx.sh` script. You will find a LogarithmPlotter-v0.0.1-dev-setup.dmg installer in the dist/ folder. - Linux packages: - To build a DEB, you need DPKG and stdeb. You can install the later by using `pip install stdeb`. + - To build and install the flatpak, you need [flatpak-builder](https://docs.flatpak.org/en/latest/flatpak-builder.html) installed. + - To build the snap, you need [snapcraft](https://snapcraft.io) installed. - Run `package-linux.sh`. diff --git a/linux/debian/depends b/linux/debian/depends index 717d393..1494f2e 100644 --- a/linux/debian/depends +++ b/linux/debian/depends @@ -1 +1 @@ -python3-pip, qt5-default (>= 5.15.0), qml-module-qtquick-controls2 (>= 5.15.0), qml-module-qtmultimedia (>= 5.15.0), qml-module-qtgraphicaleffects (>= 5.15.0), qml-module-qtquick2 (>= 5.15.0), qml-module-qtqml-models2 (>= 5.15.0), qml-module-qtquick-controls (>= 5.15.0), python3-pyside2.qtcore (>= 5.15.0), python3-pyside2.qtqml (>= 5.15.0), python3-pyside2.qtgui (>= 5.15.0), python3-pyside2.qtquick (>= 5.15.0), python3-pyside2.qtwidgets (>= 5.15.0), python3-pyside2.qtmultimedia (>= 5.15.0), python3-pyside2.qtnetwork (>= 5.15.0) +python3-pip, qt5-default (>= 5.12.0), qml-module-qtquick-controls2 (>= 5.12.0), qml-module-qtmultimedia (>= 5.12.0), qml-module-qtgraphicaleffects (>= 5.12.0), qml-module-qtquick2 (>= 5.12.0), qml-module-qtqml-models2 (>= 5.12.0), qml-module-qtquick-controls (>= 5.12.0), python3-pyside2.qtcore (>= 5.12.0), python3-pyside2.qtqml (>= 5.12.0), python3-pyside2.qtgui (>= 5.12.0), python3-pyside2.qtquick (>= 5.12.0), python3-pyside2.qtwidgets (>= 5.12.0), python3-pyside2.qtmultimedia (>= 5.12.0), python3-pyside2.qtnetwork (>= 5.12.0) diff --git a/linux/flatpak/eu.ad5001.LogarithmPlotter.json b/linux/flatpak/eu.ad5001.LogarithmPlotter.json new file mode 100644 index 0000000..5648e3a --- /dev/null +++ b/linux/flatpak/eu.ad5001.LogarithmPlotter.json @@ -0,0 +1,42 @@ +{ + "app-id": "eu.ad5001.LogarithmPlotter", + "runtime": "org.kde.Platform", + "runtime-version": "5.15", + "sdk": "org.kde.Sdk", + "finish-args": [ + "--share=ipc", + "--device=dri", + "--socket=x11", + "--socket=wayland", + "--talk-name=org.freedesktop.DBus.Proprieties", + "--talk-name=org.freedesktop.IBus", + "--talk-name=org.freedestkop.portal.*", + "--filesystem=home" + ], + "command": "logarithmplotter", + "rename-desktop-file": "logarithmplotter.desktop", + "rename-icon": "logplotter", + "rename-appdata-file": "eu.ad5001.LogarithmPlotter.metainfo.xml", + "cleanup": [ ], + "post-install": [ + "install -D mimetypes /app/share/mime/packages/x-logarithm-plot.xml" + ], + "modules": [ + "python3-pyside2.json", + + { + "name": "LogarithmPlotter", + "buildsystem": "simple", + "config-opts": ["no-debuginfo-compression"], + "build-commands": [ + "PREFIX=\"/app/share\" FLATPAK_INSTALL=1 python3 setup.py install --prefix=/app" + ], + "sources": [ + { + "type": "git", + "url": "https://git.ad5001.eu/Ad5001/LogarithmPlotter" + } + ] + } + ] +} diff --git a/linux/flatpak/python3-pyside2.json b/linux/flatpak/python3-pyside2.json new file mode 100644 index 0000000..7865949 --- /dev/null +++ b/linux/flatpak/python3-pyside2.json @@ -0,0 +1,32 @@ +{ + "name": "python3-pyside2", + "buildsystem": "simple", + "build-commands": [], + "config-opts": [], + "modules": [ + { + "name": "PySide2", + "buildsystem": "cmake-ninja", + "builddir": true, + "config-opts": [ + "-DCMAKE_BUILD_TYPE=Release", + "-DBUILD_TESTS=OFF" + ], + "sources": [ + { + "type": "archive", + "url": "https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-5.15.2-src/pyside-setup-opensource-src-5.15.2.tar.xz", + "sha256": "b306504b0b8037079a8eab772ee774b9e877a2d84bab2dbefbe4fa6f83941418" + }, + { + "type": "shell", + "commands": [ + "mkdir -p /app/include/qt5tmp && cp -R /usr/include/Qt* /app/include/qt5tmp # https://bugreports.qt.io/broswse/PYSIDE-787", + "sed -i 's|--include-paths=|--include-paths=/app/include/qt5tmp:|' sources/pyside2/cmake/Macros/PySideModules.cmake" + ] + } + ] + + } + ] +} diff --git a/package-linux.sh b/package-linux.sh index b518dd3..b10e672 100644 --- a/package-linux.sh +++ b/package-linux.sh @@ -1,3 +1,21 @@ #!/bin/bash python3 setup.py --command-packages=stdeb.command sdist_dsc --package accountfree --copyright-file linux/debian/copyright --suite hirsute --recommends "$(cat linux/debian/recommends)" --depends "$(cat linux/debian/depends)" --section science bdist_deb + +# Flatpak building +FLATPAK_BUILDER=$(which flatpak-builder) +if [ -z $FLATPAK_BUILDER ]; then + echo "flatpak-builder not installed. Will not proceed to build flatpak." +else + cd linux/flatpak + flatpak-builder AppDir eu.ad5001.LogarithmPlotter.json --user --force-clean --install + cd ../../ +fi + +# Snapcraft building +SNAPCRAFT=$(which snapcraft) +if [ -z $SNAPCRAFT ]; then + echo "snapcraft not installed. Will not proceed to build snap" +else + snapcraft +fi diff --git a/setup.py b/setup.py index 2d10ce2..8b47858 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ if "PREFIX" not in os.environ and sys.platform == 'linux': rmdir("/usr/share/applications/test") os.environ["PREFIX"] = "/usr/share" except: - os.environ["PREFIX"] = os.environ["home"] + "/local/share" + os.environ["PREFIX"] = os.environ["HOME"] + "/.local/share" from LogarithmPlotter import __VERSION__ as pkg_version @@ -87,7 +87,6 @@ if sys.platform == 'linux': copyfile(current_dir + '/linux/application-x-logarithm-plot.svg', os.environ["PREFIX"] + '/icons/hicolor/scalable/mimetypes/application-x-logarithm-plot.svg') copyfile(current_dir + '/logplotter.svg', os.environ["PREFIX"] + '/icons/hicolor/scalable/apps/logplotter.svg') - print("Wrote icon to ", os.environ["PREFIX"] + '/icons/hicolor/scalable/apps/logplotter.svg') if "FLATPAK_INSTALL" in os.environ: copyfile(current_dir + '/linux/eu.ad5001.LogarithmPlotter.metainfo.flatpak.xml', os.environ["PREFIX"] + '/metainfo/eu.ad5001.LogarithmPlotter.metainfo.xml') @@ -97,9 +96,6 @@ if sys.platform == 'linux': os.remove(os.environ["PREFIX"] + '/icons/hicolor/scalable/mimetypes/application-x-logarithm-plot.svg') os.remove(os.environ["PREFIX"] + '/icons/hicolor/scalable/apps/logplotter.svg') -print("FLATPAK_INSTALL=", "FLATPAK_INSTALL" in os.environ) -print("Dependencies:", [] if "FLATPAK_INSTALL" in os.environ else ["PySide2"]) - setuptools.setup( install_requires=([] if "FLATPAK_INSTALL" in os.environ else ["PySide2"]), python_requires='>=3.8',