Gentoo Development Guide

PYTHON-SINGLE-R1

Section: portage (5)
Updated: Jun 2015
Index Return to Main Contents
 

NAME

python-single-r1 - An eclass for Python packages not installed for multiple implementations.  

DESCRIPTION

An extension of the python-r1 eclass suite for packages which don't support being installed for multiple Python implementations. This mostly includes tools embedding Python.

This eclass extends the IUSE and REQUIRED_USE set by python-r1 to request the PYTHON_SINGLE_TARGET when the inheriting ebuild can be supported by more than one Python implementation. It also replaces PYTHON_USEDEP and PYTHON_DEPS with a more suitable form.

Please note that packages support multiple Python implementations (using python-r1 eclass) can not depend on packages not supporting them (using this eclass).

Please note that python-single-r1 will always inherit python-utils-r1 as well. Thus, all the functions defined there can be used in the packages using python-single-r1, and there is no need ever to inherit both.

For more information, please see the python-r1 Developer's Guide: http://www.gentoo.org/proj/en/Python/python-r1/dev-guide.xml  

FUNCTIONS

python_gen_usedep <pattern> [...]
Output a USE dependency string for Python implementations which are both in PYTHON_COMPAT and match any of the patterns passed as parameters to the function.

Remember to escape or quote the patterns to prevent shell filename expansion.

When all implementations are requested, please use ${PYTHON_USEDEP} instead. Please also remember to set an appropriate REQUIRED_USE to avoid ineffective USE flags.

Example:

PYTHON_COMPAT=( python{2_7,3_4} )
DEPEND="doc? ( dev-python/epydoc[$(python_gen_usedep 'python2*')] )"

It will cause the dependency to look like:

DEPEND="doc? ( dev-python/epydoc[python_targets_python2_7(-)?,...] )"
python_gen_useflags <pattern> [...]
Output a list of USE flags for Python implementations which are both in PYTHON_COMPAT and match any of the patterns passed as parameters to the function.

Example:

PYTHON_COMPAT=( python{2_7,3_4} )
REQUIRED_USE="doc? ( ^^ ( $(python_gen_useflags 'python2*') ) )"

It will cause the variable to look like:

REQUIRED_USE="doc? ( ^^ ( python_single_target_python2_7 ) )"
python_gen_cond_dep <dependency> <pattern> [...]
Output a list of <dependency>-ies made conditional to USE flags of Python implementations which are both in PYTHON_COMPAT and match any of the patterns passed as the remaining parameters.

In order to enforce USE constraints on the packages, verbatim specification. It will get expanded within the function into a proper USE dependency string.

Example:

PYTHON_COMPAT=( python{2_5,2_6,2_7} )
RDEPEND="$(python_gen_cond_dep \
  'dev-python/unittest2[${PYTHON_USEDEP}]' python{2_5,2_6})"

It will cause the variable to look like:

RDEPEND="python_single_target_python2_5? (
    dev-python/unittest2[python_targets_python2_5(-)?,...] )
python_single_target_python2_6? (
    dev-python/unittest2[python_targets_python2_6(-)?,...] )"
python_setup
Determine what the selected Python implementation is and set the Python build environment up for it.
python-single-r1_pkg_setup
Runs python_setup.
 

ECLASS VARIABLES

PYTHON_COMPAT (REQUIRED)
This variable contains a list of Python implementations the package supports. It must be set before the `inherit' call. It has to be an array.

Example:

PYTHON_COMPAT=( python{2_5,2_6,2_7} )
PYTHON_REQ_USE
The list of USEflags required to be enabled on the chosen Python implementations, formed as a USE-dependency string. It should be valid for all implementations in PYTHON_COMPAT, so it may be necessary to use USE defaults.

This should be set before calling `inherit'.

Example:

PYTHON_REQ_USE="gdbm,ncurses(-)?"

It will cause the Python dependencies to look like:

python_single_target_pythonX_Y? ( dev-lang/python:X.Y[gdbm,ncurses(-)?] )
PYTHON_DEPS
This is an eclass-generated Python dependency string for all implementations listed in PYTHON_COMPAT.

The dependency string is conditional on PYTHON_SINGLE_TARGET.

Example use:

RDEPEND="${PYTHON_DEPS}
dev-foo/mydep"
DEPEND="${RDEPEND}"

Example value:

dev-lang/python-exec:=
python_single_target_python2_6? ( dev-lang/python:2.6[gdbm] )
python_single_target_python2_7? ( dev-lang/python:2.7[gdbm] )
PYTHON_USEDEP
This is an eclass-generated USE-dependency string which can be used to depend on another Python package being built for the same Python implementations.

The generate USE-flag list is compatible with packages using python-r1, python-single-r1 and python-distutils-ng eclasses. It must not be used on packages using python.eclass.

Example use:

RDEPEND="dev-python/foo[${PYTHON_USEDEP}]"

Example value:

python_targets_python2_7(-)?,python_single_target_python2_7(+)?
PYTHON_REQUIRED_USE
This is an eclass-generated required-use expression which ensures the following when more than one python implementation is possible: 1. Exactly one PYTHON_SINGLE_TARGET value has been enabled. 2. The selected PYTHON_SINGLE_TARGET value is enabled in PYTHON_TARGETS.

This expression should be utilized in an ebuild by including it in REQUIRED_USE, optionally behind a use flag.

Example use:

REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"

Example value:

python_single_target_python2_6? ( python_targets_python2_6 )
python_single_target_python2_7? ( python_targets_python2_7 )
^^ ( python_single_target_python2_6 python_single_target_python2_7 )
 

AUTHORS

Author: Michał Górny <mgorny@gentoo.org>
Based on work of: Krzysztof Pawlik <nelchael@gentoo.org>
 

MAINTAINERS

Python team <python@gentoo.org>
 

REPORTING BUGS

Please report bugs via http://bugs.gentoo.org/  

FILES

/usr/portage/eclass/python-single-r1  

SEE ALSO

ebuild(5)
http://sources.gentoo.org/eclass/python-single-r1?view=log


 

Index

NAME
DESCRIPTION
FUNCTIONS
ECLASS VARIABLES
AUTHORS
MAINTAINERS
REPORTING BUGS
FILES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 03:25:06 GMT, June 30, 2015