diff options
author | Michał Górny <mgorny@gentoo.org> | 2015-11-07 20:30:24 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2015-11-11 11:21:25 +0100 |
commit | fd4001e9682ed11db9f6b2cf87f3e89ed291fe02 (patch) | |
tree | 1e94d7037e014066896bfe35902f739058bf4f63 /eclass/python-utils-r1.eclass | |
parent | python-utils-r1.eclass: Obtain library path from the interpreter (diff) | |
download | gentoo-fd4001e9682ed11db9f6b2cf87f3e89ed291fe02.tar.gz gentoo-fd4001e9682ed11db9f6b2cf87f3e89ed291fe02.tar.bz2 gentoo-fd4001e9682ed11db9f6b2cf87f3e89ed291fe02.zip |
python-utils-r1.eclass: Obtain PYTHON_SITEDIR from the interpreter
Obtain the Python site-packages directory path using
the distutils.sysconfig module, rather than hardcoding it.
Diffstat (limited to 'eclass/python-utils-r1.eclass')
-rw-r--r-- | eclass/python-utils-r1.eclass | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index ec85d8aee61d..e8de6b9fd1e8 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -126,6 +126,7 @@ _python_impl_supported() { # The path to Python site-packages directory. # # Set and exported on request using python_export(). +# Requires a proper build-time dependency on the Python implementation. # # Example value: # @CODE @@ -267,17 +268,10 @@ python_export() { debug-print "${FUNCNAME}: PYTHON = ${PYTHON}" ;; PYTHON_SITEDIR) - local dir - case "${impl}" in - python*|pypy|pypy3) - dir=/usr/$(get_libdir)/${impl} - ;; - jython*) - dir=/usr/share/${impl/n/n-}/Lib - ;; - esac - - export PYTHON_SITEDIR=${EPREFIX}${dir}/site-packages + # sysconfig can't be used because: + # 1) pypy doesn't give site-packages but stdlib + # 2) jython gives paths with wrong case + export PYTHON_SITEDIR=$("${PYTHON}" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())') debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}" ;; PYTHON_INCLUDEDIR) |