为 debian 打包 python 程序的简单、直接的方法?

2022-01-24 00:00:00 python debian debhelper deb cdbs

问题描述

我在为 python 和 debian 分发工具的迷宫中导航时遇到了麻烦;cdbs, debhelper, python-support, python-central, blah blah blah ..

i'm having trouble navigating the maze of distribution tools for python and debian; cdbs, debhelper, python-support, python-central, blah blah blah ..

我的应用程序是一个相当简单的应用程序 - 一个单独的 python 包(包含模块和 __init__.py 的目录),一个用于运行程序的脚本(script.py) 和一些图标 (.png) 和菜单项 (.desktop 文件).

my application is a fairly straightforward one - a single python package (directory containing modules and a __init__.py), a script for running the program (script.py) and some icons (.png) and menu items (.desktop files).

在不使用上面列出的无意义工具的情况下,如何从头开始构建一个简单、干净的 .deb 文件?

from these files, how can i construct a simple, clean .deb file from scratch without using the nonsensical tools listed above?

我主要针对 ubuntu,但如果软件包在直接 debian 上工作,我会喜欢它

i'm mainly targeting ubuntu, but would like it if the package worked on straight debian


解决方案

python-stdeb 应该适合你.它在 Debian 测试/不稳定和 Ubuntu(从 Lucid 开始).apt-get install python-stdeb

python-stdeb should work for you. It's on Debian testing/unstable and Ubuntu (Lucid onwards). apt-get install python-stdeb

它与其说是一种捷径,不如说是一种尝试生成尽可能多的源代码包的工具.它实际上可以构建一个既能正常工作又几乎符合标准的包.如果您希望您的软件包符合包含在 Debian、Ubuntu 等中的质量标准,您需要填写 debian/copyright 等文件.

It is less a shortcut method than a tool that tries to generate as much of the source package as possible. It can actualy build a package that both works properly and is almost standards compliant. If you want your package to meet the quality standards for inclusion in Debian, Ubuntu, etc you will need to fill out files like debian/copyright, etc.

尽管人们声称 cdbs 真的很简单,但我想指出,尼克提到的规则文件可以很容易地用 debhelper7 完成.不要忘记,dh7 的定制比 cdbs 容易得多.

As much as people claim cdbs is really easy, I'd like to point out that the rules file Nick mentioned could easily have been done with debhelper7. Not to forget, dh7 can be customized far more easily than cdbs can.

#!/usr/bin/make -f
%:
    dh $@

注意:在提交给 Debian 之前,您应该检查您的软件包是否符合 Debian 政策、Debian Python 政策等.您实际上需要为此阅读文档 - 没有捷径.

Note: You should check whether your package meets the Debian Policy, Debian Python Policy, etc before you submit to Debian. You will actually need to read documents for that - no shortcut.

相关文章