Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 1/2 v2] distutils-r1.eclass: Support deprecated flit/poetry backends
Date: Thu, 27 Jan 2022 20:28:28
Message-Id: 20220127202816.2976540-1-mgorny@gentoo.org
1 Detect, report and fix the deprecated flit/poetry backends to use
2 flit_core and poetry_core respectively. In both cases, the end result
3 is the same. Using flit involves unnecessary dependencies, and poetry
4 is not even packaged right now (and has even worse dependency hell).
5
6 Signed-off-by: Michał Górny <mgorny@g.o>
7 ---
8 eclass/distutils-r1.eclass | 25 +++++++++++++++++++++++--
9 1 file changed, 23 insertions(+), 2 deletions(-)
10
11 Changes in v2: instead of failing and requiring patching ebuilds,
12 just emit a QA warning and switch backend internally.
13
14 diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
15 index 7dfd92691b59..f7c6ea202ab0 100644
16 --- a/eclass/distutils-r1.eclass
17 +++ b/eclass/distutils-r1.eclass
18 @@ -862,13 +862,13 @@ _distutils-r1_backend_to_key() {
19
20 local backend=${1}
21 case ${backend} in
22 - flit_core.buildapi)
23 + flit_core.buildapi|flit.buildapi)
24 echo flit
25 ;;
26 pdm.pep517.api)
27 echo pdm
28 ;;
29 - poetry.core.masonry.api)
30 + poetry.core.masonry.api|poetry.masonry.api)
31 echo poetry
32 ;;
33 setuptools.build_meta|setuptools.build_meta:__legacy__)
34 @@ -950,6 +950,27 @@ distutils-r1_python_compile() {
35 eerror "(backend: ${build_backend})"
36 die "DISTUTILS_USE_PEP517 value incorrect"
37 fi
38 +
39 + # fix deprecated backends up
40 + local new_backend=
41 + case ${build_backend} in
42 + flit.buildapi)
43 + new_backend=flit_core.buildapi
44 + ;;
45 + poetry.masonry.api)
46 + new_backend=poetry.core.masonry.api
47 + ;;
48 + esac
49 +
50 + if [[ -n ${new_backend} ]]; then
51 + if [[ ! ${_DISTUTILS_DEPRECATED_BACKEND_WARNED} ]]; then
52 + eqawarn "${build_backend} backend is deprecated. Please see:"
53 + eqawarn "https://projects.gentoo.org/python/guide/distutils.html#deprecated-pep-517-backends"
54 + eqawarn "The eclass will be using ${new_backend} instead."
55 + _DISTUTILS_DEPRECATED_BACKEND_WARNED=1
56 + fi
57 + build_backend=${new_backend}
58 + fi
59 fi
60
61 einfo " Building the wheel via ${build_backend}"
62 --
63 2.35.0

Replies

Subject Author
[gentoo-dev] [PATCH 2/2] eclass: Update links to Gentoo Python Guide "Michał Górny" <mgorny@g.o>