mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-13 04:20:28 -06:00
Fix appveyor and windows. Resolves #293
This commit is contained in:
@@ -31,15 +31,18 @@ def in_env(repo_cmd_runner, language_version):
|
||||
|
||||
|
||||
def norm_version(version):
|
||||
version = os.path.expanduser(version)
|
||||
if os.name == 'nt': # pragma: no cover (windows)
|
||||
if not distutils.spawn.find_executable(version):
|
||||
# expanduser introduces a leading slash
|
||||
version = version.strip('\\')
|
||||
# The default place for python on windows is:
|
||||
# C:\PythonXX\python.exe
|
||||
version = r'C:\{0}\python.exe'.format(version.replace('.', ''))
|
||||
return version
|
||||
# Try looking up by name
|
||||
if distutils.spawn.find_executable(version):
|
||||
return version
|
||||
|
||||
# If it is in the form pythonx.x search in the default
|
||||
# place on windows
|
||||
if version.startswith('python'):
|
||||
return r'C:\{0}\python.exe'.format(version.replace('.', ''))
|
||||
|
||||
# Otherwise assume it is a path
|
||||
return os.path.expanduser(version)
|
||||
|
||||
|
||||
def install_environment(
|
||||
|
||||
Reference in New Issue
Block a user