USE_PYTHON in /etc/make.conf 2010-11-14

Some packages in Gentoo support being installed for several Python versions at the same time. One of these packages is dev-python/pyinotify. If you look at the ebuild (file /usr/portage/dev-python/pyinotify/pyinotify-0.9.1.ebuild) you stumble upon these lines:


These lines tell that pyinotify 0.9.1  is expected to handle Python 2.5, 2.6, 2.7 and 3.0, 3.1, and 3.2. They are discussed in detail in the Gentoo Python Developers Guide.

When installing pyinotify 0.9.1 with no USE_PYTHON line in /etc/make.conf by default you will get files for the active version of Python 2.x and Python 3.x. This line of the python eclass (file /usr/portage/eclass/python.eclass) is responsible:

PYTHON_ABIS="${python2_version} ${python3_version}"

There is three different active versions of python in Gentoo: one active version for 2.x and 3.x and third, a main active version from either pool, 2.6 in my case. These commands are meant to illustrate this:

# eselect python list --python2
Available Python 2 interpreters:
[1]   python2.6 *
[2]   python2.7

# eselect python list --python3
Available Python 3 interpreters:
[1]   python3.1 *

# eselect python list
Available Python interpreters:
[1]   python2.6 *
[2]   python2.7
[3]   python3.1

So with no specification of USE_PYTHON in /etc/make.conf I would get pyinotify installed for Python 2.6 and python 3.1. As I want to have support for Python 2.7 too, I have this line in my /etc/make.conf:

USE_PYTHON="2.6 2.7 3.1"

This is what it gets me:

# equery f dev-python/pyinotify | grep site-packages

NOTE: After changing USE_PYTHON, don’t forget to run python-updater! It will rebuild packages that have too little (or too much) support for Python in its current form of installation.

Besides, did I mention the Python team is lacking man and woman power?

Ross November 15th, 2010

Where would an interested python user begin joining the python team?

Gilles Dartiguelongue November 15th, 2010

Communicating about this feature is nice, too bad it isn’t ready to be used for real yet.

Gilles Dartiguelongue November 15th, 2010

Tons of packages are actually failing to support more than one python installation at a time. The problem has multiple aspects, let’s enumerate some:
* package only use python for generating some code at build time but fails to configure with eselected python
* package only use python for generating some code at build time but fails to build with eselected python
* package installs public python modules only installs for eselected python
* package installs public C modules but fails to link to eselected python
* package installs scripts but does not have a proper shebang so it fails at runtime with eselected python
* and on and on

gnome herd has a lot of such packages even though we did a great job fixing gnome 2.32. We are far from done, even for the simplest cases. Sure fixing the packages is most of the time not that complicated, it’s just a really long job and given the reactions (confusion) on gentoo-dev about trying to work on that (and not on python3, to be clear), I’m ready to bet that advertising this feature now, is only going to result in bug spam and increased developers blood pressure.

oleg February 29th, 2012


Leave a Reply

You must be logged in to post a comment.