mirror of https://gitlab.com/ita1024/waf.git
Re-use the functions defined in waflib/Utils.py
This commit is contained in:
parent
02f4e0f1c0
commit
cca30e91f4
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue