Commit 5073c205 by Arun Babu Neelicattu

env: align ephemeral environment interface to build

parent b21dd144
...@@ -450,7 +450,9 @@ class PackageInfo: ...@@ -450,7 +450,9 @@ class PackageInfo:
except PackageInfoError: except PackageInfoError:
pass pass
with ephemeral_environment(pip=True, wheel=True, setuptools=True) as venv: with ephemeral_environment(
with_pip=True, with_wheel=True, with_setuptools=True
) as venv:
# TODO: cache PEP 517 build environment corresponding to each project venv # TODO: cache PEP 517 build environment corresponding to each project venv
dest_dir = venv.path.parent / "dist" dest_dir = venv.path.parent / "dist"
dest_dir.mkdir() dest_dir.mkdir()
......
...@@ -1464,9 +1464,10 @@ class NullEnv(SystemEnv): ...@@ -1464,9 +1464,10 @@ class NullEnv(SystemEnv):
@contextmanager @contextmanager
def ephemeral_environment( def ephemeral_environment(
executable=None, executable=None,
pip: bool = False, flags: Dict[str, bool] = None,
wheel: Optional[bool] = None, with_pip: bool = False,
setuptools: Optional[bool] = None, with_wheel: Optional[bool] = None,
with_setuptools: Optional[bool] = None,
) -> ContextManager[VirtualEnv]: ) -> ContextManager[VirtualEnv]:
with temporary_directory() as tmp_dir: with temporary_directory() as tmp_dir:
# TODO: cache PEP 517 build environment corresponding to each project venv # TODO: cache PEP 517 build environment corresponding to each project venv
...@@ -1474,9 +1475,10 @@ def ephemeral_environment( ...@@ -1474,9 +1475,10 @@ def ephemeral_environment(
EnvManager.build_venv( EnvManager.build_venv(
path=venv_dir.as_posix(), path=venv_dir.as_posix(),
executable=executable, executable=executable,
with_pip=pip, flags=flags,
with_wheel=wheel, with_pip=with_pip,
with_setuptools=setuptools, with_wheel=with_wheel,
with_setuptools=with_setuptools,
) )
yield VirtualEnv(venv_dir, venv_dir) yield VirtualEnv(venv_dir, venv_dir)
......
...@@ -47,7 +47,7 @@ def pip_install( ...@@ -47,7 +47,7 @@ def pip_install(
# Under certain Python3.6 installs vendored pip wheel does not contain zip-safe # Under certain Python3.6 installs vendored pip wheel does not contain zip-safe
# pep517 lib. In this cases we create an isolated ephemeral virtual environment. # pep517 lib. In this cases we create an isolated ephemeral virtual environment.
with ephemeral_environment( with ephemeral_environment(
executable=environment.python, pip=True, setuptools=True executable=environment.python, with_pip=True, with_setuptools=True
) as env: ) as env:
return environment.run( return environment.run(
env._bin("pip"), env._bin("pip"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment