Re-use the functions defined in waflib/Utils.py

This commit is contained in:
Thomas Nagy 2015-03-07 02:29:42 +01:00
parent 02f4e0f1c0
commit cca30e91f4
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
1 changed files with 4 additions and 29 deletions

View File

@ -59,35 +59,10 @@ Ant patterns for files and folders to exclude while doing the
recursive traversal in :py:meth:`waflib.Node.Node.ant_glob`
"""
def split_path(path):
"""
Split a path by os.sep (This is not os.path.split)
:param path: path to split
:type path: string
:rtype: list of string
:return: the path, split
"""
return path.split('/')
def split_path_cygwin(path):
if path.startswith('//'):
ret = path.split('/')[2:]
ret[0] = '/' + ret[0]
return ret
return path.split('/')
re_sp = re.compile('[/\\\\]')
def split_path_win32(path):
if path.startswith('\\\\'):
if path.startswith('\\\\?'):
path = path[4:]
else:
ret = re.split(re_sp, path)[2:]
ret[0] = '\\\\' + ret[0]
return ret
return re.split(re_sp, path)
# TODO waf 1.9
split_path = 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: