1 |
Introduce a new DISTUTILS_USE_PEP517 value "no" that stands for |
2 |
"no build system". This is primarily meant to replace the legacy |
3 |
distutils-r1 logic used for bootstrapping baseline PEP 517 packages. |
4 |
At the same time, it provides a convenient replacement for some |
5 |
of the uses of python-r1. |
6 |
|
7 |
In this mode, the eclass does not add PEP517-specific dependencies |
8 |
and does not export default python_compile() and python_install() |
9 |
implementations. However, it does set dependencies, REQUIRED_USE |
10 |
and enables sub-phase usage (with respect to DISTUTILS_OPTIONAL). |
11 |
It also permits using distutils_enable_{sphinx,tests}. |
12 |
|
13 |
Signed-off-by: Michał Górny <mgorny@g.o> |
14 |
--- |
15 |
eclass/distutils-r1.eclass | 30 +++++++++++++++++++++++++++++- |
16 |
1 file changed, 29 insertions(+), 1 deletion(-) |
17 |
|
18 |
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass |
19 |
index 208bd2718cb8..30f7d941f0d4 100644 |
20 |
--- a/eclass/distutils-r1.eclass |
21 |
+++ b/eclass/distutils-r1.eclass |
22 |
@@ -106,6 +106,8 @@ esac |
23 |
# |
24 |
# - maturin - maturin backend |
25 |
# |
26 |
+# - no - no PEP517 build system (see below) |
27 |
+# |
28 |
# - pbr - pbr backend |
29 |
# |
30 |
# - pdm - pdm.pep517 backend |
31 |
@@ -121,6 +123,17 @@ esac |
32 |
# |
33 |
# The variable needs to be set before the inherit line. The eclass |
34 |
# adds appropriate build-time dependencies and verifies the value. |
35 |
+# |
36 |
+# The special value "no" indicates that the package has no build system. |
37 |
+# This is not equivalent to unset DISTUTILS_USE_PEP517 (legacy mode). |
38 |
+# It causes the eclass not to include any build system dependencies |
39 |
+# and to disable default python_compile() and python_install() |
40 |
+# implementations. Baseline Python deps and phase functions will still |
41 |
+# be set (depending on the value of DISTUTILS_OPTIONAL). Most of |
42 |
+# the other eclass functions will work. Testing venv will be provided |
43 |
+# in ${BUILD_DIR}/install after python_compile(), and if any (other) |
44 |
+# files are found in ${BUILD_DIR}/install after python_install(), they |
45 |
+# will be merged into ${D}. |
46 |
|
47 |
# @ECLASS_VARIABLE: DISTUTILS_USE_SETUPTOOLS |
48 |
# @DEFAULT_UNSET |
49 |
@@ -212,6 +225,10 @@ _distutils_set_globals() { |
50 |
bdep+=' |
51 |
>=dev-util/maturin-0.12.7[${PYTHON_USEDEP}]' |
52 |
;; |
53 |
+ no) |
54 |
+ # undo the generic deps added above |
55 |
+ bdep= |
56 |
+ ;; |
57 |
pbr) |
58 |
bdep+=' |
59 |
>=dev-python/pbr-5.8.0-r1[${PYTHON_USEDEP}]' |
60 |
@@ -789,7 +806,7 @@ distutils_install_for_testing() { |
61 |
distutils_write_namespace() { |
62 |
debug-print-function ${FUNCNAME} "${@}" |
63 |
|
64 |
- if [[ ! ${DISTUTILS_USE_PEP517} ]]; then |
65 |
+ if [[ ! ${DISTUTILS_USE_PEP517:-no} != no ]]; then |
66 |
die "${FUNCNAME} is available only in PEP517 mode" |
67 |
fi |
68 |
if [[ ${EBUILD_PHASE} != test || ! ${BUILD_DIR} ]]; then |
69 |
@@ -912,6 +929,9 @@ _distutils-r1_print_package_versions() { |
70 |
dev-util/maturin |
71 |
) |
72 |
;; |
73 |
+ no) |
74 |
+ return |
75 |
+ ;; |
76 |
pbr) |
77 |
packages+=( |
78 |
dev-python/pbr |
79 |
@@ -1207,6 +1227,10 @@ distutils_pep517_install() { |
80 |
debug-print-function ${FUNCNAME} "${@}" |
81 |
[[ ${#} -eq 1 ]] || die "${FUNCNAME} takes exactly one argument: root" |
82 |
|
83 |
+ if [[ ! ${DISTUTILS_USE_PEP517:-no} != no ]]; then |
84 |
+ die "${FUNCNAME} is available only in PEP517 mode" |
85 |
+ fi |
86 |
+ |
87 |
local root=${1} |
88 |
local -x WHEEL_BUILD_DIR=${BUILD_DIR}/wheel |
89 |
mkdir -p "${WHEEL_BUILD_DIR}" || die |
90 |
@@ -1351,6 +1375,9 @@ distutils-r1_python_compile() { |
91 |
in_iuse debug && use debug && |
92 |
MATURIN_PEP517_ARGS+=" --cargo-extra-args=--profile=dev" |
93 |
;; |
94 |
+ no) |
95 |
+ return |
96 |
+ ;; |
97 |
esac |
98 |
|
99 |
if [[ ${DISTUTILS_USE_PEP517} ]]; then |
100 |
@@ -1472,6 +1499,7 @@ distutils-r1_python_test() { |
101 |
distutils-r1_python_install() { |
102 |
debug-print-function ${FUNCNAME} "${@}" |
103 |
|
104 |
+ [[ ${DISTUTILS_USE_PEP517} == no ]] && return |
105 |
_python_check_EPYTHON |
106 |
|
107 |
local scriptdir=${EPREFIX}/usr/bin |
108 |
-- |
109 |
2.35.1 |