More Msys2 fun!

This commit is contained in:
Thomas Nagy 2015-10-16 22:45:27 +02:00
parent 0357db5156
commit 971b2d32b7
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
3 changed files with 23 additions and 8 deletions

View File

@ -59,14 +59,11 @@ Ant patterns for files and folders to exclude while doing the
recursive traversal in :py:meth:`waflib.Node.Node.ant_glob`
"""
# TODO waf 1.9
split_path = Utils.split_path_unix
# TODO remove in waf 1.9
split_path = Utils.split_path
split_path_unix = Utils.split_path_unix
split_path_cygwin = Utils.split_path_cygwin
split_path_win32 = Utils.split_path_win32
if sys.platform == 'cygwin':
split_path = split_path_cygwin
elif Utils.is_win32:
split_path = split_path_win32
class Node(object):
"""

View File

@ -158,7 +158,10 @@ class link_task(Task.Task):
if len(nums) >= 2:
pattern += '.%s' % nums[1]
tmp = folder + os.sep + pattern % name
if folder:
tmp = folder + os.sep + pattern % name
else:
tmp = pattern % name
target = self.generator.path.find_or_declare(tmp)
self.set_outputs(target)

View File

@ -409,10 +409,25 @@ def split_path_win32(path):
return ret
return re.split(re_sp, path)
msysroot = None
def split_path_msys(path):
if (path.startswith('/') or path.startswith('\\')) and not path.startswith('//') and not path.startswith('\\\\'):
# msys paths can be in the form /usr/bin
global msysroot
if not msysroot:
# msys has python 2.7 or 3, so we can use this
msysroot = subprocess.check_output(['cygpath', '-w', '/']).decode(sys.stdout.encoding or 'iso8859-1')
msysroot = msysroot.strip()
path = os.path.normpath(msysroot + os.sep + path)
return split_path_win32(path)
if sys.platform == 'cygwin':
split_path = split_path_cygwin
elif is_win32:
split_path = split_path_win32
if os.environ.get('MSYSTEM', None):
split_path = split_path_msys
else:
split_path = split_path_win32
else:
split_path = split_path_unix