summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-01-27 11:09:49 +0100
committerMichał Górny <mgorny@gentoo.org>2022-01-29 00:01:23 +0100
commit7cbd714491bd8a138dad0cec791b8e8f104c29cc (patch)
treefd48c45a6dda76fdff1ee27c42858e8ba7304614 /eclass/distutils-r1.eclass
parentdev-python/bandit: Switch to PEP 517 build (diff)
downloadgentoo-7cbd714491bd8a138dad0cec791b8e8f104c29cc.tar.gz
gentoo-7cbd714491bd8a138dad0cec791b8e8f104c29cc.tar.bz2
gentoo-7cbd714491bd8a138dad0cec791b8e8f104c29cc.zip
distutils-r1.eclass: Support deprecated flit/poetry backends
Detect, report and fix the deprecated flit/poetry backends to use flit_core and poetry_core respectively. In both cases, the end result is the same. Using flit involves unnecessary dependencies, and poetry is not even packaged right now (and has even worse dependency hell). Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/distutils-r1.eclass')
-rw-r--r--eclass/distutils-r1.eclass25
1 files changed, 23 insertions, 2 deletions
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 7dfd92691b59..f7c6ea202ab0 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -862,13 +862,13 @@ _distutils-r1_backend_to_key() {
local backend=${1}
case ${backend} in
- flit_core.buildapi)
+ flit_core.buildapi|flit.buildapi)
echo flit
;;
pdm.pep517.api)
echo pdm
;;
- poetry.core.masonry.api)
+ poetry.core.masonry.api|poetry.masonry.api)
echo poetry
;;
setuptools.build_meta|setuptools.build_meta:__legacy__)
@@ -950,6 +950,27 @@ distutils-r1_python_compile() {
eerror "(backend: ${build_backend})"
die "DISTUTILS_USE_PEP517 value incorrect"
fi
+
+ # fix deprecated backends up
+ local new_backend=
+ case ${build_backend} in
+ flit.buildapi)
+ new_backend=flit_core.buildapi
+ ;;
+ poetry.masonry.api)
+ new_backend=poetry.core.masonry.api
+ ;;
+ esac
+
+ if [[ -n ${new_backend} ]]; then
+ if [[ ! ${_DISTUTILS_DEPRECATED_BACKEND_WARNED} ]]; then
+ eqawarn "${build_backend} backend is deprecated. Please see:"
+ eqawarn "https://projects.gentoo.org/python/guide/distutils.html#deprecated-pep-517-backends"
+ eqawarn "The eclass will be using ${new_backend} instead."
+ _DISTUTILS_DEPRECATED_BACKEND_WARNED=1
+ fi
+ build_backend=${new_backend}
+ fi
fi
einfo " Building the wheel via ${build_backend}"