1

I am trying to create a Project with Gnome Builder in Python. The documentation is very limited, but I think found out:

When you press the "build" button in Builder, it tries to build a flatpak and runs it. This works for the initial project stub. When i add a

import numpy

the project cannnot be run, because there is no numpy yet. I think this has to be added in the .JSON File. I also think the meson file is only for "collecting" the .py sources for the flatpak-builder. I followed the documentation on http://docs.flatpak.org/en/latest/python.html and created a module for numpy with the flatpak-pip-generator.

My .JSON file now looks like this:

{
    "app-id": "de.gymlan.Plottler",
    "runtime": "org.gnome.Platform",
    "runtime-version": "3.32",
    "sdk": "org.gnome.Sdk",
    "command": "plottler",
    "finish-args": [
        "--share=network",
        "--share=ipc",
        "--socket=fallback-x11",
        "--socket=wayland",
        "--filesystem=xdg-run/dconf",
        "--filesystem=~/.config/dconf:ro",
        "--talk-name=ca.desrt.dconf",
        "--env=DCONF_USER_CONFIG_DIR=.config/dconf"
    ],
    "cleanup": [
        "/include",
        "/lib/pkgconfig",
        "/man",
        "/share/doc",
        "/share/gtk-doc",
        "/share/man",
        "/share/pkgconfig",
        "*.la",
        "*.a"
    ],
    "modules": [
        {
            "name": "plottler",
            "builddir": true,
            "buildsystem": "meson",
            "sources": [
                {
                    "type": "git",
                    "url": "file:///home/ulrich/Projekte/Plottler"
                }
            ]
        },
        {
      "name": "python3-numpy",
          "buildsystem": "simple",
          "build-commands": [
            "pip3 install --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} numpy"
          ],
          "sources": [
            {
            "type": "file",
            "url": "https://files.pythonhosted.org/packages/ac/36/325b27ef698684c38b1fe2e546e2e7ef9cecd7037bcdb35c87efec4356af/numpy-1.17.2.zip",
            "sha256": "73615d3edc84dd7c4aeb212fa3748fb83217e00d201875a47327f55363cef2df"
             }
          ]
        }
    ]
}

But the build fails with an error from git, which I don't understand:

flatpak-builder --arch=x86_64 --ccache --force-clean --state-dir /home/ulrich/.var/app/org.gnome.Builder/cache/gnome-builder/flatpak-builder --download-only --disable-updates --stop-at=python3-numpy /home/ulrich/.var/app/org.gnome.Builder/cache/gnome-builder/projects/Plottler/flatpak/staging/x86_64-master /home/ulrich/Projekte/Plottler/de.gymlan.Plottler.json
Emptying app dir '/home/ulrich/.var/app/org.gnome.Builder/cache/gnome-builder/projects/Plottler/flatpak/staging/x86_64-master'
Downloading sources
Fetching full git repo file:///home/ulrich/Projekte/Plottler
fatal: ambiguous argument 'master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Failed to download sources: module plottler: Der Kindprozess wurde mit Status 128 beendet
flatpak-builder --arch=x86_64 --ccache --force-clean --disable-updates --disable-download --state-dir /home/ulrich/.var/app/org.gnome.Builder/cache/gnome-builder/flatpak-builder --stop-at=python3-numpy /home/ulrich/.var/app/org.gnome.Builder/cache/gnome-builder/projects/Plottler/flatpak/staging/x86_64-master /home/ulrich/Projekte/Plottler/de.gymlan.Plottler.json
Starting build of de.gymlan.Plottler
fatal: ambiguous argument 'master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

(flatpak-builder:73): flatpak-builder-WARNING **: 16:45:17.109: Failed to get current git checksum: Der Kindprozess wurde mit Status 128 beendet
Cache miss, checking out last cache hit

(flatpak-builder:73): flatpak-builder-WARNING **: 16:45:17.109: rofiles-fuse not available, doing without
========================================================================
Building module plottler in /home/ulrich/.var/app/org.gnome.Builder/cache/gnome-builder/flatpak-builder/build/plottler-11
========================================================================
error: pathspec 'master' did not flatpak-builder --arch=x86_64 --ccache --force-clean --state-dir /home/ulrich/.var/app/org.gnome.Builder/cache/gnome-builder/flatpak-builder --download-only --disable-updates --stop-at=python3-numpy /home/ulrich/.var/app/org.gnome.Builder/cache/gnome-builder/projects/Plottler/flatpak/staging/x86_64-master /home/ulrich/Projekte/Plottler/de.gymlan.Plottler.json
Emptying app dir '/home/ulrich/.var/app/org.gnome.Builder/cache/gnome-builder/projects/Plottler/flatpak/staging/x86_64-master'
Downloading sources
Fetching full git repo file:///home/ulrich/Projekte/Plottler
fatal: ambiguous argument 'master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Failed to download sources: module plottler: Der Kindprozess wurde mit Status 128 beendet
flatpak-builder --arch=x86_64 --ccache --force-clean --disable-updates --disable-download --state-dir /home/ulrich/.var/app/org.gnome.Builder/cache/gnome-builder/flatpak-builder --stop-at=python3-numpy /home/ulrich/.var/app/org.gnome.Builder/cache/gnome-builder/projects/Plottler/flatpak/staging/x86_64-master /home/ulrich/Projekte/Plottler/de.gymlan.Plottler.json
Starting build of de.gymlan.Plottler
fatal: ambiguous argument 'master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

(flatpak-builder:73): flatpak-builder-WARNING **: 16:45:17.109: Failed to get current git checksum: Der Kindprozess wurde mit Status 128 beendet
Cache miss, checking out last cache hit

(flatpak-builder:73): flatpak-builder-WARNING **: 16:45:17.109: rofiles-fuse not available, doing without
========================================================================
Building module plottler in /home/ulrich/.var/app/org.gnome.Builder/cache/gnome-builder/flatpak-builder/build/plottler-11
========================================================================
error: pathspec 'master' did not match any file(s) known to git
Error: module plottler: Der Kindprozess wurde mit Status 1 beendet
match any file(s) known to git
Error: module plottler: Der Kindprozess wurde mit Status 1 beendet

(Last lines are german "child process failed")

1 Answer 1

2

I found out myself:

The section of the packages must not added in the main JSON-file, but in separate files. flatpak-pip-generator.py creates the resource files for the modules and theses files have to be added from the main JSON document. Mine now looks like that:

{
    "app-id": "de.gymlan.Plottler",
    "runtime": "org.gnome.Platform",
    "runtime-version": "3.32",
    "sdk": "org.gnome.Sdk",
    "command": "plottler",
    "finish-args": [
        "--share=network",
        "--share=ipc",
        "--socket=fallback-x11",
        "--socket=wayland",
        "--filesystem=xdg-run/dconf",
        "--filesystem=~/.config/dconf:ro",
        "--talk-name=ca.desrt.dconf",
        "--env=DCONF_USER_CONFIG_DIR=.config/dconf"
    ],
    "cleanup": [
        "/include",
        "/lib/pkgconfig",
        "/man",
        "/share/doc",
        "/share/gtk-doc",
        "/share/man",
        "/share/pkgconfig",
        "*.la",
        "*.a"
    ],
    "modules": [
        "python3-numpy.json",
        "python3-matplotlib.json",
        "python3-pandas.json",
        {
            "name": "plottler",
            "builddir": true,
            "buildsystem": "meson",
            "sources": [
                {
                    "type": "git",
                    "url": "file:///home/ulrich/Projekte/Plottler"
                }
            ]
        }

    ]
}

And the files "python3-*.json" reside the same directory. So all I had to do is calling

$ ./flatpak-pip-generator.py numpy
$ ./flatpak-pip-generator.py matplotlib
$ ./flatpak-pip-generator.py pandas

in the projects directory and add the generated files to the projects JSON file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.