1

我有一个自定义 Python 包/脚本,我正在尝试为其构建一个 Debian 包。它在 Debian 11 系统上构建和安装良好。现在我还想将它打包到一台装有 Ubuntu 18.04 的机器上。

该程序使用从 Python 3.8 开始支持的注释(使用 from __future__ import ...),因此我至少需要 3.8。在 Ubuntu 18.04 上,标准 python3 是 3.6.7,但包 python3.8 提供 3.8。然而,尽管我尽了最大努力,我还是不知道如何将非默认版本指定为唯一依赖项,即告诉 debuilder 等仅依赖于 python3.8 而不是 python3(默认)。

这有可能吗?如果有,怎么办?运行这个程序所需的所有包都在标准存储库中,所以我认为应该可以正确定义依赖关系 - 不知何故。我对包装比较陌生,非常感谢任何指针(尽管我已经阅读了易于查找的文档等......)

到目前为止我尝试过的事情(仅显示 /debian/control 的相关部分):

取决于 python3 和 python3.8,没有明确指定 X-Python 版本:

/debian/控制

...
Build-Depends:
 debhelper (>= 11),
 dh-python,
 python3,
 python3.8,
 python3-setuptools
...
Depends: ${misc:Depends}, ${python3:Depends}, python3.8
...

-> 构建,但不会配置(在包安装期间),因为它使用的是 python 3.6.x

from __future__ import annotations
                                 ^
SyntaxError: future feature annotations is not defined

取决于 python3 和 python3.8,并指定 X-Python 版本

...
Build-Depends:
 debhelper (>= 11),
 dh-python,
 python3,
 python3.8,
 python3-setuptools
X-Python3-Version: >= 3.8
...
Depends: ${misc:Depends}, ${python3:Depends}, python3.8
...

-> 构建,但也不会配置(在包安装期间)

xxx depends on python3:any (>= 3.8~); however:
  Version of python3 on system is 3.6.7-1~18.04.

仅依赖python3.8,并指定X-Python版本

...
Build-Depends:
 debhelper (>= 11),
 dh-python,
 python3.8,
 python3-setuptools
X-Python3-Version: >= 3.8
...
Depends: ${misc:Depends}, ${python3:Depends}, python3.8
...

-> 构建期间的错误(缺少依赖项)

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

-> 和包安装过程中的错误

xxx depends on python3:any (>= 3.8~); however:
  Version of python3 on system is 3.6.7-1~18.04.
4

0 回答 0