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 Nov 2, 2021
1 parent a7673e3 commit 1294ac3
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 @@ -255,6 +250,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 1294ac3

Please sign in to comment.