summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>2009-08-31 00:07:37 +0000
committerArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>2009-08-31 00:07:37 +0000
commit1bc413a96a60abb4ab8437ec304ddb8af8a79525 (patch)
treeef6b76a0b4ec7345eab90d2d5ecca1067cb81a30 /eclass/python.eclass
parentsquid-2.7.6-r2 squid-3.0.18-r1 ppc64 for bug 279380 (diff)
downloadgentoo-2-1bc413a96a60abb4ab8437ec304ddb8af8a79525.tar.gz
gentoo-2-1bc413a96a60abb4ab8437ec304ddb8af8a79525.tar.bz2
gentoo-2-1bc413a96a60abb4ab8437ec304ddb8af8a79525.zip
Improve validate_PYTHON_ABIS().
Diffstat (limited to 'eclass/python.eclass')
-rw-r--r--eclass/python.eclass41
1 files changed, 27 insertions, 14 deletions
diff --git a/eclass/python.eclass b/eclass/python.eclass
index d0d5aaac913a..690a4efa057a 100644
--- a/eclass/python.eclass
+++ b/eclass/python.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.67 2009/08/29 02:15:24 arfrever Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.68 2009/08/31 00:07:37 arfrever Exp $
# @ECLASS: python.eclass
# @MAINTAINER:
@@ -130,28 +130,41 @@ validate_PYTHON_ABIS() {
if [[ -z "${PYTHON_ABIS}" ]] && has "${EAPI:-0}" 0 1 2 3; then
local ABI support_ABI supported_PYTHON_ABIS= restricted_ABI
PYTHON_ABI_SUPPORTED_VALUES="2.4 2.5 2.6 2.7 3.0 3.1 3.2"
- for ABI in ${USE_PYTHON}; do
- if ! has "${ABI}" ${PYTHON_ABI_SUPPORTED_VALUES}; then
- ewarn "Ignoring unsupported Python ABI '${ABI}'"
- continue
+
+ if declare -p | grep "^declare -x USE_PYTHON=" > /dev/null; then
+ if [[ -z "${USE_PYTHON}" ]]; then
+ die "USE_PYTHON variable is empty"
fi
- support_ABI="1"
- if [[ -z "${IGNORE_RESTRICT_PYTHON_ABIS}" ]]; then
+
+ for ABI in ${USE_PYTHON}; do
+ if ! has "${ABI}" ${PYTHON_ABI_SUPPORTED_VALUES}; then
+ die "USE_PYTHON variable contains invalid value '${ABI}'"
+ fi
+ support_ABI="1"
for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do
if python -c "from fnmatch import fnmatch; exit(not fnmatch('${ABI}', '${restricted_ABI}'))"; then
support_ABI="0"
break
fi
done
+ [[ "${support_ABI}" == "1" ]] && supported_PYTHON_ABIS+=" ${ABI}"
+ done
+ export PYTHON_ABIS="${supported_PYTHON_ABIS# }"
+
+ if [[ -z "${PYTHON_ABIS//[${IFS}]/}" ]]; then
+ die "USE_PYTHON variable doesn't enable any Python version supported by ${CATEGORY}/${PF}"
fi
- [[ "${support_ABI}" == "1" ]] && supported_PYTHON_ABIS+=" ${ABI}"
- done
- export PYTHON_ABIS="${supported_PYTHON_ABIS# }"
- fi
+ else
+ local restricted_ABI
+ python_version
- if [[ -z "${PYTHON_ABIS//[${IFS}]/}" ]]; then
- python_version
- export PYTHON_ABIS="${PYVER}"
+ for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do
+ if python -c "from fnmatch import fnmatch; exit(not fnmatch('${PYVER}', '${restricted_ABI}'))"; then
+ die "Active Python version isn't supported by ${CATEGORY}/${PF}"
+ fi
+ done
+ export PYTHON_ABIS="${PYVER}"
+ fi
fi
# Ensure that EPYTHON variable is respected.