1 |
--- |
2 |
gx86/eclass/python-utils-r1.eclass | 30 ++++++++++++++++++++++++++++++ |
3 |
gx86/eclass/tests/python-utils-r1.sh | 4 ++++ |
4 |
2 files changed, 34 insertions(+) |
5 |
|
6 |
diff --git a/gx86/eclass/python-utils-r1.eclass b/gx86/eclass/python-utils-r1.eclass |
7 |
index 3a1c4ee..6cc07bd 100644 |
8 |
--- a/gx86/eclass/python-utils-r1.eclass |
9 |
+++ b/gx86/eclass/python-utils-r1.eclass |
10 |
@@ -195,6 +195,18 @@ _python_impl_supported() { |
11 |
# dev-lang/python:2.7[xml] |
12 |
# @CODE |
13 |
|
14 |
+# @ECLASS-VARIABLE: PYTHON_SCRIPTDIR |
15 |
+# @DEFAULT_UNSET |
16 |
+# @DESCRIPTION: |
17 |
+# The location where Python scripts must be installed for current impl. |
18 |
+# |
19 |
+# Set and exported on request using python_export(). |
20 |
+# |
21 |
+# Example value: |
22 |
+# @CODE |
23 |
+# /usr/lib/python-exec/python2.7 |
24 |
+# @CODE |
25 |
+ |
26 |
# @FUNCTION: python_export |
27 |
# @USAGE: [<impl>] <variables>... |
28 |
# @DESCRIPTION: |
29 |
@@ -359,6 +371,11 @@ python_export() { |
30 |
export PYTHON_PKG_DEP |
31 |
debug-print "${FUNCNAME}: PYTHON_PKG_DEP = ${PYTHON_PKG_DEP}" |
32 |
;; |
33 |
+ PYTHON_SCRIPTDIR) |
34 |
+ local dir |
35 |
+ export PYTHON_SCRIPTDIR=${EPREFIX}/usr/lib/python-exec/${impl} |
36 |
+ debug-print "${FUNCNAME}: PYTHON_SCRIPTDIR = ${PYTHON_SCRIPTDIR}" |
37 |
+ ;; |
38 |
*) |
39 |
die "python_export: unknown variable ${var}" |
40 |
esac |
41 |
@@ -475,6 +492,19 @@ python_get_LIBS() { |
42 |
echo "${PYTHON_LIBS}" |
43 |
} |
44 |
|
45 |
+# @FUNCTION: python_get_scriptdir |
46 |
+# @USAGE: [<impl>] |
47 |
+# @DESCRIPTION: |
48 |
+# Obtain and print the script install path for the given |
49 |
+# implementation. If no implementation is provided, ${EPYTHON} will |
50 |
+# be used. |
51 |
+python_get_scriptdir() { |
52 |
+ debug-print-function ${FUNCNAME} "${@}" |
53 |
+ |
54 |
+ python_export "${@}" PYTHON_SCRIPTDIR |
55 |
+ echo "${PYTHON_SCRIPTDIR}" |
56 |
+} |
57 |
+ |
58 |
# @FUNCTION: _python_rewrite_shebang |
59 |
# @USAGE: [<EPYTHON>] <path>... |
60 |
# @INTERNAL |
61 |
diff --git a/gx86/eclass/tests/python-utils-r1.sh b/gx86/eclass/tests/python-utils-r1.sh |
62 |
index d4f8dae..1e8fe1a 100755 |
63 |
--- a/gx86/eclass/tests/python-utils-r1.sh |
64 |
+++ b/gx86/eclass/tests/python-utils-r1.sh |
65 |
@@ -38,6 +38,7 @@ test_var PYTHON_SITEDIR python2_7 /usr/lib/python2.7/site-packages |
66 |
test_var PYTHON_INCLUDEDIR python2_7 /usr/include/python2.7 |
67 |
test_var PYTHON_LIBPATH python2_7 /usr/lib/libpython2.7$(get_libname) |
68 |
test_var PYTHON_PKG_DEP python2_7 dev-lang/python:2.7 |
69 |
+test_var PYTHON_SCRIPTDIR python2_7 /usr/lib/python-exec/python2.7 |
70 |
|
71 |
test_var EPYTHON python3_3 python3.3 |
72 |
test_var PYTHON python3_3 /usr/bin/python3.3 |
73 |
@@ -45,17 +46,20 @@ test_var PYTHON_SITEDIR python3_3 /usr/lib/python3.3/site-packages |
74 |
test_var PYTHON_INCLUDEDIR python3_3 /usr/include/python3.3 |
75 |
test_var PYTHON_LIBPATH python3_3 /usr/lib/libpython3.3$(get_libname) |
76 |
test_var PYTHON_PKG_DEP python3_3 dev-lang/python:3.3 |
77 |
+test_var PYTHON_SCRIPTDIR python3_3 /usr/lib/python-exec/python3.3 |
78 |
|
79 |
test_var EPYTHON jython2_7 jython2.7 |
80 |
test_var PYTHON jython2_7 /usr/bin/jython2.7 |
81 |
test_var PYTHON_SITEDIR jython2_7 /usr/share/jython-2.7/Lib/site-packages |
82 |
test_var PYTHON_PKG_DEP jython2_7 dev-java/jython:2.7 |
83 |
+test_var PYTHON_SCRIPTDIR jython2_7 /usr/lib/python-exec/jython2.7 |
84 |
|
85 |
test_var EPYTHON pypy2_0 pypy-c2.0 |
86 |
test_var PYTHON pypy2_0 /usr/bin/pypy-c2.0 |
87 |
test_var PYTHON_SITEDIR pypy2_0 /usr/lib/pypy2.0/site-packages |
88 |
test_var PYTHON_INCLUDEDIR pypy2_0 /usr/lib/pypy2.0/include |
89 |
test_var PYTHON_PKG_DEP pypy2_0 virtual/pypy:2.0 |
90 |
+test_var PYTHON_SCRIPTDIR pypy2_0 /usr/lib/python-exec/pypy-c2.0 |
91 |
|
92 |
test_is python_is_python3 python2.7 1 |
93 |
test_is python_is_python3 python3.2 0 |
94 |
-- |
95 |
1.8.3.2 |