##// END OF EJS Templates
util: implement a faster os.path.split for posix systems...
Bryan O'Sullivan -
r17560:9ee25d7b default
parent child Browse files
Show More
@@ -20,6 +20,16 expandglobs = False
20 umask = os.umask(0)
20 umask = os.umask(0)
21 os.umask(umask)
21 os.umask(umask)
22
22
23 def split(p):
24 '''Same as os.path.split, but faster'''
25 ht = p.rsplit('/', 1)
26 if len(ht) == 1:
27 return '', p
28 nh = ht[0].rstrip('/')
29 if nh:
30 return nh, ht[1]
31 return ht
32
23 def openhardlinks():
33 def openhardlinks():
24 '''return true if it is safe to hold open file handles to hardlinks'''
34 '''return true if it is safe to hold open file handles to hardlinks'''
25 return True
35 return True
@@ -62,6 +62,7 setflags = platform.setflags
62 setsignalhandler = platform.setsignalhandler
62 setsignalhandler = platform.setsignalhandler
63 shellquote = platform.shellquote
63 shellquote = platform.shellquote
64 spawndetached = platform.spawndetached
64 spawndetached = platform.spawndetached
65 split = platform.split
65 sshargs = platform.sshargs
66 sshargs = platform.sshargs
66 statfiles = platform.statfiles
67 statfiles = platform.statfiles
67 termwidth = platform.termwidth
68 termwidth = platform.termwidth
@@ -20,6 +20,7 samedevice = win32.samedevice
20 samefile = win32.samefile
20 samefile = win32.samefile
21 setsignalhandler = win32.setsignalhandler
21 setsignalhandler = win32.setsignalhandler
22 spawndetached = win32.spawndetached
22 spawndetached = win32.spawndetached
23 split = os.path.split
23 termwidth = win32.termwidth
24 termwidth = win32.termwidth
24 testpid = win32.testpid
25 testpid = win32.testpid
25 unlink = win32.unlink
26 unlink = win32.unlink
General Comments 0
You need to be logged in to leave comments. Login now