Skip to content

Commit

Permalink
Only import importlib_metadata when needed
Browse files Browse the repository at this point in the history
Similar to #395, this helps with bootstrap issues with python < 3.8.
  • Loading branch information
jmroot committed Feb 3, 2022
1 parent 96f9188 commit b6c3a41
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/build/env.py
Expand Up @@ -18,11 +18,6 @@
import build


if sys.version_info < (3, 8):
import importlib_metadata as metadata
else:
from importlib import metadata

try:
import virtualenv
except ModuleNotFoundError:
Expand Down Expand Up @@ -260,6 +255,11 @@ def _create_isolated_env_venv(path: str) -> Tuple[str, str]:

import packaging.version

if sys.version_info < (3, 8):
import importlib_metadata as metadata
else:
from importlib import metadata

venv.EnvBuilder(with_pip=True, symlinks=_fs_supports_symlink()).create(path)
executable, script_dir, purelib = _find_executable_and_scripts(path)

Expand Down

0 comments on commit b6c3a41

Please sign in to comment.