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

@ -6,6 +6,7 @@ import distutils.spawn
import os
import subprocess
import sys
import sysconfig
# work around https://github.com/Homebrew/homebrew-core/issues/30445
os.environ.pop('__PYVENV_LAUNCHER__', None)
@ -76,7 +77,10 @@ def _run_legacy():
def _validate_config():
cmd = ('git', 'rev-parse', '--show-toplevel')
top_level = subprocess.check_output(cmd).decode('UTF-8').strip()
top_level = fix_mingw_path(
subprocess.check_output(cmd).decode('UTF-8').
strip(),
)
cfg = os.path.join(top_level, CONFIG)
if os.path.isfile(cfg):
pass
@ -177,6 +181,21 @@ else:
_subprocess_call = subprocess.call
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():
path = subprocess.check_output([
'cygpath', '-m',
path,
]).decode().strip()
return path
def main():
retv, stdin = _run_legacy()
try: