tuna: Do not import tuna from setup.py
PATCH 1/1 tuna: Do not import tuna from setup.py
Commit cb5593a2be9c ("tuna: Get the tuna version from a single source") made setup.py import tuna.version. setup.py runs from the setuptools build backend, which does not put the source directory on sys.path (only the legacy backend does), so building with a PEP 517 frontend fails:
$ python3 -m build --no-isolation --wheel
...
File "<string>", line 9, in <module>
ModuleNotFoundError: No module named 'tuna'
ERROR Backend subprocess exited when trying to invoke get_requires_for_build_wheelpyproject.toml already takes the version from tuna.version.TUNA_VERSION via [tool.setuptools.dynamic], which setuptools reads without importing the package, so drop the import and the version argument from setup().
--- setup.py | 4 ---- 1 file changed, 4 deletions(-)
setup.py +0 -4
@@ -5,9 +5,6 @@ import sysconfig from os.path import isfile, relpath from setuptools import setup -# Get the tuna version from a single source -from tuna.version import TUNA_VERSION - if isfile("MANIFEST"): os.unlink("MANIFEST")
@@ -19,7 +16,6 @@ if SCHEME not in sysconfig.get_scheme_names(): PYTHONLIB = relpath(sysconfig.get_path('platlib', SCHEME), '/usr') setup(name="tuna", - version = TUNA_VERSION, description = "Application tuning GUI", author = "Arnaldo Carvalho de Melo, John Kacur", author_email = "[email protected], [email protected]",
Quoted 1 line · Khem Raj
tuna: Do not import tuna from
setup.py
Thanks for the patch, but I'd prefer not to take this one.
Keeping the version in setup.py is deliberate. A downstream build (RHEL9/CentOS Stream 9) still builds via the legacy setup.py path on setuptools 53, which predates PEP 621 and so does not read the dynamic version from pyproject.toml. Dropping "version=" from setup.py would leave that build without a version.
The failure you hit is specific to a setuptools whose build_meta backend doesn't put the source dir on sys.path. It's easy to work around without changing setup.py:
- PYTHONPATH="$PWD" python3 -m build --no-isolation --wheel
- or build the legacy way: python3 setup.py bdist_wheel
- or use a newer setuptools, whose build_meta adds the project root to sys.path and builds this unmodified.
Thanks,
John