[Exherbo-dev] Python improvements

Paul Seidler pl.seidler at googlemail.com
Mon Jul 18 23:55:16 BST 2011


Hello list,
I've worked the last time on a better support for python-related
packages. Aim of this work is to
a) define the python version against a package will build.
b) make it possible to support different python versions at the same
time within one package (e.g. 2.6 and 2.7).

This email is mainly to present my work on step a) but also step b) is
introduced which isn't ready yet.

a)
All this work is gone into python.exlib. It has now the following
exparam:
python_dep - This exists before but now it is necessary to specify the
hole dependency string (e.g. "python_dep="[>=2]"). I've implemented a
small check to give compatibility for old exheres.
python_sup - Specify which slots are supported (e.g. python_sup="2.7
2.6")
has_lib (bool) - Now includes dev-lang/python as dependency also if no
required version is specified.
has_bin (bool) - Same as for "has_lib".
with_opt (bool) - for packages which have a python option


How it works?
If "has_lib" is given it sets the suboptions which require exactly one
selected, except "with_opt" is selected, then this is only required if
option "python" is set. To prevent errors reported through paludis with
default option configuration, we don't depend on enabled python option
with enabled python suboption.
In the next step the dependencies are set to met "python_sup" through
the function "python_dependencies". The function "python_pkg_setup" is
exported to use the selected python version via exporting
"PYTHON" (e.g. /usr/bin/python2.6).
Else it set "PYTHON" to normal /usr/bin/python and if "has_bin" is set
it depend on any python version which met "python_dep".

The compatibility layer for the old "python_dep" version checks for an
empty string and an "[" and sets "PYTHON_DEP" to met the requirenments.

This work is nearly complete and should work fine [1], maybe some fine
tuning is needed.

b)
The work for the multibuild ability isn't updated yet and use my old
python.exlib but should work an can be found in git [2] (work to updated
it is underway. It needs to use multibuild.exlib (which needed some
modification so "." can be used within an option name and also it needs
some modification so the suboption can be called "python" without
"multibuild_"). With it the python_pkg_setup can be removed as it can
use "MULTIBUILD_PYTHON_REQUIRED_VARS". Also a new exparam is introduced:
multibuild (bool), This must be set to true if a package is able to
build with several python versions and of course the maximum for the
python suboption will be removed if this is enabled. Actually it needs
to sort "python_sup" from the highest to the lowest value.

What must be done, if this goes into master?
- Search for packages which will break (pe git)
- Porting exheres to the new "python_dep" format
- Update distutils.exlib
- Updated dependencies of packages which depend on other python
depending packages ("[python:*(-)?]")
- Update packages with a python option

Ideas:
Maybe split of the exlib in python (for export PYTHON,
PYTHONDONTWRITEBYTECODE, ...) python-lib and python-bin?
I think it would be really nifty if suboptions can be treated like
options, so that there could be an suboption python with a description
and when the option is enabled the different python versions appear and
can be enabled/disabled.

My current work is hosted here:
[1] - git://188.40.155.44/exherbo/arbor.git branch sepek
or http://dpaste.com/570267/plain/
[2] - git://188.40.155.44/exherbo/arbor.git branch multi-py
some example packages which can use the multibuild ability:
git://188.40.155.44/exherbo/gnome.git
tested with boost, pycairo, pygobject, pygtk

ps: I hope everything is understandable and not too bad English.




More information about the Exherbo-dev mailing list