diff options
author | Michał Górny <mgorny@gentoo.org> | 2012-12-20 23:35:17 +0000 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2012-12-20 23:35:17 +0000 |
commit | 0ec3738a167f4cc4ed91987dee3d74bc05b9f344 (patch) | |
tree | 451e9490bd6fca674fe376ce4b93854723285280 /eclass/python-utils-r1.eclass | |
parent | Migrate to distutils-r1. Make tests actually fail. (diff) | |
download | gentoo-2-0ec3738a167f4cc4ed91987dee3d74bc05b9f344.tar.gz gentoo-2-0ec3738a167f4cc4ed91987dee3d74bc05b9f344.tar.bz2 gentoo-2-0ec3738a167f4cc4ed91987dee3d74bc05b9f344.zip |
Commonize the code for obtaining the Python interpreter dependency string.
Diffstat (limited to 'eclass/python-utils-r1.eclass')
-rw-r--r-- | eclass/python-utils-r1.eclass | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 1e523b282269..afa478b19a9e 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2012 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.8 2012/12/20 06:05:23 floppym Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.9 2012/12/20 23:35:17 mgorny Exp $ # @ECLASS: python-utils-r1 # @MAINTAINER: @@ -83,6 +83,17 @@ _PYTHON_ALL_IMPLS=( # /usr/lib64/python2.6/site-packages # @CODE +# @ECLASS-VARIABLE: PYTHON_PKG_DEP +# @DESCRIPTION: +# The complete dependency on a particular Python package as a string. +# +# Set and exported on request using python_export(). +# +# Example value: +# @CODE +# dev-lang/python:2.7[xml] +# @CODE + # @FUNCTION: python_export # @USAGE: [<impl>] <variables>... # @DESCRIPTION: @@ -150,6 +161,30 @@ python_export() { export PYTHON_SITEDIR=${EPREFIX}${dir}/site-packages debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}" ;; + PYTHON_PKG_DEP) + local d + case ${impl} in + python*) + PYTHON_PKG_DEP='dev-lang/python';; + jython*) + PYTHON_PKG_DEP='dev-java/jython';; + pypy*) + PYTHON_PKG_DEP='dev-python/pypy';; + *) + die "Invalid implementation: ${impl}" + esac + + # slot + PYTHON_PKG_DEP+=:${impl##*[a-z-]} + + # use-dep + if [[ ${PYTHON_REQ_USE} ]]; then + PYTHON_PKG_DEP+=[${PYTHON_REQ_USE}] + fi + + export PYTHON_PKG_DEP + debug-print "${FUNCNAME}: PYTHON_PKG_DEP = ${PYTHON_PKG_DEP}" + ;; *) die "python_export: unknown variable ${var}" esac |