是否有创建用于分发Python程序的Debian软件包的标准方法? [英] Is there a standard way to create Debian packages for distributing Python programs?
问题描述
有关如何执行此操作的信息很多,但由于有多种方法可以给猫皮擦" ,并且所有教程/手册都涵盖了该过程的一部分似乎做出了与其他教程不同的假设,但我仍然没有把握住这一点.
There is a ton of information on how to do this, but since "there is more than one way to skin a cat", and all the tutorials/manuals that cover a bit of the process seem to make certain assumptions which are different from other tutorials, I still didn't manage to grasp it.
到目前为止,我认为这是我所理解的.
So far this is what I think I understood.
- 我的最终目标应该是创建二进制" .deb软件包.此类软件包将与平台无关(32/64位),因为所有Python程序均是如此.
- 要创建二进制"程序包,我首先需要创建一个源程序包.
- 要创建源包,我可以使用
CDBS
或debhelper
. Debhelper是初学者的推荐方法. - 创建源程序包的核心是在源目录的
DEBIAN
目录中填充许多文件,以阐明需要复制文件的位置,它们受什么版权和许可方案,它们具有什么依赖性等. ... - 第4步可以在很大程度上自动执行
dh_make
命令,如果 Python源代码还附带了distutils的setup.py
脚本.
- My final goal should be that of creating a "binary" .deb package. Such package will be platform-independent (32/64 bit) as all Python programs are such.
- To create a "binary" package I need first to create a source package.
- To create the source package I can use either
CDBS
ordebhelper
. Debhelper is the recommended way for beginners. - The core of creating a source package is populating the
DEBIAN
directory in the source directory with a number of files clarifying where files need to be copied, what copyright and licensing scheme they are subject to, what dependencies they have, etc... - Step #4 can be largely automated the
dh_make
command if the Python source also comes with a distutils'setup.py
script.
现在我的问题:
- 我对流程的理解正确吗?我缺少什么,或者我错了吗?
- 第5步确实让我更加困惑:特别是对我来说最模糊的两点是:
- 我如何编写安装独立程序的
setup.py
脚本? 独立程序"是指一个程序旨在供桌面用户使用(与 module 相对,据我理解, module 就像是导入后其他软件将要使用的功能的集合).在我的特定情况下,我实际上需要两个这样的程序":主软件和一个单独的实用程序(实际上,第二个程序"应该与另一个程序放在同一程序包中). /li>- 这种DEB包脚本的特点是什么?官方文档似乎只涉及RPM和Windows内容...
- 我如何编写安装独立程序的
- Is my understanding of the process correct? Is there anything I am missing, or anything that I got wrong?
- Step #5 is really the more confusing to me: specifically the two points that remains most obscure to me are:
- How do I write a
setup.py
script that install a stand-alone programme? By standalone programme I mean a program intended to be used by a desktop user (as opposed to a module which I understand like a collection of functionality to be used by other software after having been imported). In my specific case I would actually need two such "programs": the main software and a separate utility (in effect a second "program" that should be in the same package with the other one). - What are the specificities of such a script for DEB packages? The official documentation only seems to deal with RPM and Windows stuff...
- How do I write a
顺便说一句:这些是到目前为止我能找到的最好的信息来源.如果您有什么比这更好的,请分享! :)
BTW: These are the best sources of information that I could find myself so far. If you have anything better than this, please share! :)
- Ubuntu的Python打包指南
- 创建.deb包从python setup.py (它显示显示步骤,但是无法解释这些步骤足以让我继续执行)
- 有关用python创建.deb程序包的ShowMeDo视频" 程序" (它似乎不是最新的,并且-如果我理解正确的话,它将生成供个人使用的软件包,而无需依赖 并且没有签名的变更日志和其他将使其与Debian策略不兼容的关键数据.
- Ubuntu's Python packaging guide
- Creating a .deb package from a python setup.py (it shows the steps, but it doesn't explain them enough for me to follow along)
- ShowMeDo video on "creating a .deb package out of a python program" (it doesn't seem up-to-date and - if I got it right - will produce packages for personal use, without dependencies and without a signed changelog and other key data that will make it incompatible with the Debian policy).
推荐答案
它看起来像 stdeb 会做您想要的.
It looks like stdeb will do what you want.
此外,对于安装脚本,我强烈建议发行版的console_scripts 入口点支持.
Also, for installing scripts, I strongly recommend distribute's console_scripts entry point support.
这篇关于是否有创建用于分发Python程序的Debian软件包的标准方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!