1 |
arfrever 09/08/31 00:07:38 |
2 |
|
3 |
Modified: python.eclass |
4 |
Log: |
5 |
Improve validate_PYTHON_ABIS(). |
6 |
|
7 |
Revision Changes Path |
8 |
1.68 eclass/python.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?rev=1.68&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?rev=1.68&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?r1=1.67&r2=1.68 |
13 |
|
14 |
Index: python.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/python.eclass,v |
17 |
retrieving revision 1.67 |
18 |
retrieving revision 1.68 |
19 |
diff -u -r1.67 -r1.68 |
20 |
--- python.eclass 29 Aug 2009 02:15:24 -0000 1.67 |
21 |
+++ python.eclass 31 Aug 2009 00:07:37 -0000 1.68 |
22 |
@@ -1,6 +1,6 @@ |
23 |
# Copyright 1999-2009 Gentoo Foundation |
24 |
# Distributed under the terms of the GNU General Public License v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.67 2009/08/29 02:15:24 arfrever Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.68 2009/08/31 00:07:37 arfrever Exp $ |
27 |
|
28 |
# @ECLASS: python.eclass |
29 |
# @MAINTAINER: |
30 |
@@ -130,28 +130,41 @@ |
31 |
if [[ -z "${PYTHON_ABIS}" ]] && has "${EAPI:-0}" 0 1 2 3; then |
32 |
local ABI support_ABI supported_PYTHON_ABIS= restricted_ABI |
33 |
PYTHON_ABI_SUPPORTED_VALUES="2.4 2.5 2.6 2.7 3.0 3.1 3.2" |
34 |
- for ABI in ${USE_PYTHON}; do |
35 |
- if ! has "${ABI}" ${PYTHON_ABI_SUPPORTED_VALUES}; then |
36 |
- ewarn "Ignoring unsupported Python ABI '${ABI}'" |
37 |
- continue |
38 |
+ |
39 |
+ if declare -p | grep "^declare -x USE_PYTHON=" > /dev/null; then |
40 |
+ if [[ -z "${USE_PYTHON}" ]]; then |
41 |
+ die "USE_PYTHON variable is empty" |
42 |
fi |
43 |
- support_ABI="1" |
44 |
- if [[ -z "${IGNORE_RESTRICT_PYTHON_ABIS}" ]]; then |
45 |
+ |
46 |
+ for ABI in ${USE_PYTHON}; do |
47 |
+ if ! has "${ABI}" ${PYTHON_ABI_SUPPORTED_VALUES}; then |
48 |
+ die "USE_PYTHON variable contains invalid value '${ABI}'" |
49 |
+ fi |
50 |
+ support_ABI="1" |
51 |
for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do |
52 |
if python -c "from fnmatch import fnmatch; exit(not fnmatch('${ABI}', '${restricted_ABI}'))"; then |
53 |
support_ABI="0" |
54 |
break |
55 |
fi |
56 |
done |
57 |
+ [[ "${support_ABI}" == "1" ]] && supported_PYTHON_ABIS+=" ${ABI}" |
58 |
+ done |
59 |
+ export PYTHON_ABIS="${supported_PYTHON_ABIS# }" |
60 |
+ |
61 |
+ if [[ -z "${PYTHON_ABIS//[${IFS}]/}" ]]; then |
62 |
+ die "USE_PYTHON variable doesn't enable any Python version supported by ${CATEGORY}/${PF}" |
63 |
fi |
64 |
- [[ "${support_ABI}" == "1" ]] && supported_PYTHON_ABIS+=" ${ABI}" |
65 |
- done |
66 |
- export PYTHON_ABIS="${supported_PYTHON_ABIS# }" |
67 |
- fi |
68 |
+ else |
69 |
+ local restricted_ABI |
70 |
+ python_version |
71 |
|
72 |
- if [[ -z "${PYTHON_ABIS//[${IFS}]/}" ]]; then |
73 |
- python_version |
74 |
- export PYTHON_ABIS="${PYVER}" |
75 |
+ for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do |
76 |
+ if python -c "from fnmatch import fnmatch; exit(not fnmatch('${PYVER}', '${restricted_ABI}'))"; then |
77 |
+ die "Active Python version isn't supported by ${CATEGORY}/${PF}" |
78 |
+ fi |
79 |
+ done |
80 |
+ export PYTHON_ABIS="${PYVER}" |
81 |
+ fi |
82 |
fi |
83 |
|
84 |
# Ensure that EPYTHON variable is respected. |