From 6bfdec45df338bea3563ec5ed30d0a0122d30a07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Fri, 11 Apr 2025 15:49:44 +0200 Subject: [PATCH] Fix using `setuptools.build_meta` backend Add the current directory path to `sys.path` explicitly, in order to fix using the correct `setuptools.build_meta` backend. The legacy backend is only meant to be used implicitly for packages that have not been ported to PEP 517 builds yet, and using it explicitly is invalid. The correct solution here is to set the import path correctly. --- pyproject.toml | 4 +--- setup.py | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ce02225d..b0642d95 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -76,9 +76,7 @@ requires = [ "requests >= 2.26.0", "sip == 6.10.0", ] -# Using "setuptools.build_meta:__legacy__" instead of "setuptools.build_meta" for now. -# Allows to have access to the folder on the search path when building, like before. -build-backend = "setuptools.build_meta:__legacy__" +build-backend = "setuptools.build_meta" [tool.setuptools.packages.find] exclude = ["src", "buildtools*", "etgtools", "sphinxtools", "src", "unittests"] diff --git a/setup.py b/setup.py index 27cc6691..71d57d69 100644 --- a/setup.py +++ b/setup.py @@ -20,6 +20,9 @@ from setuptools.command.bdist_egg import bdist_egg as orig_bdist_egg from setuptools.command.sdist import sdist as orig_sdist from setuptools.command.bdist_wheel import bdist_wheel as orig_bdist_wheel +# Alter the path so that buildtools can be imported from the current directory. +sys.path.insert(0, os.path.dirname(__file__)) + from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName import buildtools.version as version