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

Function get_env_patch

pre_commit/languages/node.py:39–58  ·  view source on GitHub ↗
(venv: str)

Source from the content-addressed store, hash-verified

37
38
39def get_env_patch(venv: str) -> PatchesT:
40 if sys.platform == 'cygwin': # pragma: no cover
41 _, win_venv, _ = cmd_output('cygpath', '-w', venv)
42 install_prefix = fr'{win_venv.strip()}\bin'
43 lib_dir = 'lib'
44 elif sys.platform == 'win32': # pragma: no cover
45 install_prefix = bin_dir(venv)
46 lib_dir = 'Scripts'
47 else: # pragma: win32 no cover
48 install_prefix = venv
49 lib_dir = 'lib'
50 return (
51 ('NODE_VIRTUAL_ENV', venv),
52 ('NPM_CONFIG_PREFIX', install_prefix),
53 ('npm_config_prefix', install_prefix),
54 ('NPM_CONFIG_USERCONFIG', UNSET),
55 ('npm_config_userconfig', UNSET),
56 ('NODE_PATH', os.path.join(venv, lib_dir, 'node_modules')),
57 ('PATH', (bin_dir(venv), os.pathsep, Var('PATH'))),
58 )
59
60
61@contextlib.contextmanager

Callers 1

in_envFunction · 0.70

Calls 3

cmd_outputFunction · 0.90
bin_dirFunction · 0.90
VarClass · 0.90

Tested by

no test coverage detected