简体   繁体   English

创建Python RPM

[英]Creating Python RPM

I have been reading about creating an RPM for Python 2.6.4. 我一直在阅读有关为Python 2.6.4创建RPM的文章。 In this page: http://docs.python.org/distutils/builtdist.html it says you can create an RPM of the current Python using python setup.py bdist_rpm . 在这个页面中: httppython setup.py bdist_rpm它说你可以使用python setup.py bdist_rpm创建当前Python的RPM。 The question's I have are: 我的问题是:

  • Do you have to type this command in your Python installation directory? 您是否必须在Python安装目录中键入此命令?
  • Does this command, package all the modules you have installed into the RPM? 此命令是否将已安装的所有模块打包到RPM中?
  • Is this the correct command to do this? 这是正确的命令吗?
  • Are there any other suggestion's that would make this easier? 还有其他建议可以让这更容易吗?

Okay I sorted this out using checkinstall. 好吧,我使用checkinstall对此进行了排序。

I downloaded checkinstall from http://www.asic-linux.com.mx/~izto/checkinstall/ . 我从http://www.asic-linux.com.mx/~izto/checkinstall/下载了checkinstall

I then installed the package but had to enter /usr/local/sbin/checkinstall into my PATH to make it work. 然后我安装了软件包,但必须在我的PATH中输入/usr/local/sbin/checkinstall才能使其正常工作。 I then entered the next copmmand to get my RPM directory going. 然后我进入下一个copmmand以获取我的RPM目录。

 yum install rpm-build

I then cd into the Python module and entered this command: 然后,我cd到Python模块,进入下面的命令:

 checkinstall -R --nodoc --delspec=no  --exclude=/selinux python2.6 ./setup.py install

This command replaces the command checkinstall as your installing python libraries through setup.py instead of an ordinary make. 此命令将命令checkinstall替换为通过setup.py而不是普通make安装python库。

I then went through the checkinstall process. 然后我完成了checkinstall过程。 The finished RPM was placed into /usr/src/redhat/RPMS/i386/ . 完成的RPM放在/usr/src/redhat/RPMS/i386/

Note: THIS IS FOR LINUX RED HAT. 注意:这是LINUX RED HAT。

  1. This command has to be typed wherever your setup.py is located. 必须在setup.py所在的任何位置键入此命令。
  2. It packages everything that would show up in a bdist tarball. 它将打包出现在bdist tarball中的所有内容打包。
  3. Err... sort of. 呃......有点儿。 While it works, the package it creates is not of very high quality. 虽然它有效但它创建的包装质量不是很高。 It's better to use sdist_rpm , then unpack the resulting SRPM and then apply your distro's Python packaging guidelines to the generated spec file. 最好使用sdist_rpm ,然后解压缩生成的SRPM,然后将发行版的Python打包指南应用于生成的spec文件。
  4. Get it to work via bdist first. 首先通过bdist让它工作。 That way any issues that crop up will be more manageable. 这样,任何突出的问题都会更易于管理。

These instructions explain how to create an RPM package for your module. 这些说明解释了如何为模块创建RPM包。 As far as I know, there is no (easy) way to package all your Python installation into an RPM. 据我所知,没有(简单)方法将所有Python安装打包到RPM中。

If you want to create an RPM package to install Python 2.6.4 on an older distro, you download the Python 2.6.4 source RPM and then rebuild it with rpmbuild . 如果要创建RPM包以在较旧的发行版上安装Python 2.6.4,请下载Python 2.6.4源RPM,然后使用rpmbuild重建它。 See Fedora RPM Guide . 请参阅Fedora RPM指南

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM