mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Fix NODE_PATH on win32
This commit is contained in:
parent
7f900395ec
commit
b0c7ae4d29
1 changed files with 3 additions and 1 deletions
|
|
@ -24,18 +24,20 @@ def _envdir(prefix, version):
|
||||||
|
|
||||||
|
|
||||||
def get_env_patch(venv): # pragma: windows no cover
|
def get_env_patch(venv): # pragma: windows no cover
|
||||||
|
lib_dir = 'lib'
|
||||||
if sys.platform == 'cygwin': # pragma: no cover
|
if sys.platform == 'cygwin': # pragma: no cover
|
||||||
_, win_venv, _ = cmd_output('cygpath', '-w', venv)
|
_, win_venv, _ = cmd_output('cygpath', '-w', venv)
|
||||||
install_prefix = r'{}\bin'.format(win_venv.strip())
|
install_prefix = r'{}\bin'.format(win_venv.strip())
|
||||||
elif sys.platform == 'win32': # pragma: no cover
|
elif sys.platform == 'win32': # pragma: no cover
|
||||||
install_prefix = bin_dir(venv)
|
install_prefix = bin_dir(venv)
|
||||||
|
lib_dir = 'Scripts'
|
||||||
else: # pragma: windows no cover
|
else: # pragma: windows no cover
|
||||||
install_prefix = venv
|
install_prefix = venv
|
||||||
return (
|
return (
|
||||||
('NODE_VIRTUAL_ENV', venv),
|
('NODE_VIRTUAL_ENV', venv),
|
||||||
('NPM_CONFIG_PREFIX', install_prefix),
|
('NPM_CONFIG_PREFIX', install_prefix),
|
||||||
('npm_config_prefix', install_prefix),
|
('npm_config_prefix', install_prefix),
|
||||||
('NODE_PATH', os.path.join(venv, 'lib', 'node_modules')),
|
('NODE_PATH', os.path.join(venv, lib_dir, 'node_modules')),
|
||||||
('PATH', (bin_dir(venv), os.pathsep, Var('PATH'))),
|
('PATH', (bin_dir(venv), os.pathsep, Var('PATH'))),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue