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:
PYTHON_DEPEND="*:2.5" SUPPORT_PYTHON_ABIS="1" RESTRICT_PYTHON_ABIS="2.4"
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:
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:  python2.6 *  python2.7 # eselect python list --python3 Available Python 3 interpreters:  python3.1 * # eselect python list Available Python interpreters:  python2.6 *  python2.7  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 /usr/lib64/python2.6/site-packages /usr/lib64/python2.6/site-packages/pyinotify-0.9.1-py2.6.egg-info /usr/lib64/python2.6/site-packages/pyinotify.py /usr/lib64/python2.7/site-packages /usr/lib64/python2.7/site-packages/pyinotify-0.9.1-py2.7.egg-info /usr/lib64/python2.7/site-packages/pyinotify.py /usr/lib64/python3.1/site-packages /usr/lib64/python3.1/site-packages/pyinotify-0.9.1-py3.1.egg-info /usr/lib64/python3.1/site-packages/pyinotify.py
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?
USE_PYTHON in /etc/make.conf by Sebastian Pipping, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.