python到debian包转换器

py2deb的Python项目详细描述


https://travis-ci.org/paylogic/py2deb.svg?branch=masterhttps://coveralls.io/repos/paylogic/py2deb/badge.svg?branch=master

python包将python源发行版转换为debian 二进制软件包(用于安装的软件包)。它使用pip-accel来 下载、解包和编译python包。因此,py2deb 与pip install命令的命令行接口兼容。为了 示例可以将要转换的包指定为命令行参数,但是 如果需要,也可以使用requirement files

在转换过程中,会自动考虑依赖关系 也可以转换,这样实际上就不必使用需求文件 包括传递依赖项。事实上,你可能更喜欢不显式地 在需求文件中列出可传递的依赖项,因为py2deb将 将python包的版本约束转换为debian包 关系。

目前,py2deb包在CPython2.6、2.7、3.4、3.5、3.6上测试 以及3.7和PyPy。有关使用说明,请参阅文档 主持于Read The Docs

Installation

py2deb包在PyPI上提供,因此安装非常简单:

$ pip install py2deb

您还必须安装一些系统依赖项:

$ sudo apt-get install dpkg-dev fakeroot

也可以选择安装Lintian(这不是一个硬依赖项,但是 更多的“美好的拥有”:

$ sudo apt-get install lintian

安装林寻后,会自动运行进行健康检查 转换包。这在一定程度上减缓了转换过程,但可以 非常有用,尤其是在处理py2deb本身时。目前py2deb没有 当林寻报错时失败,这是由于 可以使用py2deb。随着py2deb变得越来越多,这种情况在未来可能会改变。 成熟。

Usage

有两种方法可以使用py2deb包:作为命令行程序 py2deb和作为python api。有关python api的详细信息,请参阅 保存在Read the Docs上的api文档。命令行界面 如下所述。

Command line

用法:py2deb[options]…

根据给定的 命令行选项(见下文)。命令行参数是 与“pip install”命令接受的相同,因为py2deb调用 转换过程中的PIP。这意味着您可以命名 要在命令行上转换的包,但也可以使用 “需求文件”如果你愿意的话。

如果要将命令行选项传递给pip(例如 要使用自定义索引url或需求文件),则需要 告诉py2deb py2deb的选项在哪里停止以及 PIP开始。在这种情况下,您可以使用以下语法:

$ py2deb -r /tmp -- -r requirements.txt

因此“–”标记将py2deb选项与pip选项分开。

支持的选项:

OptionDescription
^{tt3}$, ^{tt4}$

Load a configuration file. Because the command line arguments are processed in the given order, you have the choice and responsibility to decide if command line options override configuration file options or vice versa. Refer to the documentation for details on the configuration file format.

The default configuration files /etc/py2deb.ini and ~/.py2deb.ini are automatically loaded if they exist. This happens before environment variables and command line options are processed.

Can also be set using the environment variable ^{tt5}$.

^{tt6}$, ^{tt7}$

Change the directory where *.deb archives are stored. Defaults to the system wide temporary directory (which is usually /tmp). If this directory doesn’t exist py2deb refuses to run.

Can also be set using the environment variable ^{tt8}$.

^{tt9}$Exclude a Python package (the name before the comma) from conversion and replace references to the Python package with a specific Debian package name. This allows you to use system packages for specific Python requirements.
^{tt10}$

Set the name prefix used during the name conversion from Python to Debian packages. Defaults to “python”. The name prefix and package names are always delimited by a dash.

Can also be set using the environment variable ^{tt11}$.

^{tt12}$Exclude a Python package from having the name prefix applied during the package name conversion. This is useful to avoid awkward repetitions.
^{tt13}$Override the package name conversion algorithm for the given pair of package names. Useful if you don’t agree with the algorithm :-)
^{tt14}$

Override the default system wide installation prefix. By setting this to anything other than “/usr” or “/usr/local” you change the way py2deb works. It will build packages with a file system layout similar to a Python virtual environment, except there will not be a Python executable: The packages are meant to be loaded by modifying Python’s module search path. Refer to the documentation for details.

Can also be set using the environment variable ^{tt15}$.

^{tt16}$Use Debian’s “update-alternatives” system to add an executable that’s installed in a custom installation prefix (see above) to the system wide executable search path. Refer to the documentation for details.
^{tt17}$

Set a Python callback to be called during the conversion process. Refer to the documentation for details about the use of this feature and the syntax of ^{tt18}$.

Can also be set using the environment variable ^{tt19}$.

^{tt20}$Add the Debian relationships needed to depend on the converted package(s) to the given control file. If the control file already contains relationships the additional relationships will be added to the control file; they won’t overwrite existing relationships.
^{tt21}$, ^{tt22}$

Instruct pip-accel to automatically install build time dependencies where possible. Refer to the pip-accel documentation for details.

Can also be set using the environment variable ^{tt23}$.

^{tt24}$, ^{tt25}$Make more noise :-).
^{tt26}$, ^{tt27}$Show this message and exit.

Future improvements

对py2deb可能的改进的一些随机想法(没有特定的顺序):

  • 找到一种方法来促进(显式/可选)系统范围内的安装 基于python发行版的文件(与python本身无关)?这个 可以显著减少基本上 只需拉入由py2deb转换的包并删除一些配置文件 就位。
  • 研究了二元轮支承转换的可行性。慢慢地 但是,python社区似乎正被(二进制)所吸引。 轮子和一旦重力已经转移,我们不想留在尘埃里!;-)
  • 使在需求集中“替换”python需求成为可能 包含在正式存储库中的debian包(例如Pillow 变成python-imaging或者python-pil)。有一些毛茸茸的细节 参与其中。
  • 深入PEP-440看看是否有办法完全支持它?那么this question on Reddit最终可以得到一个令人满意的答案:-)。

Similar projects

有几个项目与py2deb有相似之处,因为 我知道的例子有stdebdh-virtualenvfpm。文档包括 对每个项目来说都是公平的detailed comparison

Contact

最新版本的py2deb可以在PyPIGitHub上找到。这个 文档位于Read the Docs上,并包含一个changelog。为了 问题、错误报告、建议等。请在GitHub上创建问题。

License

此软件是根据MIT license授权的。

©2018彼得·奥丁,阿扬·韦尔尔和Paylogic国际。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Spring 4升级后未加载java应用程序上下文   java Android 2.3.3 internet可以在我的Galaxy S上运行,但不能在我的Galaxy选项卡上运行?(许可?)   java通过不改变其原始位置对大小写字母进行排序   java Spring Boot一直在破坏我的电脑。。。sts的最佳配置是什么。Windows 10上的ini文件?   css Java Spring+引导问题   java Jackson将GeoJsonPoint序列化为纬度/经度   xml Java Transformer:如何将其结果生成OutputStream?   java如何更改字体、文本大小和设置文本位置?   在JavaSpringHibernate3.6.3中,如何告诉一个方法等待,直到获得锁,以及如何重试失败的事务?   java安卓服务代替线程   Java Swing使用鼠标移动JFrame