Skip to content

Commit 1641663

Browse files
committed
faster PEP517 builds
1 parent 28d5c00 commit 1641663

File tree

2 files changed

+7
-25
lines changed

2 files changed

+7
-25
lines changed

src/poetry/inspection/info.py

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import functools
55
import glob
66
import logging
7-
import os
87

98
from pathlib import Path
109
from typing import TYPE_CHECKING
@@ -56,7 +55,7 @@
5655
builder.metadata_path(dest)
5756
"""
5857

59-
PEP517_META_BUILD_DEPS = ["build==1.0.3", "pyproject_hooks==1.0.0"]
58+
PEP517_META_BUILD_DEPS = ["build==1.1.1", "pyproject_hooks==1.0.0"]
6059

6160

6261
class PackageInfoError(ValueError):
@@ -579,7 +578,7 @@ def get_pep517_metadata(path: Path) -> PackageInfo:
579578
return info
580579

581580
with ephemeral_environment(
582-
flags={"no-pip": False, "setuptools": "bundle", "wheel": "bundle"}
581+
flags={"no-pip": False, "no-setuptools": True, "no-wheel": True}
583582
) as venv:
584583
# TODO: cache PEP 517 build environment corresponding to each project venv
585584
dest_dir = venv.path.parent / "dist"
@@ -600,28 +599,8 @@ def get_pep517_metadata(path: Path) -> PackageInfo:
600599
venv.run_python_script(pep517_meta_build_script)
601600
info = PackageInfo.from_metadata_directory(dest_dir)
602601
except EnvCommandError as e:
603-
# something went wrong while attempting pep517 metadata build
604-
# fallback to egg_info if setup.py available
605602
logger.debug("PEP517 build failed: %s", e)
606-
setup_py = path / "setup.py"
607-
if not setup_py.exists():
608-
raise PackageInfoError(
609-
path,
610-
e,
611-
"No fallback setup.py file was found to generate egg_info.",
612-
)
613-
614-
cwd = Path.cwd()
615-
os.chdir(path)
616-
try:
617-
venv.run("python", "setup.py", "egg_info")
618-
info = PackageInfo.from_metadata_directory(path)
619-
except EnvCommandError as fbe:
620-
raise PackageInfoError(
621-
path, e, "Fallback egg_info generation failed.", fbe
622-
)
623-
finally:
624-
os.chdir(cwd)
603+
raise PackageInfoError(path, e, "PEP517 build failed")
625604

626605
if info:
627606
logger.debug("Falling back to parsed setup.py file for %s", path)

src/poetry/installation/chef.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,10 @@ def _prepare(
127127
) -> Path:
128128
from subprocess import CalledProcessError
129129

130-
with ephemeral_environment(self._env.python) as venv:
130+
with ephemeral_environment(
131+
self._env.python,
132+
flags={"no-pip": True, "no-setuptools": True, "no-wheel": True},
133+
) as venv:
131134
env = IsolatedEnv(venv, self._pool)
132135
builder = ProjectBuilder.from_isolated_env(
133136
env, directory, runner=quiet_subprocess_runner

0 commit comments

Comments
 (0)