1 |
mgorny 13/04/30 05:34:33 |
2 |
|
3 |
Modified: ChangeLog python-any-r1.eclass |
4 |
Log: |
5 |
Support declaring python_check_deps() in ebuilds, to check Python impl for proper deps. |
6 |
|
7 |
Revision Changes Path |
8 |
1.807 eclass/ChangeLog |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.807&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.807&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.806&r2=1.807 |
13 |
|
14 |
Index: ChangeLog |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v |
17 |
retrieving revision 1.806 |
18 |
retrieving revision 1.807 |
19 |
diff -u -r1.806 -r1.807 |
20 |
--- ChangeLog 30 Apr 2013 05:33:19 -0000 1.806 |
21 |
+++ ChangeLog 30 Apr 2013 05:34:33 -0000 1.807 |
22 |
@@ -1,6 +1,10 @@ |
23 |
# ChangeLog for eclass directory |
24 |
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.806 2013/04/30 05:33:19 mgorny Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.807 2013/04/30 05:34:33 mgorny Exp $ |
27 |
+ |
28 |
+ 30 Apr 2013; Michal Gorny <mgorny@g.o> python-any-r1.eclass: |
29 |
+ Support declaring python_check_deps() in ebuilds, to check Python impl for |
30 |
+ proper deps. |
31 |
|
32 |
30 Apr 2013; Michal Gorny <mgorny@g.o> python-any-r1.eclass: |
33 |
Report no matching impl properly. |
34 |
|
35 |
|
36 |
|
37 |
1.10 eclass/python-any-r1.eclass |
38 |
|
39 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-any-r1.eclass?rev=1.10&view=markup |
40 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-any-r1.eclass?rev=1.10&content-type=text/plain |
41 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-any-r1.eclass?r1=1.9&r2=1.10 |
42 |
|
43 |
Index: python-any-r1.eclass |
44 |
=================================================================== |
45 |
RCS file: /var/cvsroot/gentoo-x86/eclass/python-any-r1.eclass,v |
46 |
retrieving revision 1.9 |
47 |
retrieving revision 1.10 |
48 |
diff -u -r1.9 -r1.10 |
49 |
--- python-any-r1.eclass 30 Apr 2013 05:33:19 -0000 1.9 |
50 |
+++ python-any-r1.eclass 30 Apr 2013 05:34:33 -0000 1.10 |
51 |
@@ -1,6 +1,6 @@ |
52 |
# Copyright 1999-2013 Gentoo Foundation |
53 |
# Distributed under the terms of the GNU General Public License v2 |
54 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/python-any-r1.eclass,v 1.9 2013/04/30 05:33:19 mgorny Exp $ |
55 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-any-r1.eclass,v 1.10 2013/04/30 05:34:33 mgorny Exp $ |
56 |
|
57 |
# @ECLASS: python-any-r1 |
58 |
# @MAINTAINER: |
59 |
@@ -20,6 +20,14 @@ |
60 |
# pkg_setup() which finds the best supported implementation and sets it |
61 |
# as the active one. |
62 |
# |
63 |
+# Optionally, you can define a python_check_deps() function. It will |
64 |
+# be called by the eclass with EPYTHON set to each matching Python |
65 |
+# implementation and it is expected to check whether the implementation |
66 |
+# fulfills the package requirements. You can use the locally exported |
67 |
+# PYTHON_USEDEP to check USE-dependencies of relevant packages. It |
68 |
+# should return a true value (0) if the Python implementation fulfills |
69 |
+# the requirements, a false value (non-zero) otherwise. |
70 |
+# |
71 |
# Please note that python-any-r1 will always inherit python-utils-r1 |
72 |
# as well. Thus, all the functions defined there can be used in the |
73 |
# packages using python-any-r1, and there is no need ever to inherit |
74 |
@@ -134,16 +142,38 @@ |
75 |
} |
76 |
_python_build_set_globals |
77 |
|
78 |
+# @ECLASS-VARIABLE: PYTHON_USEDEP |
79 |
+# @DESCRIPTION: |
80 |
+# An eclass-generated USE-dependency string for the currently tested |
81 |
+# implementation. It is set locally for python_check_deps() call. |
82 |
+# |
83 |
+# The generate USE-flag list is compatible with packages using python-r1, |
84 |
+# python-single-r1 and python-distutils-ng eclasses. It must not be used |
85 |
+# on packages using python.eclass. |
86 |
+# |
87 |
+# Example use: |
88 |
+# @CODE |
89 |
+# python_check_deps() { |
90 |
+# has_version "dev-python/foo[${PYTHON_USEDEP}]" |
91 |
+# } |
92 |
+# @CODE |
93 |
+# |
94 |
+# Example value: |
95 |
+# @CODE |
96 |
+# python_targets_python2_7(-)?,python_single_target_python2_7(+)? |
97 |
+# @CODE |
98 |
+ |
99 |
# @FUNCTION: _python_EPYTHON_supported |
100 |
# @USAGE: <epython> |
101 |
# @INTERNAL |
102 |
# @DESCRIPTION: |
103 |
# Check whether the specified implementation is supported by package |
104 |
-# (specified in PYTHON_COMPAT). |
105 |
+# (specified in PYTHON_COMPAT). Calls python_check_deps() if declared. |
106 |
_python_EPYTHON_supported() { |
107 |
debug-print-function ${FUNCNAME} "${@}" |
108 |
|
109 |
- local i=${1/./_} |
110 |
+ local EPYTHON=${1} |
111 |
+ local i=${EPYTHON/./_} |
112 |
|
113 |
case "${i}" in |
114 |
python*|jython*) |
115 |
@@ -161,6 +191,12 @@ |
116 |
local PYTHON_PKG_DEP |
117 |
python_export "${i}" PYTHON_PKG_DEP |
118 |
if ROOT=/ has_version "${PYTHON_PKG_DEP}"; then |
119 |
+ if declare -f python_check_deps >/dev/null; then |
120 |
+ local PYTHON_USEDEP="python_targets_${i}(-),python_single_target_${i}(+)" |
121 |
+ python_check_deps |
122 |
+ return ${?} |
123 |
+ fi |
124 |
+ |
125 |
return 0 |
126 |
fi |
127 |
elif ! has "${i}" "${_PYTHON_ALL_IMPLS[@]}"; then |