From fa06f4abfc2f76a6c085439193195c4353ea0f8c Mon Sep 17 00:00:00 2001 From: Thomas Staudinger Date: Mon, 10 Feb 2025 03:04:52 +0100 Subject: [PATCH] yauto: Fix adding pyproject.toml deps and only do it once **Summary** The previous change to pyproject.toml happened to only work for sources also using other, higher-priority build systems. The logic for adding the dependencies to PYTHON_MODULE recipes was still based on strings. Additionaly the dependencies were added multiple times for each `pyproject.toml` or `setup.cfg file` found. Don't add additional dependencies if PEP 517 is already among known_types Make sure the PEP517 dependencies are correctly added if the source also uses other build systems instead of wrapping them in pkgconfig() Signed-off-by: Thomas Staudinger --- common/Scripts/yauto.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/common/Scripts/yauto.py b/common/Scripts/yauto.py index 136ec4e5d61..b9f3910f58d 100755 --- a/common/Scripts/yauto.py +++ b/common/Scripts/yauto.py @@ -42,6 +42,7 @@ YARN = 10 WAF = 11 QMAKE = 12 +PEP517 = 13 class DepObject: @@ -164,9 +165,11 @@ def examine_source(self): ) # Handle python modules respecting PEP517. if "pyproject.toml" in file or "setup.cfg" in file: - self.build_deps.extend(self.extra_build_deps(["python-build", "python-installer", - "python-packaging", "python-wheel"])) - + if not PEP517 in known_types: + known_types.append(PEP517) + pyproject_deps = ["python-build", "python-installer", + "python-packaging", "python-wheel"] + self.build_deps.extend(self.extra_build_deps(pyproject_deps)) if "Makefile.PL" in file or "Build.PL" in file: # This is a perl module known_types.append(PERL_MODULES) @@ -234,6 +237,9 @@ def examine_source(self): self.compile_type = YARN self.networking = True print("yarn") + elif PEP517 in known_types: + self.compile_type = PYTHON_MODULES + print("yarn") else: print("unknown") @@ -320,8 +326,11 @@ def create_yaml(self): total_str += "\nbuilddeps :\n" if self.build_deps is not None and len(self.build_deps) > 0: - if self.compile_type == PYTHON_MODULES: - total_str += self.build_deps + if self.compile_type == PYTHON_MODULES or self.component == "programming.python": + for dep in self.build_deps: + if len(dep.name.strip()) == 0: + continue + total_str += " - %s\n" % dep.name else: for dep in self.build_deps: if len(dep.name.strip()) == 0: