tuna: Fix build with PEP 517 frontends

setup.py imports tuna.version from the source tree. The setuptools
build_meta backend does not put the source directory on sys.path, so
do_compile fails:

  File "<string>", line 9, in <module>
  ModuleNotFoundError: No module named 'tuna'
  ERROR Backend subprocess exited when trying to invoke get_requires_for_build_wheel

It only worked so far because python3targetconfig added an empty entry,
i.e. the current directory, to PYTHONPATH. The same happens with a plain
"python3 -m build" outside of OE.

pyproject.toml already gets the version from tuna.version via
[tool.setuptools.dynamic], so drop the import from setup.py.

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Khem Raj committed 2026-10-30 09:08:46 -07:00
1 parent 54697429ce
commit df1403411f
2 files changed
+51 -1

No files matched your search

@@ -0,0 +1,48 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 27 Oct 2026 22:59:58 -0700
Subject: [PATCH] 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_wheel
pyproject.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().
Upstream-Status: Submitted [https://lore.kernel.org/linux-rt-users/20261028061243.4061773-1-raj.khem@gmail.com/]
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
setup.py | 4 ----
1 file changed, 4 deletions(-)
diff --git a/setup.py b/setup.py
index 8036a64..07ec523 100755
--- a/setup.py
+++ b/setup.py
@@ -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 = "acme@redhat.com, jkacur@redhat.com",
@@ -3,7 +3,9 @@ HOMEPAGE = "https://rt.wiki.kernel.org/index.php/Tuna"
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
SRC_URI = "git://git.kernel.org/pub/scm/utils/tuna/tuna.git;branch=main"
SRC_URI = "git://git.kernel.org/pub/scm/utils/tuna/tuna.git;branch=main \
file://0001-tuna-Do-not-import-tuna-from-setup.py.patch \
"
SRCREV = "cb5593a2be9c26c8865f46bf29723c1ce93890aa"