I have a custom Python package/script for which I am trying to build a Debian package. It builds and installs fine on a Debian 11 system. Now I also want to package it for a machine with Ubuntu 18.04 on it.
The program is using annotations which are supported from Python 3.8 onwards (with from __future__ import ...), hence I need at least 3.8. On Ubuntu 18.04 the standard python3 is 3.6.7, but the package python3.8 provides 3.8. However, despite my best efforts, I just can't figure out how to specify the non-default version as a sole dependency, i.e. tell debuilder etc. to only depend on python3.8 and NOT on python3 (default).
Is this somehow possible and if so how? All packages needed to run this program are in the standard repositories, so I figure it should be possible to define the dependencies correctly - somehow. I am relatively new to packaging and any pointers are much appreciated (although I have read the easy-to-find documentation and such...)
Things that I have tried up to now (only the relevant parts of /debian/control are shown):
Depending on python3 and python3.8, not explicitly specifying X-Python version:
/debian/control
...
Build-Depends:
debhelper (>= 11),
dh-python,
python3,
python3.8,
python3-setuptools
...
Depends: ${misc:Depends}, ${python3:Depends}, python3.8
...
-> builds, but won't configure (during package install) as it is using python 3.6.x
from __future__ import annotations
^
SyntaxError: future feature annotations is not defined
Depending on python3 and python3.8, and specifying X-Python version
...
Build-Depends:
debhelper (>= 11),
dh-python,
python3,
python3.8,
python3-setuptools
X-Python3-Version: >= 3.8
...
Depends: ${misc:Depends}, ${python3:Depends}, python3.8
...
-> builds, but also won't configure (during package install)
xxx depends on python3:any (>= 3.8~); however:
Version of python3 on system is 3.6.7-1~18.04.
Only depending on python3.8, and specifying X-Python version
...
Build-Depends:
debhelper (>= 11),
dh-python,
python3.8,
python3-setuptools
X-Python3-Version: >= 3.8
...
Depends: ${misc:Depends}, ${python3:Depends}, python3.8
...
-> errors during build (missing dependency)
E: xxx source: missing-build-dependency-for-dh-addon python3 => python3:any | python3-all:any | python3-dev:any | python3-all-dev:any
E: xxx source: missing-python-build-dependency
E: xxx source: missing-python-build-dependency
-> and errors during package install
xxx depends on python3:any (>= 3.8~); however:
Version of python3 on system is 3.6.7-1~18.04.