Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH python-r1 1/8] python_export: support obtaining site-packages directory.
Date: Sat, 27 Oct 2012 11:05:19
Message-Id: 1351335771-3618-1-git-send-email-mgorny@gentoo.org
1 ---
2 gx86/eclass/python-r1.eclass | 34 ++++++++++++++++++++++++++++++++--
3 1 file changed, 32 insertions(+), 2 deletions(-)
4
5 diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
6 index 9ca0791..45ed0cb 100644
7 --- a/gx86/eclass/python-r1.eclass
8 +++ b/gx86/eclass/python-r1.eclass
9 @@ -36,6 +36,8 @@ case "${EAPI}" in
10 ;;
11 esac
12
13 +inherit multilib
14 +
15 # @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
16 # @INTERNAL
17 # @DESCRIPTION:
18 @@ -198,6 +200,16 @@ _python_set_globals
19 # python2.6
20 # @CODE
21
22 +# @ECLASS-VARIABLE: PYTHON_SITEDIR
23 +# @DESCRIPTION:
24 +# The path to Python site-packages directory.
25 +#
26 +# Set and exported on request using python_export().
27 +#
28 +# Example value:
29 +# @CODE
30 +# @CODE
31 +
32 # @FUNCTION: python_export
33 # @USAGE: [<impl>] <variables>...
34 # @DESCRIPTION:
35 @@ -209,8 +221,9 @@ _python_set_globals
36 # or an EPYTHON one, e.g. python2.7). If no implementation passed,
37 # the current one will be obtained from ${EPYTHON}.
38 #
39 -# The variables which can be exported are: PYTHON, EPYTHON. They are
40 -# described more completely in the eclass variable documentation.
41 +# The variables which can be exported are: PYTHON, EPYTHON,
42 +# PYTHON_SITEDIR. They are described more completely in the eclass
43 +# variable documentation.
44 python_export() {
45 debug-print-function ${FUNCNAME} "${@}"
46
47 @@ -247,6 +260,23 @@ python_export() {
48 export PYTHON=${EPREFIX}/usr/bin/${impl}
49 debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
50 ;;
51 + PYTHON_SITEDIR)
52 + local dir
53 + case "${impl}" in
54 + python*)
55 + dir=/usr/$(get_libdir)/${impl}
56 + ;;
57 + jython*)
58 + dir=/usr/share/${impl}/Lib
59 + ;;
60 + pypy*)
61 + dir=/usr/$(get_libdir)/${impl/-c/}
62 + ;;
63 + esac
64 +
65 + export PYTHON_SITEDIR=${EPREFIX}${dir}/site-packages
66 + debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}"
67 + ;;
68 *)
69 die "python_export: unknown variable ${var}"
70 esac
71 --
72 1.7.12.4

Replies