Add more checks for mingw platform

When the mingw platform is detected, several different path routines will be applied.
This commit is contained in:
Peter Mosmans 2019-06-08 20:07:01 +00:00
parent 9850eae10a
commit 26c6af21ef
4 changed files with 47 additions and 5 deletions

View file

@ -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