flatpak-builder
flatpak-builder copied to clipboard
Add distutils support to builder
From @TingPing on June 21, 2016 9:0
Quite a lot of Python projects use distutils/setuptools and would be nice to support that. Something like:
"modules": [
{
"name": "...",
"no-autogen": true,
"distutils": true
}
]
That seems consistent with cmake. It would check for setup.py, run ./setup.py build --prefix=... and ./setup.py install --prefix=... --optimize=1 --skip-build. Though some projects don't have an exectuable setup.py so there would have to be another variable for python2 vs python3 in that case...
Copied from original issue: flatpak/flatpak#134
See also https://github.com/flatpak/flatpak/issues/39
From @bochecha on December 19, 2016 18:10
Though some projects don't have an exectuable setup.py so there would have to be another variable for python2 vs python3 in that case...
How about running $PYTHON setup.py ... instead?
The PYTHON env var could be set to /usr/bin/python2 by default, and each JSON manifest could set it to something else instead? It would even help with finding a different Python version in /app as well.
From @TingPing on December 19, 2016 22:26
Possible. @alexlarsson also mentioned the idea of a "simple" buildsystem type where you just directly give it the configure and make commands which would be sufficient for this.
Yes, having a buildsystem type that basically does nothing, but lets you list some commandlines to run, similar to post-install, or maybe even actually use post-install.
From @TheBiggerGuy on January 25, 2017 8:13
For reference I have found this the most effect pattern for Python packages.
{
"name": "cheetah",
"no-autogen": true,
"sources": [
{
"type": "archive",
"url": "https://pypi.python.org/packages/cd/b0/c2d700252fc251e91c08639ff41a8a5203b627f4e0a2ae18a6b662ab32ea/Cheetah-2.4.4.tar.gz",
"sha256": "be308229f0c1e5e5af4f27d7ee06d90bb19e6af3059794e5fd536a6f29a9b550"
}, {
"type": "shell",
"commands": [ "echo 'all:\n\ninstall:\n\tpython ./setup.py install --prefix=/app' > makefile" ]
}
]
}
Naturally full support for Python as a first class build system would be preferably. This would be ideal.
{
"name": "cheetah",
"buildsystem": "setup.py",
"sources": [
{
"type": "archive",
"url": "https://pypi.python.org/packages/cd/b0/c2d700252fc251e91c08639ff41a8a5203b627f4e0a2ae18a6b662ab32ea/Cheetah-2.4.4.tar.gz",
"sha256": "be308229f0c1e5e5af4f27d7ee06d90bb19e6af3059794e5fd536a6f29a9b550"
}
]
}
Alternatively we could have a buildsystem: "simple", which just lets you type in an array of commands to run.
From @TingPing on January 26, 2017 9:12
Python modules are fairly common to the point where a built-in option for it would be nice though.
From @bochecha on January 26, 2017 10:26
Python modules are fairly common to the point where a built-in option for it would be nice though.
Except some work with python setup.py build -j X, but others fail as they don't know this option (because distutils vs setuptools).
And some work fine when you split python setup.py build and python setup.py install --skip-build, but others don't. (e.g numpy)
Etc...
And in the future, Python modules will have a pyproject.toml file and the Python packaging will probably change a lot (started with PEP 518, but there's still lots to do), to the point where setup.py files might disappear entirely.
So maybe for now the "buildsystem": "simple" approach is still the simplest for flatpak.
Plus, it's needed for other things than Python anyway. (I'm looking at you Boost and your b2 tool)
So, who wants to do "buildsystem": "simple"? :)
From @bochecha on May 10, 2017 8:39
Should we close this now that we have the simple buildsystem?
I'm still having problems with this with more than one python module, they all want to write into easy-install.pth, but only the first one is allowed to because it's a read only file system after the first one.
I couldn't find anything in the docs to force writing into the file..
@dcbaker This should help (some modules also use setuptools.pth):
"buildsystem": "simple",
"ensure-writable": [
"/lib/python3.6/site-packages/easy-install.pth",
"/lib/python3.6/site-packages/setuptools.pth"
],
...
Thanks. I did find that option, but I hadn't thought to add setuptools.pth as well, but I'm sure I'll run into that before too much longer.