Convert paths
This commit is contained in:
parent
8387662e83
commit
a2a24f6648
@ -196,8 +196,6 @@ def apply_cmd_env(cmd):
|
|||||||
env = sub.run('{} && {}'.format(cmd, env_cmd), shell=True, universal_newlines=True,
|
env = sub.run('{} && {}'.format(cmd, env_cmd), shell=True, universal_newlines=True,
|
||||||
stdout=sub.PIPE)
|
stdout=sub.PIPE)
|
||||||
|
|
||||||
is_mingw = 'MINGW_CHOST' in os.environ
|
|
||||||
|
|
||||||
lines = env.stdout.split('\n')
|
lines = env.stdout.split('\n')
|
||||||
for line in lines:
|
for line in lines:
|
||||||
match = re.match(r"^([a-zA-Z0-9_-]+)=(.*)$", line)
|
match = re.match(r"^([a-zA-Z0-9_-]+)=(.*)$", line)
|
||||||
@ -206,10 +204,11 @@ def apply_cmd_env(cmd):
|
|||||||
key, value = match.groups()
|
key, value = match.groups()
|
||||||
if key in os.environ and os.environ[key] == value:
|
if key in os.environ and os.environ[key] == value:
|
||||||
continue
|
continue
|
||||||
if key in os.environ:
|
if key.lower().find('PATH') != -1 and value.find('/') != -1:
|
||||||
print('Changing', key, '\nfrom\n', os.environ[key], '\nto\n', value)
|
|
||||||
if is_mingw and key.find('PATH') != -1 and value.find('/') != -1:
|
|
||||||
value = value.replace(':', ';')
|
value = value.replace(':', ';')
|
||||||
value = re.sub(r'/(\w)/', r'\1:\\', value)
|
value = re.sub(r'/(\w)/', r'\1:\\', value)
|
||||||
value = value.replace('/', '\\')
|
value = value.replace('/', '\\')
|
||||||
|
if key in os.environ:
|
||||||
|
print('>>> Changing env', key, '\nfrom\n',
|
||||||
|
os.environ[key], '\nto\n', value)
|
||||||
os.environ[key] = value
|
os.environ[key] = value
|
||||||
|
Loading…
Reference in New Issue
Block a user