Difference between revisions of "Python"
Revision as of 11:32, June 24, 2012
Python is a scripting language as well as a high-level programming language, and is used extensively by Funtoo and Gentoo Linux. Portage, the ports system used by Funtoo and Gentoo Linux, is written in Python (along with bash-based ebuilds.)
Funtoo Linux contains many enhancements related to Python, and most of these enhancements are the result of integrating the Progress Overlay into Funtoo Linux. This new functionality allows Portage to do a much, much better job of keeping Python-based packages up-to-date on your system.
Prior Issues in Gentoo/Funtoo
With the older python.eclass in Gentoo (and that used to be in Funtoo Linux,) no usable accounting information is stored by Portage so that it could "know" what versions of Python various ebuilds were built to use. This created a problem when new versions of Python were installed, as Portage didn't have the ability to automatically update Python-based packages to work with newer versions of Python that were installed.
This created the need for a separate tool, called python-updater</tt,> which was used to rebuild all Python-related ebuilds so that they properly utilize the currently-installed versions of Python.
Progress in Funtoo
The new Progress Overlay that has been integrated into Funtoo Linux goes a very long way towards solving the prior problems that existed when dealing with Python-based packages/ebuilds. The Progress Overlay adds two important things. The first is a new eclass that allows new Python-related ebuilds to be written in a way so that Portage can understand what versions of Python they were built against.
By being integrated into Funtoo Linux, Progress Overlay also offers Funtoo Linux users hundreds of updated ebuilds. Hundreds (over four hundred) ebuilds that interact with Python in some way have been enhanced to take advantage of the new Python eclass. These new enhancements allow Portage to do what <tt>python-updater used to do for you -- keep your system up-to-date and all dependencies satisfied, even in the case where you may upgrade or change Python versions installed on your system.
How To Use It
You don't need to do anything special to take advantage of the new Python functionality from Progress Overlay. It is already integrated into your Portage tree and is working for you behind the scenes to keep Python-related packages working properly.
The new Python functionality uses a special configuration variable called PYTHON_ABIS. By default, PYTHON_ABIS is set to "2.7 3.2" in Funtoo Linux profiles. This setting tells Portage that by default, any Python-related ebuilds should be built so that they can be used with both python-2.7 and python-3.2, if the ebuilds are compatible and will run using these versions of Python. If an ebuild doesn't support python-3.2, for example, Portage will still ensure that a python-2.7-compatible version of the package is installed. If an ebuild supports both versions, then special steps will be taken to install two separate sets of python modules and binaries, in order to ensure full compatibility with either Python interpreter.
If you'd like to change PYTHON_ABIS, simply overwrite the setting in /etc/make.conf as follows:
PYTHON_ABIS="2.6 2.7 3.2"
This is useful if you would like Portage to target other Python ABIs (like jython, for example, or 2.6) that you might be interested in. The new setting above would tell Portage to also ensure that Python-related ebuilds are built against python-2.6 as well as python-2.7 and 3.2.
For more information, see:
- Progress Overlay Python - this page contains detailed developer documentation about the new Progess Overlay functionality, and how to write new-style Python-related ebuilds that take advantage of new Progress functionality.