From f70792180a8ca45a27b5cd6fee70515162ac6fd6 Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Fri, 13 Sep 2024 10:59:34 +0800 Subject: [PATCH] fix: remove the fallback backend for editable build error Signed-off-by: Frost Ming --- src/pdm/builders/editable.py | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/src/pdm/builders/editable.py b/src/pdm/builders/editable.py index 618bc61a8c..29f6098048 100644 --- a/src/pdm/builders/editable.py +++ b/src/pdm/builders/editable.py @@ -1,47 +1,27 @@ from __future__ import annotations import os -from typing import Any, ClassVar - -from pyproject_hooks import HookMissing from pdm.builders.base import EnvBuilder, wrap_error -from pdm.termui import logger class EditableBuilder(EnvBuilder): """Build egg-info in isolated env with managed Python.""" - FALLBACK_BACKEND: ClassVar[dict[str, Any]] = { - "build-backend": "setuptools_pep660", - "requires": ["setuptools_pep660"], - } - @wrap_error def prepare_metadata(self, out_dir: str) -> str: if self.isolated: self.install(self._requires, shared=True) - try: - if self.isolated: - requires = self._hook.get_requires_for_build_editable(self.config_settings) - self.install(requires) - filename = self._hook.prepare_metadata_for_build_editable(out_dir, self.config_settings) - except HookMissing: - self.init_build_system(self.FALLBACK_BACKEND) - return self.prepare_metadata(out_dir) + requires = self._hook.get_requires_for_build_editable(self.config_settings) + self.install(requires) + filename = self._hook.prepare_metadata_for_build_editable(out_dir, self.config_settings) return os.path.join(out_dir, filename) @wrap_error def build(self, out_dir: str, metadata_directory: str | None = None) -> str: if self.isolated: self.install(self._requires, shared=True) - try: - if self.isolated: - requires = self._hook.get_requires_for_build_editable(self.config_settings) - self.install(requires) - filename = self._hook.build_editable(out_dir, self.config_settings, metadata_directory) - except HookMissing: - logger.warning("The build backend doesn't support PEP 660, falling back to setuptools-pep660") - self.init_build_system(self.FALLBACK_BACKEND) - return self.build(out_dir, metadata_directory=metadata_directory) + requires = self._hook.get_requires_for_build_editable(self.config_settings) + self.install(requires) + filename = self._hook.build_editable(out_dir, self.config_settings, metadata_directory) return os.path.join(out_dir, filename)