Skip to content

Commit

Permalink
yauto: Fix adding pyproject.toml deps and only do it once
Browse files Browse the repository at this point in the history
**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 <[email protected]>
  • Loading branch information
Staudey committed Feb 11, 2025
1 parent b34276b commit fa06f4a
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions common/Scripts/yauto.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
YARN = 10
WAF = 11
QMAKE = 12
PEP517 = 13


class DepObject:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit fa06f4a

Please sign in to comment.