1 |
commit: 8c07d5519bac319ef715fecbdc63c270f612330a |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Dec 17 21:19:45 2020 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Dec 23 10:14:46 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8c07d551 |
7 |
|
8 |
python-r1.eclass: Support PYTHON_SINGLE_USEDEP in any-dep API |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
eclass/python-r1.eclass | 40 +++++++++++++++++++++++++++++++++------- |
13 |
1 file changed, 33 insertions(+), 7 deletions(-) |
14 |
|
15 |
diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass |
16 |
index e7a660219c1..5cae020c6d9 100644 |
17 |
--- a/eclass/python-r1.eclass |
18 |
+++ b/eclass/python-r1.eclass |
19 |
@@ -152,6 +152,28 @@ fi |
20 |
# python_targets_python2_7(-)?,python_targets_python3_4(-)? |
21 |
# @CODE |
22 |
|
23 |
+# @ECLASS-VARIABLE: PYTHON_SINGLE_USEDEP |
24 |
+# @OUTPUT_VARIABLE |
25 |
+# @DESCRIPTION: |
26 |
+# An eclass-generated USE-dependency string for the currently tested |
27 |
+# implementation. It is set locally for python_check_deps() call. |
28 |
+# |
29 |
+# The generated USE-flag list is compatible with packages using |
30 |
+# python-single-r1 eclass. For python-r1 dependencies, |
31 |
+# use PYTHON_USEDEP. |
32 |
+# |
33 |
+# Example use: |
34 |
+# @CODE |
35 |
+# python_check_deps() { |
36 |
+# has_version "dev-python/bar[${PYTHON_SINGLE_USEDEP}]" |
37 |
+# } |
38 |
+# @CODE |
39 |
+# |
40 |
+# Example value: |
41 |
+# @CODE |
42 |
+# python_single_target_python3_7(-) |
43 |
+# @CODE |
44 |
+ |
45 |
# @ECLASS-VARIABLE: PYTHON_REQUIRED_USE |
46 |
# @OUTPUT_VARIABLE |
47 |
# @DESCRIPTION: |
48 |
@@ -507,9 +529,10 @@ python_gen_impl_dep() { |
49 |
# Generate an any-of dependency that enforces a version match between |
50 |
# the Python interpreter and Python packages. <dependency-block> needs |
51 |
# to list one or more dependencies with verbatim '${PYTHON_USEDEP}' |
52 |
-# references (quoted!) that will get expanded inside the function. |
53 |
-# Optionally, patterns may be specified to restrict the dependency |
54 |
-# to a subset of Python implementations supported by the ebuild. |
55 |
+# or '${PYTHON_SINGLE_USEDEP}' references (quoted!) that will get |
56 |
+# expanded inside the function. Optionally, patterns may be specified |
57 |
+# to restrict the dependency to a subset of Python implementations |
58 |
+# supported by the ebuild. |
59 |
# |
60 |
# The patterns can be either fnmatch-style patterns (matched via bash |
61 |
# == operator against PYTHON_COMPAT values) or '-2' / '-3' to indicate |
62 |
@@ -524,12 +547,12 @@ python_gen_impl_dep() { |
63 |
# Example use: |
64 |
# @CODE |
65 |
# DEPEND="$(python_gen_any_dep ' |
66 |
-# dev-python/foo[${PYTHON_USEDEP}] |
67 |
+# dev-python/foo[${PYTHON_SINGLE_USEDEP}] |
68 |
# || ( dev-python/bar[${PYTHON_USEDEP}] |
69 |
# dev-python/baz[${PYTHON_USEDEP}] )' -2)" |
70 |
# |
71 |
# python_check_deps() { |
72 |
-# has_version "dev-python/foo[${PYTHON_USEDEP}]" \ |
73 |
+# has_version "dev-python/foo[${PYTHON_SINGLE_USEDEP}]" \ |
74 |
# && { has_version "dev-python/bar[${PYTHON_USEDEP}]" \ |
75 |
# || has_version "dev-python/baz[${PYTHON_USEDEP}]"; } |
76 |
# } |
77 |
@@ -548,13 +571,13 @@ python_gen_impl_dep() { |
78 |
# || ( |
79 |
# ( |
80 |
# dev-lang/python:3.7 |
81 |
-# dev-python/foo[python_targets_python3_7(-),-python_single_target_python3_7(-)] |
82 |
+# dev-python/foo[python_single_target_python3_7(-)] |
83 |
# || ( dev-python/bar[python_targets_python3_7(-),-python_single_target_python3_7(-)] |
84 |
# dev-python/baz[python_targets_python3_7(-),-python_single_target_python3_7(-)] ) |
85 |
# ) |
86 |
# ( |
87 |
# dev-lang/python:3.8 |
88 |
-# dev-python/foo[python_targets_python3_8(-),-python_single_target_python3_8(-)] |
89 |
+# dev-python/foo[python_single_target_python3_8(-)] |
90 |
# || ( dev-python/bar[python_targets_python3_8(-),-python_single_target_python3_8(-)] |
91 |
# dev-python/baz[python_targets_python3_8(-),-python_single_target_python3_8(-)] ) |
92 |
# ) |
93 |
@@ -572,9 +595,11 @@ python_gen_any_dep() { |
94 |
for i in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do |
95 |
if _python_impl_matches "${i}" "${@}"; then |
96 |
local PYTHON_USEDEP="python_targets_${i}(-),-python_single_target_${i}(-)" |
97 |
+ local PYTHON_SINGLE_USEDEP="python_single_target_${i}(-)" |
98 |
_python_export "${i}" PYTHON_PKG_DEP |
99 |
|
100 |
local i_depstr=${depstr//\$\{PYTHON_USEDEP\}/${PYTHON_USEDEP}} |
101 |
+ i_depstr=${i_depstr//\$\{PYTHON_SINGLE_USEDEP\}/${PYTHON_SINGLE_USEDEP}} |
102 |
# note: need to strip '=' slot operator for || deps |
103 |
out="( ${PYTHON_PKG_DEP/:0=/:0} ${i_depstr} ) ${out}" |
104 |
fi |
105 |
@@ -780,6 +805,7 @@ python_setup() { |
106 |
python_is_installed "${impl}" || continue |
107 |
# then run python_check_deps |
108 |
local PYTHON_USEDEP="python_targets_${impl}(-),-python_single_target_${impl}(-)" |
109 |
+ local PYTHON_SINGLE_USEDEP="python_single_target_${impl}(-)" |
110 |
python_check_deps || continue |
111 |
fi |