Gentoo Archives: gentoo-python

From: "Michał Górny" <mgorny@g.o>
To: gentoo-python@l.g.o
Cc: python@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-python] [PATCH python-utils-r1 2/2] Use PYTHON_PKG_DEP to simplify eclasses.
Date: Mon, 17 Dec 2012 00:14:22
Message-Id: 1355703239-21299-2-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-python] [PATCH python-utils-r1 1/2] Introduce 'PYTHON_PKG_DEP' for dependency on Python. by "Michał Górny"
1 ---
2 gx86/eclass/python-any-r1.eclass | 22 +++++-----------------
3 gx86/eclass/python-r1.eclass | 21 +++------------------
4 gx86/eclass/python-single-r1.eclass | 21 +++------------------
5 3 files changed, 11 insertions(+), 53 deletions(-)
6
7 diff --git a/gx86/eclass/python-any-r1.eclass b/gx86/eclass/python-any-r1.eclass
8 index ad56dc7..4987025 100644
9 --- a/gx86/eclass/python-any-r1.eclass
10 +++ b/gx86/eclass/python-any-r1.eclass
11 @@ -202,25 +202,13 @@ python-any-r1_pkg_setup() {
12 fi
13 done
14
15 + local PYTHON_PKG_DEP
16 for i in "${rev_impls[@]}"; do
17 - local d
18 - case "${i}" in
19 - python*)
20 - d='dev-lang/python';;
21 - jython*)
22 - d='dev-java/jython';;
23 - pypy*)
24 - d='dev-python/pypy';;
25 - *)
26 - die "Invalid implementation: ${i}"
27 - esac
28 - local v=${i##*[a-z]}
29 -
30 - if has_version "${d}:${v/_/.}${usestr}"; then
31 - python_export "${i}" EPYTHON PYTHON
32 - break
33 - fi
34 + python_export "${i}" PYTHON_PKG_DEP EPYTHON PYTHON
35 + has_version "${PYTHON_PKG_DEP}" && break
36 done
37 +
38 + die $EPYTHON
39 }
40
41 _PYTHON_ANY_R1=1
42 diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
43 index cfd0a36..100de38 100644
44 --- a/gx86/eclass/python-r1.eclass
45 +++ b/gx86/eclass/python-r1.eclass
46 @@ -144,30 +144,15 @@ _python_set_globals() {
47 REQUIRED_USE="|| ( ${flags[*]} )"
48 PYTHON_USEDEP=${optflags// /,}
49
50 - local usestr
51 - [[ ${PYTHON_REQ_USE} ]] && usestr="[${PYTHON_REQ_USE}]"
52 -
53 # 1) well, python-exec would suffice as an RDEP
54 # but no point in making this overcomplex, BDEP doesn't hurt anyone
55 # 2) python-exec should be built with all targets forced anyway
56 # but if new targets were added, we may need to force a rebuild
57 PYTHON_DEPS="dev-python/python-exec[${PYTHON_USEDEP}]"
58 - local i
59 + local i PYTHON_PKG_DEP
60 for i in "${PYTHON_COMPAT[@]}"; do
61 - local d
62 - case ${i} in
63 - python*)
64 - d='dev-lang/python';;
65 - jython*)
66 - d='dev-java/jython';;
67 - pypy*)
68 - d='dev-python/pypy';;
69 - *)
70 - die "Invalid implementation: ${i}"
71 - esac
72 -
73 - local v=${i##*[a-z]}
74 - PYTHON_DEPS+=" python_targets_${i}? ( ${d}:${v/_/.}${usestr} )"
75 + python_export "${i}" PYTHON_PKG_DEP
76 + PYTHON_DEPS+=" python_targets_${i}? ( ${PYTHON_PKG_DEP} )"
77 done
78 }
79 _python_set_globals
80 diff --git a/gx86/eclass/python-single-r1.eclass b/gx86/eclass/python-single-r1.eclass
81 index 51807f2..39f9320 100644
82 --- a/gx86/eclass/python-single-r1.eclass
83 +++ b/gx86/eclass/python-single-r1.eclass
84 @@ -143,35 +143,20 @@ _python_single_set_globals() {
85 REQUIRED_USE="|| ( ${flags_mt[*]} ) ^^ ( ${flags[*]} )"
86 PYTHON_USEDEP=${optflags// /,}
87
88 - local usestr
89 - [[ ${PYTHON_REQ_USE} ]] && usestr="[${PYTHON_REQ_USE}]"
90 -
91 # 1) well, python-exec would suffice as an RDEP
92 # but no point in making this overcomplex, BDEP doesn't hurt anyone
93 # 2) python-exec should be built with all targets forced anyway
94 # but if new targets were added, we may need to force a rebuild
95 PYTHON_DEPS="dev-python/python-exec[${PYTHON_USEDEP}]"
96 - local i
97 + local i PYTHON_PKG_DEP
98 for i in "${PYTHON_COMPAT[@]}"; do
99 # The chosen targets need to be in PYTHON_TARGETS as well.
100 # This is in order to enforce correct dependencies on packages
101 # supporting multiple implementations.
102 REQUIRED_USE+=" python_single_target_${i}? ( python_targets_${i} )"
103
104 - local d
105 - case ${i} in
106 - python*)
107 - d='dev-lang/python';;
108 - jython*)
109 - d='dev-java/jython';;
110 - pypy*)
111 - d='dev-python/pypy';;
112 - *)
113 - die "Invalid implementation: ${i}"
114 - esac
115 -
116 - local v=${i##*[a-z]}
117 - PYTHON_DEPS+=" python_single_target_${i}? ( ${d}:${v/_/.}${usestr} )"
118 + python_export "${i}" PYTHON_PKG_DEP
119 + PYTHON_DEPS+=" python_single_target_${i}? ( ${PYTHON_PKG_DEP} )"
120 done
121 }
122 _python_single_set_globals
123 --
124 1.8.0.2