summaryrefslogtreecommitdiff
path: root/eclass/distutils-r1.eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-02-29 18:01:47 +0000
committerV3n3RiX <venerix@redcorelinux.org>2020-02-29 18:01:47 +0000
commitceeeb463cc1eef97fd62eaee8bf2196ba04bc384 (patch)
tree9f47ee47c31a0f13f9496879cd88a1042550aa81 /eclass/distutils-r1.eclass
parent53cba99042fa967e2a93da9f8db806fe2d035543 (diff)
gentoo (leap year) resync : 29.02.2020
Diffstat (limited to 'eclass/distutils-r1.eclass')
-rw-r--r--eclass/distutils-r1.eclass29
1 files changed, 29 insertions, 0 deletions
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index e546aadfa4a7..27ca236ccf5f 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -86,6 +86,8 @@ esac
# - no -- do not add the dependency (pure distutils package)
# - bdepend -- add it to BDEPEND (the default)
# - rdepend -- add it to BDEPEND+RDEPEND (when using entry_points)
+# - pyproject.toml -- use pyproject2setuptools to install a project
+# using pyproject.toml (flit, poetry...)
# - manual -- do not add the depedency and suppress the checks
# (assumes you will take care of doing it correctly)
#
@@ -135,6 +137,9 @@ _distutils_set_globals() {
bdep+=" ${sdep}"
rdep+=" ${sdep}"
;;
+ pyproject.toml)
+ bdep+=" dev-python/pyproject2setuppy[${PYTHON_USEDEP}]"
+ ;;
*)
die "Invalid DISTUTILS_USE_SETUPTOOLS=${DISTUTILS_USE_SETUPTOOLS}"
;;
@@ -457,6 +462,7 @@ distutils_enable_tests() {
_distutils_verify_use_setuptools() {
[[ ${DISTUTILS_OPTIONAL} ]] && return
[[ ${DISTUTILS_USE_SETUPTOOLS} == manual ]] && return
+ [[ ${DISTUTILS_USE_SETUPTOOLS} == pyproject.toml ]] && return
# ok, those are cheap greps. we can try toimprove them if we hit
# false positives.
@@ -580,6 +586,28 @@ _distutils-r1_disable_ez_setup() {
fi
}
+# @FUNCTION: _distutils-r1_handle_pyproject_toml
+# @INTERNAL
+# @DESCRIPTION:
+# Generate setup.py for pyproject.toml if requested.
+_distutils-r1_handle_pyproject_toml() {
+ if [[ ! -f setup.py && -f pyproject.toml ]]; then
+ if [[ ${DISTUTILS_USE_SETUPTOOLS} == pyproject.toml ]]; then
+ cat > setup.py <<-EOF || die
+ #!/usr/bin/env python
+ from pyproject2setuppy.main import main
+ main()
+ EOF
+ chmod +x setup.py || die
+ else
+ eerror "No setup.py found but pyproject.toml is present. In order to enable"
+ eerror "pyproject.toml support in distutils-r1, set:"
+ eerror " DISTUTILS_USE_SETUPTOOLS=pyproject.toml"
+ die "No setup.py found and DISTUTILS_USE_SETUPTOOLS!=pyproject.toml"
+ fi
+ fi
+}
+
# @FUNCTION: distutils-r1_python_prepare_all
# @DESCRIPTION:
# The default python_prepare_all(). It applies the patches from PATCHES
@@ -608,6 +636,7 @@ distutils-r1_python_prepare_all() {
fi
_distutils-r1_disable_ez_setup
+ _distutils-r1_handle_pyproject_toml
if [[ ${DISTUTILS_IN_SOURCE_BUILD} && ! ${DISTUTILS_SINGLE_IMPL} ]]
then