MCPcopy Index your code
hub / github.com/pre-commit/pre-commit / install_environment

Function install_environment

pre_commit/languages/lua.py:53–75  ·  view source on GitHub ↗
(
    prefix: Prefix,
    version: str,
    additional_dependencies: Sequence[str],
)

Source from the content-addressed store, hash-verified

51
52
53def install_environment(
54 prefix: Prefix,
55 version: str,
56 additional_dependencies: Sequence[str],
57) -> None: # pragma: win32 no cover
58 lang_base.assert_version_default('lua', version)
59
60 envdir = lang_base.environment_dir(prefix, ENVIRONMENT_DIR, version)
61 with in_env(prefix, version):
62 # luarocks doesn't bootstrap a tree prior to installing
63 # so ensure the directory exists.
64 os.makedirs(envdir, exist_ok=True)
65
66 # Older luarocks (e.g., 2.4.2) expect the rockspec as an arg
67 for rockspec in prefix.star('.rockspec'):
68 make_cmd = ('luarocks', '--tree', envdir, 'make', rockspec)
69 lang_base.setup_cmd(prefix, make_cmd)
70
71 # luarocks can't install multiple packages at once
72 # so install them individually.
73 for dependency in additional_dependencies:
74 cmd = ('luarocks', '--tree', envdir, 'install', dependency)
75 lang_base.setup_cmd(prefix, cmd)

Callers

nothing calls this directly

Calls 2

starMethod · 0.80
in_envFunction · 0.70

Tested by

no test coverage detected