Gentoo Archives: gentoo-python

From: "Michał Górny" <mgorny@g.o>
To: gentoo-python@l.g.o
Cc: python@g.o, sera@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-python] [PATCH 2/2] Re-enable python-r1 -> python-single-r1 dep prevention in EAPI 5+.
Date: Mon, 17 Dec 2012 00:28:37
Message-Id: 1355704103-21918-2-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-python] [PATCH 1/2] Require EAPI=5 for python-single-r1. by "Michał Górny"
1 ---
2 gx86/eclass/python-r1.eclass | 31 +++++++++++++++++++++++++++----
3 1 file changed, 27 insertions(+), 4 deletions(-)
4
5 diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
6 index cfd0a36..3cae4f0 100644
7 --- a/gx86/eclass/python-r1.eclass
8 +++ b/gx86/eclass/python-r1.eclass
9 @@ -133,12 +133,35 @@ fi
10
11 _python_set_globals() {
12 local flags=( "${PYTHON_COMPAT[@]/#/python_targets_}" )
13 - #local flags_st=( "${PYTHON_COMPAT[@]/#/-python_single_target_}" )
14 local optflags=${flags[@]/%/?}
15 - #optflags+=,${flags_st[@]/%/(-)}
16
17 - # PYTHON_SINGLE_TARGET safety check temporarily disabled
18 - # because of issues with paludis, bug #447524.
19 + # Here's a nice trick to prevent python-r1 packages from depending
20 + # on python-single-r1 packages.
21 + #
22 + # python-single-r1 enforces at least one PYTHON_SINGLE_TARGET
23 + # through REQUIRED_USE. Therefore, we can assume that
24 + # python-single-r1 packages have at least one flag set.
25 + #
26 + # If packages does not use python-single-r1, it should have no
27 + # PYTHON_SINGLE_TARGET flags.
28 + #
29 + # The '-python_single_target...(-)' construct is always true when
30 + # there's no PYTHON_SINGLE_TARGET flags. If there is at least one
31 + # such flag, there will be at least one set, and the relevant
32 + # constraint will prevent the package from being merged.
33 + #
34 + # Therefore, developer trying to depend on python-single-r1 package
35 + # will be unable to merge the package. This should be enough to
36 + # prevent him from committing one.
37 + #
38 + # In EAPI < 5, an implicit IUSE is added for all USE_EXPAND
39 + # variables, making '(-)' deps unusable on them. This can be seen
40 + # in Paludis (bug #447524). We need at least EAPI=5 for this to work
41 + # correctly.
42 + if ! has "${EAPI}" 4; then
43 + local flags_st=( "${PYTHON_COMPAT[@]/#/-python_single_target_}" )
44 + optflags+=,${flags_st[@]/%/(-)}
45 + fi
46
47 IUSE=${flags[*]}
48 REQUIRED_USE="|| ( ${flags[*]} )"
49 --
50 1.8.0.2