Richard Jones' Log: Sane Python application packaging: Linux
Just focusing on the Linux side for a moment.
Thanks to everyone who responded to yesterday's post about Python application packaging. My efforts will now be focused on creating files suitable for Linux package managers. This would initially be Debian software package (.deb) and Red Hat Package Manager (.rpm) - I considered Gentoo Linux's ebuild but really the audience for that is too narrow and they have tools to convert rpm and deb files to their own format.
Tasks for my application:
- I'll have to organise my install and generate meta-data files according to the two formats: Debian package basics and maintainer's guide (which may differ from Ubuntu's) and RPM package basics,
- Generate the package files: .deb via stdeb (there's also easy-deb) and .rpm using the built-in distutils bdist_rpm), and
- Host the files somewhere.
If you don't want to use stdeb or easy-deb there's a nice ShowMeDo screencast of creating a .deb for a Python program by Horst Jens.
One of the commenters mentioned above, Daniel, has already produced .deb files using stdeb. I say files because he produced one each for pyglet, cocos2d, and bruce. The docutils and pygments libraries are already available in Ubuntu's package repository.
Already I have a problem: Ubuntu also packages a version of pyglet. The pyglet version packaged is 1.0 which is quite out of date compared to the version I'd like to package, 1.1 (or even 1.2 pre-release). If I install the Ubuntu version and then try to upgrade to Daniel's version I get the rather unfriendly error:
richard@shiny:/tmp$ sudo dpkg -i python-pyglet_1.1.2-1_all.deb (Reading database ... 165323 files and directories currently installed.) Preparing to replace python-pyglet 1.0.dfsg-1 (using .../python-pyglet_1.1.2-1_all.deb) ... Unpacking replacement python-pyglet ... Setting up python-pyglet (1.1.2-1) ... pycentral: pycentral pkginstall: not overwriting local files pycentral pkginstall: not overwriting local files dpkg: error processing python-pyglet (--install): subprocess post-installation script returned error exit status 1 Processing triggers for python-support ... Errors were encountered while processing: python-pyglet
Removing the existing python-pyglet package resolves this issue of course. I don't know what the state is for other Linux distributions.
So, there's still some issues:
- There's a potential issue when a Linux distribution starts packaging bruce, pyglet and cocos2d itself. As mentioned above there's already one conflict on Ubuntu.
- I've still got an issue with compatibility. While I control the package files that's not a big deal but once the distributions start doing so I no longer have any control, and
- Is it better to require users to download .deb files or would it be better to be able to just add "deb http://pypi.python.org/debian/ pypi" to Debian's apt configuration, and whatever the similar configuration is for rpm-based systems (yum or urpmi)?
(Updated to include link to Ubuntu packaging guide)