how to properly split up into python3-foo and foo-util package?
Hey.
Maybe someone can help me with the following:
I have a little Python project that uses setuptools or packaging. Only
with pyproject.toml, no setup.py or so.
pyproject.toml specifies the build-dependencies like so:
[build-system]
requires = ["setuptools>=61.0.0", "setuptools_scm[toml]>=6.2.0"]
build-backend = "setuptools.build_meta"
There are no other external dependencies (like modules other than that
from the standard library).
The project contains a simple Python package, and pyproject.toml
specifies a number of console scripts (which it then auto-generates)
like so:
[project.scripts]
foo-util = "foo.__main__:main"
foo-util-bar = "foo.__main__:main-bar"
Building that works fine.
Now I've added Debian packaging using dh_python.
debian/rules:
$ cat rules
#!/usr/bin/make -f
%:
dh $@ --with python3 --buildsystem=pybuild
debian/control (all boring fields removed):
Source: foo
Build-Depends: debhelper-compat (= 13), dh-python, python3-all, pybuild-plugin-pyproject, python3-setuptools, python3-setuptools-scm
Package: python3-foo
Architecture: all
Depends: ${python3:Depends}, ${misc:Depends}
Package: foo-util
Architecture: all
Depends: ${python3:Depends}, ${misc:Depends}, python3-foo
When I run debuild -us -uc on that, it generates:
debian/tmp/...
debian/tmp/usr/bin/<my console scripts>
debian/tmp/usr/lib/python3.11/dist-packages/foo
debian/tmp/usr/lib/python3.11/dist-packages/foo-1.0.0.dist-info
debian/tmp/usr/lib/python3.11/dist-packages/foo-1.0.0.dist-info/LICENCE
But then complains that the files aren't installed by anyone.
Now I'd have a number of questions ;-)
1) Is there some mechanism in dh_python that would automatically split
(respectively install) the files to the two packages, and I'm just
to dumb to use it?
Like that it knows, the Python package should likely go into the
python3-* Debian package, and usr/bin stuff should likely go in the
other?
Or is it necessary (and the proper way) to have package.install
files for doing that?
2) I then tried with such package.install files like those:
foo-util.install:
usr/bin
python3-foo.install:
usr/lib
a) Why does it work to use just usr/... and not debian/tmp/usr/... ?
Actually, both seems to work, which confuses me even more ^^
b) What - if any - is the proper way here? Like I did, with one
argument?
Or should one use the two arguments per line version?
Or perhaps (for the 2nd file) rather usr/lib/python* ?
Or rather the debian/tmp/usr/ path versions?
Or using something completely different than dh_install?
3) In debian/tmp, the subdir was /python3.11/ but in the final .deb
file it's actually /python3/ (as I think it should be).
Is it expected, that first it's /python3.11/ or am I doing anything
wrong?
4) Are there way to have the Dependencies in control even more
autodetected?
a) That foo-util's dependency on python3-foo is somehow auto-filled
by dh_python?
b) Or the Build-Deps? I mean dh_python should at least be able to
find out about python3-setuptools, python3-setuptools-scm from my
pyproject.toml, shouldn't it?
5) Not really 100% Debian related, but in the Python sdist,... should
that contain the debian/*?
I found:
https://docs.python.org/3/distutils/sourcedist.html#specifying-the-files-to-distribute
but couldn't find any info on what best practises are, whether
packaging files for other packaging systems should be included or
not.
6) Last but not least, the:
debian/tmp/usr/lib/python3.11/dist-packages/foo-1.0.0.dist-info/LICENCE
It's basically just what's already in /u/s/d/python3-foo/copyright
so just eats up space.
Is it recommended to explicitly strip it somehow (how? ^^) from the
Debian package?
Thanks a lot folks :-)
Cheers,
Chris.
Reply to: