mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-18 11:31:46 +04:00
Add more checks for mingw platform
When the mingw platform is detected, several different path routines will be applied.
This commit is contained in:
parent
9850eae10a
commit
26c6af21ef
4 changed files with 47 additions and 5 deletions
|
|
@ -7,6 +7,7 @@ import shutil
|
|||
import stat
|
||||
import subprocess
|
||||
import sys
|
||||
import sysconfig
|
||||
import tempfile
|
||||
|
||||
import six
|
||||
|
|
@ -175,3 +176,16 @@ def rmtree(path):
|
|||
def parse_version(s):
|
||||
"""poor man's version comparison"""
|
||||
return tuple(int(p) for p in s.split('.'))
|
||||
|
||||
|
||||
def is_mingw():
|
||||
"""Check whether platform is mingw or not."""
|
||||
return sysconfig.get_platform() in 'mingw'
|
||||
|
||||
|
||||
def fix_mingw_path(path):
|
||||
"""Convert cygwin path to mingw-style path"""
|
||||
if is_mingw():
|
||||
_return, path, _output = cmd_output('cygpath', '-m', path)
|
||||
path = path.strip()
|
||||
return path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue