-
Bug
-
Resolution: Fixed
-
Normal
-
None
-
None
-
None
Currently, distutils-r1.eclass contains some ugly system for handling files that have no setup.py but include pyproject.toml. In this case, a dependency on mgorny's pyproject2setuppy catpkg is injected into the ebuild and a setup.py is installed that uses mgorny's code. this is unnecessary as far as I can tell. You can simply install a stub setup.py like so:
#!/usr/bin/env python import setuptools if __name__ == "__main__": setuptools.setup()
I have a tweaked version of distutils-r1.eclass that will just automatically inject this stub if there is a pyproject.toml but not setup.py, and doesn not require DISTUTILS_USE_SETUPTOOLS to even be set to anything special:
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index e0e7a94..89a4ec3 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -129,9 +129,6 @@ _distutils_set_globals() { bdep+=" ${setuptools_dep}" rdep+=" ${setuptools_dep}" ;; - pyproject.toml) - bdep+=' dev-python/pyproject2setuppy[${PYTHON_USEDEP}]' - ;; *) die "Invalid DISTUTILS_USE_SETUPTOOLS=${DISTUTILS_USE_SETUPTOOLS}" ;; @@ -596,19 +593,13 @@ _distutils-r1_disable_ez_setup() { # 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 + cat > setup.py <<EOF || die +#!/usr/bin/env python +import setuptools +if __name__ == "__main__": + setuptools.setup() +EOF + chmod +x setup.py || die fi }
This works well with the new twine autogen I'm working on for Fl-8660.