1 |
mgorny 12/12/31 13:10:42 |
2 |
|
3 |
Modified: ChangeLog python-r1.eclass |
4 |
Log: |
5 |
Add a function to generate dep-strings conditional to Python implementations. |
6 |
|
7 |
Revision Changes Path |
8 |
1.586 eclass/ChangeLog |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.586&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.586&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.585&r2=1.586 |
13 |
|
14 |
Index: ChangeLog |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v |
17 |
retrieving revision 1.585 |
18 |
retrieving revision 1.586 |
19 |
diff -u -r1.585 -r1.586 |
20 |
--- ChangeLog 31 Dec 2012 13:09:09 -0000 1.585 |
21 |
+++ ChangeLog 31 Dec 2012 13:10:42 -0000 1.586 |
22 |
@@ -1,6 +1,9 @@ |
23 |
# ChangeLog for eclass directory |
24 |
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.585 2012/12/31 13:09:09 mgorny Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.586 2012/12/31 13:10:42 mgorny Exp $ |
27 |
+ |
28 |
+ 31 Dec 2012; Michał Górny <mgorny@g.o> python-r1.eclass: |
29 |
+ Add a function to generate dep-strings conditional to Python implementations. |
30 |
|
31 |
31 Dec 2012; Michał Górny <mgorny@g.o> systemd.eclass: |
32 |
Add function to get user unit directory, as requested in bug #449304. |
33 |
|
34 |
|
35 |
|
36 |
1.33 eclass/python-r1.eclass |
37 |
|
38 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.33&view=markup |
39 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.33&content-type=text/plain |
40 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?r1=1.32&r2=1.33 |
41 |
|
42 |
Index: python-r1.eclass |
43 |
=================================================================== |
44 |
RCS file: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v |
45 |
retrieving revision 1.32 |
46 |
retrieving revision 1.33 |
47 |
diff -u -r1.32 -r1.33 |
48 |
--- python-r1.eclass 27 Dec 2012 22:56:21 -0000 1.32 |
49 |
+++ python-r1.eclass 31 Dec 2012 13:10:42 -0000 1.33 |
50 |
@@ -1,6 +1,6 @@ |
51 |
# Copyright 1999-2012 Gentoo Foundation |
52 |
# Distributed under the terms of the GNU General Public License v2 |
53 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.32 2012/12/27 22:56:21 mgorny Exp $ |
54 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.33 2012/12/31 13:10:42 mgorny Exp $ |
55 |
|
56 |
# @ECLASS: python-r1 |
57 |
# @MAINTAINER: |
58 |
@@ -163,7 +163,7 @@ |
59 |
_python_set_globals |
60 |
|
61 |
# @FUNCTION: python_gen_usedep |
62 |
-# @USAGE: pattern [...] |
63 |
+# @USAGE: <pattern> [...] |
64 |
# @DESCRIPTION: |
65 |
# Output a USE dependency string for Python implementations which |
66 |
# are both in PYTHON_COMPAT and match any of the patterns passed |
67 |
@@ -206,7 +206,7 @@ |
68 |
} |
69 |
|
70 |
# @FUNCTION: python_gen_useflags |
71 |
-# @USAGE: pattern [...] |
72 |
+# @USAGE: <pattern> [...] |
73 |
# @DESCRIPTION: |
74 |
# Output a list of USE flags for Python implementations which |
75 |
# are both in PYTHON_COMPAT and match any of the patterns passed |
76 |
@@ -240,6 +240,49 @@ |
77 |
echo ${matches[@]} |
78 |
} |
79 |
|
80 |
+# @FUNCTION: python_gen_cond_dep |
81 |
+# @USAGE: <dependency> <pattern> [...] |
82 |
+# @DESCRIPTION: |
83 |
+# Output a list of <dependency>-ies made conditional to USE flags |
84 |
+# of Python implementations which are both in PYTHON_COMPAT and match |
85 |
+# any of the patterns passed as the remaining parameters. |
86 |
+# |
87 |
+# Please note that USE constraints on the package need to be enforced |
88 |
+# separately. Therefore, the dependency usually needs to use |
89 |
+# python_gen_usedep as well. |
90 |
+# |
91 |
+# Example: |
92 |
+# @CODE |
93 |
+# PYTHON_COMPAT=( python{2_5,2_6,2_7} ) |
94 |
+# RDEPEND="$(python_gen_cond_dep dev-python/unittest2 python{2_5,2_6})" |
95 |
+# @CODE |
96 |
+# |
97 |
+# It will cause the variable to look like: |
98 |
+# @CODE |
99 |
+# RDEPEND="python_targets_python2_5? ( dev-python/unittest2 ) |
100 |
+# python_targets_python2_6? ( dev-python/unittest2 )" |
101 |
+# @CODE |
102 |
+python_gen_cond_dep() { |
103 |
+ debug-print-function ${FUNCNAME} "${@}" |
104 |
+ |
105 |
+ local impl pattern |
106 |
+ local matches=() |
107 |
+ |
108 |
+ local dep=${1} |
109 |
+ shift |
110 |
+ |
111 |
+ for impl in "${PYTHON_COMPAT[@]}"; do |
112 |
+ for pattern; do |
113 |
+ if [[ ${impl} == ${pattern} ]]; then |
114 |
+ matches+=( "python_targets_${impl}? ( ${dep} )" ) |
115 |
+ break |
116 |
+ fi |
117 |
+ done |
118 |
+ done |
119 |
+ |
120 |
+ echo ${matches[@]} |
121 |
+} |
122 |
+ |
123 |
# @ECLASS-VARIABLE: BUILD_DIR |
124 |
# @DESCRIPTION: |
125 |
# The current build directory. In global scope, it is supposed to |