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 PEP 517-specific dependencies |
8 |
and the default python_compile() is a no-op. However, it does set |
9 |
dependencies, REQUIRED_USE and enables sub-phase usage (with respect to |
10 |
DISTUTILS_OPTIONAL). It also permits using |
11 |
distutils_enable_{sphinx,tests}. |
12 |
|
13 |
Signed-off-by: Michał Górny <mgorny@g.o> |
14 |
--- |
15 |
eclass/distutils-r1.eclass | 29 ++++++++++++++++++++++++++++- |
16 |
1 file changed, 28 insertions(+), 1 deletion(-) |
17 |
|
18 |
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass |
19 |
index 9293f744c7c2..f3d224a51224 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 |
@@ -792,7 +809,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 |
@@ -915,6 +932,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 |
@@ -1216,6 +1236,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 |
@@ -1360,6 +1384,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 |
-- |
101 |
2.35.1 |