1 |
arfrever 10/02/28 15:49:33 |
2 |
|
3 |
Modified: python.eclass |
4 |
Log: |
5 |
Deprecate python_mod_exists(). |
6 |
|
7 |
Revision Changes Path |
8 |
1.91 eclass/python.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?rev=1.91&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?rev=1.91&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?r1=1.90&r2=1.91 |
13 |
|
14 |
Index: python.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/python.eclass,v |
17 |
retrieving revision 1.90 |
18 |
retrieving revision 1.91 |
19 |
diff -u -r1.90 -r1.91 |
20 |
--- python.eclass 28 Feb 2010 11:48:40 -0000 1.90 |
21 |
+++ python.eclass 28 Feb 2010 15:49:33 -0000 1.91 |
22 |
@@ -1,6 +1,6 @@ |
23 |
# Copyright 1999-2010 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.90 2010/02/28 11:48:40 arfrever Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.91 2010/02/28 15:49:33 arfrever Exp $ |
27 |
|
28 |
# @ECLASS: python.eclass |
29 |
# @MAINTAINER: |
30 |
@@ -1479,25 +1479,6 @@ |
31 |
done |
32 |
} |
33 |
|
34 |
-# @FUNCTION: python_mod_exists |
35 |
-# @USAGE: <module> |
36 |
-# @DESCRIPTION: |
37 |
-# Run with the module name as an argument. It will check if a |
38 |
-# Python module is installed and loadable. It will return |
39 |
-# TRUE(0) if the module exists, and FALSE(1) if the module does |
40 |
-# not exist. |
41 |
-# |
42 |
-# Example: |
43 |
-# if python_mod_exists gtk; then |
44 |
-# echo "gtk support enabled" |
45 |
-# fi |
46 |
-python_mod_exists() { |
47 |
- if [[ "$#" -ne 1 ]]; then |
48 |
- die "${FUNCNAME}() requires 1 argument" |
49 |
- fi |
50 |
- "$(PYTHON ${PYTHON_ABI})" -c "import $1" &> /dev/null |
51 |
-} |
52 |
- |
53 |
# ================================================================================================ |
54 |
# ================================ FUNCTIONS FOR RUNNING OF TESTS ================================ |
55 |
# ================================================================================================ |
56 |
@@ -2012,6 +1993,30 @@ |
57 |
export PYVER="${PYVER_MAJOR}.${PYVER_MINOR}" |
58 |
} |
59 |
|
60 |
+# @FUNCTION: python_mod_exists |
61 |
+# @USAGE: <module> |
62 |
+# @DESCRIPTION: |
63 |
+# Run with the module name as an argument. It will check if a |
64 |
+# Python module is installed and loadable. It will return |
65 |
+# TRUE(0) if the module exists, and FALSE(1) if the module does |
66 |
+# not exist. |
67 |
+# |
68 |
+# Example: |
69 |
+# if python_mod_exists gtk; then |
70 |
+# echo "gtk support enabled" |
71 |
+# fi |
72 |
+python_mod_exists() { |
73 |
+ if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then |
74 |
+ eerror "Use USE dependencies and/or has_version() instead of ${FUNCNAME}()." |
75 |
+ die "${FUNCNAME}() cannot be used in this EAPI" |
76 |
+ fi |
77 |
+ |
78 |
+ if [[ "$#" -ne 1 ]]; then |
79 |
+ die "${FUNCNAME}() requires 1 argument" |
80 |
+ fi |
81 |
+ "$(PYTHON ${PYTHON_ABI})" -c "import $1" &> /dev/null |
82 |
+} |
83 |
+ |
84 |
# @FUNCTION: python_tkinter_exists |
85 |
# @DESCRIPTION: |
86 |
# Run without arguments, checks if Python was compiled with Tkinter |