1 |
arfrever 09/10/02 23:09:08 |
2 |
|
3 |
Modified: python.eclass |
4 |
Log: |
5 |
Add the check to ensure that Python wrapper is configured to use the same version of Python as /usr/bin/python2 or /usr/bin/python3. Add workaround in python_pkg_setup() for older versions of Portage not supporting Python 3. |
6 |
|
7 |
Revision Changes Path |
8 |
1.76 eclass/python.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?rev=1.76&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?rev=1.76&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?r1=1.75&r2=1.76 |
13 |
|
14 |
Index: python.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/python.eclass,v |
17 |
retrieving revision 1.75 |
18 |
retrieving revision 1.76 |
19 |
diff -u -r1.75 -r1.76 |
20 |
--- python.eclass 2 Oct 2009 17:32:23 -0000 1.75 |
21 |
+++ python.eclass 2 Oct 2009 23:09:08 -0000 1.76 |
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.75 2009/10/02 17:32:23 arfrever Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.76 2009/10/02 23:09:08 arfrever Exp $ |
27 |
|
28 |
# @ECLASS: python.eclass |
29 |
# @MAINTAINER: |
30 |
@@ -110,7 +110,7 @@ |
31 |
|
32 |
# @FUNCTION: validate_PYTHON_ABIS |
33 |
# @DESCRIPTION: |
34 |
-# Make sure PYTHON_ABIS variable has valid value. |
35 |
+# Ensure that PYTHON_ABIS variable has valid value. |
36 |
validate_PYTHON_ABIS() { |
37 |
# Ensure that some functions cannot be accidentally successfully used in EAPI <= 2 without setting SUPPORT_PYTHON_ABIS variable. |
38 |
if has "${EAPI:-0}" 0 1 2 && [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then |
39 |
@@ -173,7 +173,9 @@ |
40 |
ewarn "USE_PYTHON variable doesn't enable any version of Python 3. This configuration is unsupported." |
41 |
fi |
42 |
else |
43 |
- local python2_version= python3_version= support_python_major_version |
44 |
+ local python_version python2_version= python3_version= support_python_major_version |
45 |
+ |
46 |
+ python_version="$(/usr/bin/python -c 'from sys import version_info; print(".".join([str(x) for x in version_info[:2]]))')" |
47 |
|
48 |
if has_version "=dev-lang/python-2*"; then |
49 |
if [[ "$(readlink /usr/bin/python2)" != "python2."* ]]; then |
50 |
@@ -229,6 +231,12 @@ |
51 |
fi |
52 |
fi |
53 |
|
54 |
+ if ! has "${python_version}" "${python2_version}" "${python3_version}"; then |
55 |
+ eerror "Python wrapper is configured incorrectly or /usr/bin/python2 or /usr/bin/python3 symlink" |
56 |
+ eerror "is set incorrectly. Use \`eselect python\` to fix configuration." |
57 |
+ die "Incorrect configuration of Python" |
58 |
+ fi |
59 |
+ |
60 |
PYTHON_ABIS="${python2_version} ${python3_version}" |
61 |
PYTHON_ABIS="${PYTHON_ABIS# }" |
62 |
export PYTHON_ABIS="${PYTHON_ABIS% }" |
63 |
@@ -559,6 +567,13 @@ |
64 |
pyatom="dev-lang/python:${PYVER}" |
65 |
fi |
66 |
|
67 |
+ # Workaround for older versions of Portage. |
68 |
+ # has_version() calls portageq which is implemented in Python. |
69 |
+ if has_version "=dev-lang/python-2*"; then |
70 |
+ local EPYTHON |
71 |
+ export EPYTHON="$(readlink /usr/bin/python2)" |
72 |
+ fi |
73 |
+ |
74 |
for use in ${PYTHON_USE_WITH}; do |
75 |
if ! has_version "${pyatom}[${use}]"; then |
76 |
python_pkg_setup_fail "Please rebuild ${pyatom} with the following USE flags enabled: ${PYTHON_USE_WITH}" |