performance: avoid jinja2
import at startup unless needed (#43237)
`jinja2` can be a costly import, and right now it happens at startup every time we run Spack. This slows down `spack --print-shell-vars` a bit, which is needed by `setup-env.*sh`.
This commit is contained in:
parent
8cd160db85
commit
3d8136493a
@ -9,8 +9,6 @@
|
||||
import tempfile
|
||||
from typing import Any, Deque, Dict, Generator, List, NamedTuple, Tuple
|
||||
|
||||
import jinja2
|
||||
|
||||
from llnl.util import filesystem
|
||||
|
||||
import spack.repo
|
||||
@ -85,6 +83,8 @@ def _mock_layout(self) -> Generator[List[str], None, None]:
|
||||
self.tmpdir.cleanup()
|
||||
|
||||
def _create_executable_scripts(self, mock_executables: MockExecutables) -> List[pathlib.Path]:
|
||||
import jinja2
|
||||
|
||||
relative_paths = mock_executables.executables
|
||||
script = mock_executables.script
|
||||
script_template = jinja2.Template("#!/bin/bash\n{{ script }}\n")
|
||||
|
Loading…
Reference in New Issue
Block a user