summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2013-09-17 13:25:58 +0000
committerMichał Górny <mgorny@gentoo.org>2013-09-17 13:25:58 +0000
commit068961c10464630e9c12c270ff188f046fb7e541 (patch)
treee35ded591eb0f72e5149210f27dad94ea53580b2 /eclass
parentClean up Python script install/wrapping functions. (diff)
downloadgentoo-2-068961c10464630e9c12c270ff188f046fb7e541.tar.gz
gentoo-2-068961c10464630e9c12c270ff188f046fb7e541.tar.bz2
gentoo-2-068961c10464630e9c12c270ff188f046fb7e541.zip
Introduce PYTHON_SCRIPTDIR for python-exec:2 script location.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog6
-rw-r--r--eclass/python-utils-r1.eclass32
-rwxr-xr-xeclass/tests/python-utils-r1.sh4
3 files changed, 40 insertions, 2 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index bf0f1799ae61..d5157e4354c2 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for eclass directory
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.968 2013/09/17 13:24:39 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.969 2013/09/17 13:25:58 mgorny Exp $
+
+ 17 Sep 2013; Michał Górny <mgorny@gentoo.org> python-utils-r1.eclass,
+ tests/python-utils-r1.sh:
+ Introduce PYTHON_SCRIPTDIR for python-exec:2 script location.
17 Sep 2013; Michał Górny <mgorny@gentoo.org> distutils-r1.eclass,
python-r1.eclass, python-utils-r1.eclass:
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 0e4ab60a579f..81acea2b9294 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.36 2013/09/17 13:24:39 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.37 2013/09/17 13:25:58 mgorny Exp $
# @ECLASS: python-utils-r1
# @MAINTAINER:
@@ -195,6 +195,18 @@ _python_impl_supported() {
# dev-lang/python:2.7[xml]
# @CODE
+# @ECLASS-VARIABLE: PYTHON_SCRIPTDIR
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# The location where Python scripts must be installed for current impl.
+#
+# Set and exported on request using python_export().
+#
+# Example value:
+# @CODE
+# /usr/lib/python-exec/python2.7
+# @CODE
+
# @FUNCTION: python_export
# @USAGE: [<impl>] <variables>...
# @DESCRIPTION:
@@ -359,6 +371,11 @@ python_export() {
export PYTHON_PKG_DEP
debug-print "${FUNCNAME}: PYTHON_PKG_DEP = ${PYTHON_PKG_DEP}"
;;
+ PYTHON_SCRIPTDIR)
+ local dir
+ export PYTHON_SCRIPTDIR=${EPREFIX}/usr/lib/python-exec/${impl}
+ debug-print "${FUNCNAME}: PYTHON_SCRIPTDIR = ${PYTHON_SCRIPTDIR}"
+ ;;
*)
die "python_export: unknown variable ${var}"
esac
@@ -483,6 +500,19 @@ python_get_LIBS() {
echo "${PYTHON_LIBS}"
}
+# @FUNCTION: python_get_scriptdir
+# @USAGE: [<impl>]
+# @DESCRIPTION:
+# Obtain and print the script install path for the given
+# implementation. If no implementation is provided, ${EPYTHON} will
+# be used.
+python_get_scriptdir() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ python_export "${@}" PYTHON_SCRIPTDIR
+ echo "${PYTHON_SCRIPTDIR}"
+}
+
# @FUNCTION: _python_rewrite_shebang
# @USAGE: [<EPYTHON>] <path>...
# @INTERNAL
diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh
index d4f8dae96d43..1e8fe1a0a67c 100755
--- a/eclass/tests/python-utils-r1.sh
+++ b/eclass/tests/python-utils-r1.sh
@@ -38,6 +38,7 @@ test_var PYTHON_SITEDIR python2_7 /usr/lib/python2.7/site-packages
test_var PYTHON_INCLUDEDIR python2_7 /usr/include/python2.7
test_var PYTHON_LIBPATH python2_7 /usr/lib/libpython2.7$(get_libname)
test_var PYTHON_PKG_DEP python2_7 dev-lang/python:2.7
+test_var PYTHON_SCRIPTDIR python2_7 /usr/lib/python-exec/python2.7
test_var EPYTHON python3_3 python3.3
test_var PYTHON python3_3 /usr/bin/python3.3
@@ -45,17 +46,20 @@ test_var PYTHON_SITEDIR python3_3 /usr/lib/python3.3/site-packages
test_var PYTHON_INCLUDEDIR python3_3 /usr/include/python3.3
test_var PYTHON_LIBPATH python3_3 /usr/lib/libpython3.3$(get_libname)
test_var PYTHON_PKG_DEP python3_3 dev-lang/python:3.3
+test_var PYTHON_SCRIPTDIR python3_3 /usr/lib/python-exec/python3.3
test_var EPYTHON jython2_7 jython2.7
test_var PYTHON jython2_7 /usr/bin/jython2.7
test_var PYTHON_SITEDIR jython2_7 /usr/share/jython-2.7/Lib/site-packages
test_var PYTHON_PKG_DEP jython2_7 dev-java/jython:2.7
+test_var PYTHON_SCRIPTDIR jython2_7 /usr/lib/python-exec/jython2.7
test_var EPYTHON pypy2_0 pypy-c2.0
test_var PYTHON pypy2_0 /usr/bin/pypy-c2.0
test_var PYTHON_SITEDIR pypy2_0 /usr/lib/pypy2.0/site-packages
test_var PYTHON_INCLUDEDIR pypy2_0 /usr/lib/pypy2.0/include
test_var PYTHON_PKG_DEP pypy2_0 virtual/pypy:2.0
+test_var PYTHON_SCRIPTDIR pypy2_0 /usr/lib/python-exec/pypy-c2.0
test_is python_is_python3 python2.7 1
test_is python_is_python3 python3.2 0