Gentoo Archives: gentoo-dev

From: Arfrever Frehtes Taifersar Arahesis <Arfrever@g.o>
To: Gentoo Development <gentoo-dev@l.g.o>
Subject: [gentoo-dev] PYTHON_DEPEND in EAPI >=4, PYTHON_BDEPEND
Date: Sun, 28 Nov 2010 19:31:28
Message-Id: 201011282032.17790.Arfrever@gentoo.org
1 I would like to introduce incompatible improvements in syntax of PYTHON_DEPEND variable in
2 EAPI >=4. The new syntax will depend on whether given package supports installation for
3 multiple Python ABIs. The extended functionality will replace PYTHON_USE_WITH* variables.
4
5 ================================================================================================
6 PYTHON_DEPEND in EAPI <=3, PYTHON_USE_WITH*
7
8 (It's a reminder. No changes will occur here.)
9
10 PYTHON_DEPEND has 2 possible forms:
11 PYTHON_DEPEND="${range_of_versions}"
12 PYTHON_DEPEND="${USE_flag}? ${range_of_versions}"
13
14 This syntax doesn't allow to specify conditions depending on more than 1 USE flag.
15
16 PYTHON_USE_WITH and PYTHON_USE_WITH_OR specify USE dependencies. PYTHON_USE_WITH_OPT is used
17 to make PYTHON_USE_WITH or PYTHON_USE_WITH_OR conditional under a USE flag. It doesn't allow
18 to specify more complicated conditions (e.g. USE="A" enables dependency on Python[tk], while
19 USE="B" enables dependency on Python[xml]).
20
21 ================================================================================================
22 PYTHON_DEPEND in EAPI >=4 in packages not supporting installation for multiple Python ABIs
23
24 Syntax of "${range_of_versions}" will remain the same as in EAPI <=3. The new syntax of
25 PYTHON_DEPEND will support USE conditionals and USE dependencies in {,R,P}DEPEND-style.
26 If PYTHON_DEPEND contains only 1 "${range_of_versions}", then no other elements in value of
27 whole PYTHON_DEPEND will be required. Otherwise each "${range_of_versions}" should be included
28 between "<<" and ">>" markers. Potential USE dependencies should be included between "[" and "]"
29 markers directly after given "${range_of_versions}".
30
31 Examples:
32 # Dependency on Python 2.7 or 2.6.
33 PYTHON_DEPEND="2:2.6"
34
35 # Dependency on Python 2.7 or 2.6.
36 PYTHON_DEPEND="<<2:2.6>>"
37
38 # Dependency on Python 2.7 or 2.6 when "A" USE flag is enabled.
39 PYTHON_DEPEND="A? ( <<2:2.6>> )"
40
41 # Dependency on Python 2.7 or 2.6 when "A" and "B" USE flags are enabled.
42 PYTHON_DEPEND="A? ( B? ( <<2:2.6>> ) )"
43
44 # Dependency on Python 2.7 or 2.6 when "A" and "B" USE flags are enabled and "C" USE flag is
45 # disabled.
46 PYTHON_DEPEND="A? ( B? ( !C? ( <<2:2.6>> ) ) )"
47
48 # Dependency on Python 2 always, and 2.7 or 2.6 when "A" USE flag is enabled.
49 PYTHON_DEPEND="<<2>> A? ( <<2:2.6>> )"
50
51 # Dependency on Python 2 and 3. (It will probably never be used.)
52 PYTHON_DEPEND="<<2>> <<3>>"
53
54 # Dependency on Python 2 when "python2" USE flag is enabled, and Python 3 when "python3"
55 # USE flag is enabled.
56 PYTHON_DEPEND="python2? ( <<2>> ) python3? ( <<3>> )"
57
58 # Dependency on Python 2.7 or 2.6 with "ncurses", "threads" and "xml" USE flags.
59 PYTHON_DEPEND="<<2:2.6[ncurses,threads,xml]>>"
60
61 # Dependency on Python 2.7 or 2.6 with "ncurses" and "threads" USE flags, and "xml" USE flag
62 # when "xml" USE flag is enabled.
63 PYTHON_DEPEND="<<2:2.6[ncurses,threads,xml?]>>"
64
65 # Dependency on Python 2.7 or 2.6 with "ncurses" and "threads" USE flags, and "xml" USE flag
66 # when "A" USE flag is enabled.
67 PYTHON_DEPEND="<<2:2.6[ncurses,threads]>> A? ( <<2:2.6[xml]>> )"
68
69 # Dependency on Python 2.7 or 2.6 with enabled "ncurses" USE flag and disabled "threads" USE
70 # flag.
71 PYTHON_DEPEND="<<2:2.6[ncurses,-threads]>>"
72
73 # Dependency on Python 3.1, 2.6 or 2.5 with "ncurses" and "threads" USE flags.
74 PYTHON_DEPEND="<<2:2.5:2.6 3:3.1:3.1[ncurses,threads]>>"
75
76 # Dependency on Python 2 with "berkdb" or "gdbm" USE flag.
77 PYTHON_DEPEND="|| ( <<2[berkdb]>> <<2[gdbm]>> )"
78
79 # Dependency on Python 2 with "berkdb" or "gdbm" USE flag when "A" USE flag is enabled.
80 PYTHON_DEPEND="A? ( || ( <<2[berkdb]>> <<2[gdbm]>> ) )"
81
82 The last 2 examples present replacement for PYTHON_USE_WITH_OR. PYTHON_USE_WITH_OR is used by
83 only 1 package and it's unlikely that there will be many other packages, so I don't plan to
84 introduce special, shorter syntax for specifying of USE flags of which at least one must be
85 enabled.
86
87 USE dependencies specified between "[" and "]" will be used literally in generated DEPEND and
88 RDEPEND.
89
90 Appropriate has_version() checks in python_pkg_setup() will be generated from PYTHON_DEPEND.
91 (They are generated from PYTHON_USE_WITH/PYTHON_USE_WITH_OR in EAPI <=3.)
92
93 If PYTHON_DEPEND is empty or unset, then no dependency on Python will be generated.
94
95 PYTHON_USE_WITH* variables will be banned in EAPI >=4.
96
97 ================================================================================================
98 PYTHON_DEPEND in EAPI >=4 in packages supporting installation for multiple Python ABIs
99
100 Changes presented in this section can occur only if EAPI="4" contains support for dots in USE
101 flags.
102
103 The list of supported Python versions will depend only on RESTRICT_PYTHON_ABIS variable.
104 The new syntax of PYTHON_DEPEND will support USE conditionals and USE dependencies in
105 {,R,P}DEPEND-style. "<<>>" marker will be used to indicate dependencies on Python. Potential
106 USE dependencies should be included between "[" and "]" markers between "<<" and ">>".
107
108 If PYTHON_DEPEND is unset, then it will be treated as PYTHON_DEPEND="<<>>".
109 If PYTHON_DEPEND is set and empty, then no dependency on Python will be generated.
110
111 Examples:
112 # No dependency on Python.
113 PYTHON_DEPEND=""
114
115 # Dependency on Python.
116 # Unset PYTHON_DEPEND
117
118 # Dependency on Python.
119 PYTHON_DEPEND="<<>>"
120
121 # Dependency on Python when "A" USE flag is enabled.
122 PYTHON_DEPEND="A? ( <<>> )"
123
124 # Dependency on Python when "A" and "B" USE flags are enabled.
125 PYTHON_DEPEND="A? ( B? ( <<>> ) )"
126
127 # Dependency on Python when "A" and "B" USE flags are enabled and "C" USE flag is disabled.
128 PYTHON_DEPEND="A? ( B? ( !C? ( <<>> ) ) )"
129
130 # Dependency on Python with "ncurses", "threads" and "xml" USE flags.
131 PYTHON_DEPEND="<<[ncurses,threads,xml]>>"
132
133 # Dependency on Python with "ncurses" and "threads" USE flags, and "xml" USE flag when "xml"
134 # USE flag is enabled.
135 PYTHON_DEPEND="<<[ncurses,threads,xml?]>>"
136
137 # Dependency on Python with "ncurses" and "threads" USE flags, and "xml" USE flag when "A"
138 # USE flag is enabled.
139 PYTHON_DEPEND="<<[ncurses,threads]>> A? ( <<[xml]>> )"
140
141 # Dependency on Python with enabled "ncurses" USE flag and disabled "threads" USE flag.
142 PYTHON_DEPEND="<<[ncurses,-threads]>>"
143
144 # Dependency on Python with "berkdb" or "gdbm" USE flag.
145 PYTHON_DEPEND="|| ( <<[berkdb]>> <<[gdbm]>> )"
146
147 # Dependency on Python with "berkdb" or "gdbm" USE flag when "A" USE flag is enabled.
148 PYTHON_DEPEND="A? ( || ( <<[berkdb]>> <<[gdbm]>> ) )"
149
150 Each "<<>>" will be replaced in generated DEPEND and RDEPEND by something similar to:
151 python_abis_2.4? ( dev-lang/python:2.4 )
152 python_abis_2.5? ( dev-lang/python:2.5 )
153 python_abis_2.6? ( dev-lang/python:2.6 )
154 python_abis_2.7? ( dev-lang/python:2.7 )
155 python_abis_3.0? ( dev-lang/python:3.0 )
156 python_abis_3.1? ( dev-lang/python:3.1 )
157 python_abis_3.2? ( dev-lang/python:3.2 )
158 python_abis_2.5-jython? ( dev-java/jython:2.5 )
159
160 If USE dependencies have been specified in PYTHON_DEPEND, then they will be used literally
161 in generated DEPEND and RDEPEND:
162 python_abis_2.4? ( dev-lang/python:2.4[threads,xml] )
163 python_abis_2.5? ( dev-lang/python:2.5[threads,xml] )
164 ...
165
166 No has_version() checks in python_pkg_setup() will be generated from PYTHON_DEPEND.
167
168 PYTHON_USE_WITH* variables will be banned in EAPI >=4.
169
170 Appropriate REQUIRED_USE will be generated from PYTHON_DEPEND.
171
172 Examples:
173 # Unset PYTHON_DEPEND or PYTHON_DEPEND="<<>>" can generate:
174 REQUIRED_USE="|| ( python_abis_2.4 python_abis_2.5 python_abis_2.6 python_abis_2.7 python_abis_3.0 python_abis_3.0 python_abis_3.1 python_abis_3.2 python_abis_2.5-jython )"
175
176 # PYTHON_DEPEND="A? ( B? ( <<[ncurses,threads]>> ) )" can generate:
177 REQUIRED_USE="A? ( B? ( || ( python_abis_2.4 python_abis_2.5 python_abis_2.6 python_abis_2.7 python_abis_3.0 python_abis_3.0 python_abis_3.1 python_abis_3.2 python_abis_2.5-jython ) ) )"
178
179 ================================================================================================
180 PYTHON_BDEPEND
181
182 I would also like to introduce PYTHON_BDEPEND variable, which will affect only DEPEND without
183 RDEPEND. PYTHON_BDEPEND will have the same syntax as PYTHON_DEPEND in given EAPI and type of
184 package. PYTHON_BDEPEND maybe won't affect REQUIRED_USE and has_version() checks in
185 python_pkg_setup(). PYTHON_BDEPEND won't affect PYTHON_DEPEND's influence on DEPEND
186 (dependencies will be concatenated). PYTHON_BDEPEND probably will be used mainly in packages
187 not supporting installation for multiple Python ABIs. In packages supporting installation for
188 multiple Python ABIs, PYTHON_BDEPEND can be useful only to specify USE dependencies (e.g. USE
189 dependencies conditional on "test" USE flag). Unset PYTHON_BDEPEND won't affect DEPEND.
190
191 --
192 Arfrever Frehtes Taifersar Arahesis

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] PYTHON_DEPEND in EAPI >=4, PYTHON_BDEPEND Markos Chandras <hwoarang@g.o>
Re: [gentoo-dev] PYTHON_DEPEND in EAPI >=4, PYTHON_BDEPEND "Michał Górny" <mgorny@g.o>