Install Python 2.6 on Debian Etch

Posted by Patrice Neff Wed, 14 Jan 2009

Debian doesn’t yet have any Python 2.6 packages. But creating them on your own is very easy.

You can:

The download will disappear as soon as I see some real distribution which doesn’t take all my shortcuts.

So this are step-by-step instructions for typing in your shell.


$ curl -O
$ mv Python-2.6.1.tar.bz2 python2.6-2.6.1.tar.bz2
$ tar -xvjf python2.6-2.6.1.tar.bz2
$ mv Python-2.6.1 python2.6-2.6.1
$ cd python2.6-2.6.1/

You need to properly name the directories as “packagename-version”. In this case the package name is “python2.6” – not “python” – which is why the version seems to be repeated.

Get all the dependencies

$ sudo apt-get install fakeroot dpkg-dev
$ sudo apt-get build-dep python2.5

Create package

$ dh_make -e -f ../python2.6-2.6.1.tar.bz2
$ vi debian/control
$ vi debian/rules

Above you have to edit control and rules. The contents are below:


I just copied the dependencies from the official python2.5 package to save time.

Source: python2.6
Section: python
Priority: extra
Maintainer: Patrice Neff
Build-Depends: debhelper (>= 5), autotools-dev
Standards-Version: 3.7.2
Build-Depends: debhelper (>= 4.2), autoconf, libreadline5-dev, libncursesw5-dev (>= 5.3), tk8.4-dev, libdb4.4-dev, zlib1g-dev, libgdbm-dev, blt-dev (>= 2.4z), libssl-dev, sharutils, libbz2-dev, libbluetooth2-dev [!hurd-i386 !kfreebsd-i386 !kfreebsd-amd64], locales, libsqlite3-dev, libffi4-dev (>= 4.1.0), mime-support, libgpmg1 [!hurd-i386 !kfreebsd-i386 !kfreebsd-amd64], netbase, lsb-release, bzip2, libffi4-dev (>= 4.1.1-11) [m68k], binutils (>= 2.17-2+b2) [m68k]
Build-Depends-Indep: libhtml-tree-perl, tetex-bin, tetex-extra, texinfo, emacs21, debiandoc-sgml, sharutils

Package: python2.6
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, mime-support
Description: An interactive high-level object-oriented language (version 2.6) Version 2.6 of the high-level, interactive object oriented language, includes an extensive class library with lots of goodies for network programming, system administration, sounds and graphics.


Edit the debian/rules file. This is a Makefile used to build the package. You’ll need to add some fine-tuning to the install target.

On top after the CFLAGS add:

ROOT = $(CURDIR)/debian/python2.6/usr

Then in the install target, you need to add the contents from below.

install: build
    # .....
    $(MAKE) prefix=$(CURDIR)/debian/python2.6/usr install

# START from here # Remove python, we’ll only have python2.6 rm $(ROOT)/bin/python{,-config} mv $(ROOT)/share/man/man1/{python,python2.6}.1 # Remove stuff we don’t need rm $(ROOT)/bin/{idle,2to3,pydoc,} rm -r $(ROOT)/lib/python2.6/test # END until here

Build package

You can now compile and install this package.

$ dpkg-buildpackage -rfakeroot
$ sudo dpkg -i ../python*.deb