我已按照此处的教程进行操作 https://dh-virtualenv.readthedocs.io/en/latest/tutorial.html#step-2-setup-the-debian-packaging密切相关,一切都可以正常构建和安装。
但是,我的 python 包通常会安装一些控制台脚本,我希望能够安装 .deb 以便这些命令在全局可用,即在路径上,而不是仅在虚拟环境中可用时才可用激活。
我可以将我想要的任何内容从/opt/venvs/my_package/bin/复制到/usr/bin/,或者其他类似的简单方法,可能在 postinst 文件中。
但是,我想知道是否有一种特定的方法可以构成“最佳实践”。
谢谢
最佳答案
dh_virtualenv文档建议创建符号链接(symbolic link)。
So use the
debian/«pkgname».links
file to add a symbolic link to those exectuables you want to be visible, typically the one created by your main application package.
opt/venvs/«venvname»/bin/«cmdname» usr/bin/«cmdname»
在您的控制台脚本中,更改 shebang #!
行以使用 /opt/venvs/my_package/bin
if dh_virtualenv
中的 python 可执行文件还没有。
关于python - 使用 dh_virtualenv 对 python 包进行 debianising 时,console_scripts 不在路径上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50301570/