Use sys.executable instead of python.

This commit is contained in:
Anthony Sottile 2014-07-22 06:57:07 -07:00
parent 196fd87df0
commit 5956b7ab46

View file

@ -1,6 +1,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import contextlib import contextlib
import sys
from pre_commit.languages import helpers from pre_commit.languages import helpers
from pre_commit.prefixed_command_runner import CalledProcessError from pre_commit.prefixed_command_runner import CalledProcessError
@ -32,18 +33,18 @@ def install_environment(repo_cmd_runner, version='default'):
try: try:
with clean_path_on_failure(env_dir): with clean_path_on_failure(env_dir):
repo_cmd_runner.run([ repo_cmd_runner.run([
'python', '-m', 'nodeenv', '-n', 'system', sys.executable, '-m', 'nodeenv', '-n', 'system',
'{{prefix}}{0}'.format(ENVIRONMENT_DIR), '{{prefix}}{0}'.format(ENVIRONMENT_DIR),
]) ])
except CalledProcessError: except CalledProcessError:
# TODO: log failure here # TODO: log failure here
repo_cmd_runner.run([ repo_cmd_runner.run([
'python', '-m', 'nodeenv', '--prebuilt', sys.executable, '-m', 'nodeenv', '--prebuilt',
'{{prefix}}{0}'.format(ENVIRONMENT_DIR) '{{prefix}}{0}'.format(ENVIRONMENT_DIR)
]) ])
else: else:
repo_cmd_runner.run([ repo_cmd_runner.run([
'python', '-m', 'nodeenv', '--prebuilt', '-n', version, sys.executable, '-m', 'nodeenv', '--prebuilt', '-n', version,
'{{prefix}}{0}'.format(ENVIRONMENT_DIR) '{{prefix}}{0}'.format(ENVIRONMENT_DIR)
]) ])