diff --git a/waflib/Node.py b/waflib/Node.py index 9b1109ef..5943d1dd 100644 --- a/waflib/Node.py +++ b/waflib/Node.py @@ -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): """ diff --git a/waflib/Tools/ccroot.py b/waflib/Tools/ccroot.py index 363d18d1..ac10803f 100644 --- a/waflib/Tools/ccroot.py +++ b/waflib/Tools/ccroot.py @@ -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) diff --git a/waflib/Utils.py b/waflib/Utils.py index 26299d42..1c00d2c7 100644 --- a/waflib/Utils.py +++ b/waflib/Utils.py @@ -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