Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
  • Loading branch information
gaborbernat committed Jun 20, 2023
1 parent b28ff7e commit cb5376e
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/tox/tox_env/python/virtual_env/package/pyproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,6 @@ def _setup_env(self) -> None:
if "wheel" in self.call_require_hooks:
self._setup_build_requires("wheel")
if "editable" in self.call_require_hooks:
if not self._frontend.optional_hooks["build_editable"]:
raise BuildEditableNotSupportedError
self._setup_build_requires("editable")

def _setup_build_requires(self, of_type: str) -> None:
Expand All @@ -188,13 +186,12 @@ def _teardown(self) -> None:

def perform_packaging(self, for_env: EnvConfigSet) -> list[Package]:
"""Build the package to install."""
try:
deps = self._load_deps(for_env)
except BuildEditableNotSupportedError:

if "editable" in self.builds and not self._frontend.optional_hooks["build_editable"]:
targets = [e for e in self.builds.pop("editable") if e["package"] == "editable"]
names = ", ".join(sorted({t.env_name for t in targets if t.env_name}))

logging.error( # noqa: TRY400
logging.error(
"package config for %s is editable, however the build backend %s does not support PEP-660, falling "
"back to editable-legacy - change your configuration to it",
names,
Expand All @@ -203,7 +200,8 @@ def perform_packaging(self, for_env: EnvConfigSet) -> list[Package]:
for env in targets:
env._defined["package"].value = "editable-legacy" # type: ignore[attr-defined] # noqa: SLF001
self.builds["editable-legacy"].append(env)
deps = self._load_deps(for_env)

deps = self._load_deps(for_env)
of_type: str = for_env["package"]
if of_type == "editable-legacy":
self.setup()
Expand Down Expand Up @@ -338,7 +336,7 @@ def __init__(self, root: Path, env: Pep517VirtualEnvPackager) -> None:
into: dict[str, Any] = {}

for hook in chain(
(f"get_requires_for_build_{build_type}" for build_type in ["editable", "wheel"]),
(f"get_requires_for_build_{build_type}" for build_type in ["editable", "wheel", "sdist"]),
(f"prepare_metadata_for_build_{build_type}" for build_type in ["editable", "wheel"]),
(f"build_{build_type}" for build_type in ["editable", "sdist", "wheel"]),
): # wrap build methods in a cache wrapper
Expand Down

0 comments on commit cb5376e

Please sign in to comment.