Gentoo Archives: gentoo-python

From: "Michał Górny" <mgorny@g.o>
To: gentoo-python@l.g.o
Cc: python@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-python] [PATCH python-utils-r1 1/2] Introduce 'PYTHON_PKG_DEP' for dependency on Python.
Date: Mon, 17 Dec 2012 00:14:21
Message-Id: 1355703239-21299-1-git-send-email-mgorny@gentoo.org
1 The function gives a complete dependency string on a particular Python
2 interpreter version, e.g.:
3
4 dev-lang/python:2.7[ncurses]
5 ---
6 gx86/eclass/python-utils-r1.eclass | 35 +++++++++++++++++++++++++++++++++++
7 1 file changed, 35 insertions(+)
8
9 diff --git a/gx86/eclass/python-utils-r1.eclass b/gx86/eclass/python-utils-r1.eclass
10 index 0f342b7..cad4bdc 100644
11 --- a/gx86/eclass/python-utils-r1.eclass
12 +++ b/gx86/eclass/python-utils-r1.eclass
13 @@ -83,6 +83,17 @@ _PYTHON_ALL_IMPLS=(
14 # /usr/lib64/python2.6/site-packages
15 # @CODE
16
17 +# @ECLASS-VARIABLE: PYTHON_PKG_DEP
18 +# @DESCRIPTION:
19 +# The complete dependency on a particular Python package as a string.
20 +#
21 +# Set and exported on request using python_export().
22 +#
23 +# Example value:
24 +# @CODE
25 +# dev-lang/python:2.7[xml]
26 +# @CODE
27 +
28 # @FUNCTION: python_export
29 # @USAGE: [<impl>] <variables>...
30 # @DESCRIPTION:
31 @@ -150,6 +161,30 @@ python_export() {
32 export PYTHON_SITEDIR=${EPREFIX}${dir}/site-packages
33 debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}"
34 ;;
35 + PYTHON_PKG_DEP)
36 + local d
37 + case ${impl} in
38 + python*)
39 + PYTHON_PKG_DEP='dev-lang/python';;
40 + jython*)
41 + PYTHON_PKG_DEP='dev-java/jython';;
42 + pypy*)
43 + PYTHON_PKG_DEP='dev-python/pypy';;
44 + *)
45 + die "Invalid implementation: ${impl}"
46 + esac
47 +
48 + # slot
49 + PYTHON_PKG_DEP+=:${impl##*[a-z-]}
50 +
51 + # use-dep
52 + if [[ ${PYTHON_REQ_USE} ]]; then
53 + PYTHON_PKG_DEP+=[${PYTHON_REQ_USE}]
54 + fi
55 +
56 + export PYTHON_PKG_DEP
57 + debug-print "${FUNCNAME}: PYTHON_PKG_DEP = ${PYTHON_PKG_DEP}"
58 + ;;
59 *)
60 die "python_export: unknown variable ${var}"
61 esac
62 --
63 1.8.0.2

Replies