##// END OF EJS Templates
util: add removedirs as platform depending function...
FUJIWARA Katsunori -
r24692:144883a8 default
parent child Browse files
Show More
@@ -16,6 +16,7 b' samestat = os.path.samestat'
16 oslink = os.link
16 oslink = os.link
17 unlink = os.unlink
17 unlink = os.unlink
18 rename = os.rename
18 rename = os.rename
19 removedirs = os.removedirs
19 expandglobs = False
20 expandglobs = False
20
21
21 umask = os.umask(0)
22 umask = os.umask(0)
@@ -59,6 +59,7 b' posixfile = platform.posixfile'
59 quotecommand = platform.quotecommand
59 quotecommand = platform.quotecommand
60 readpipe = platform.readpipe
60 readpipe = platform.readpipe
61 rename = platform.rename
61 rename = platform.rename
62 removedirs = platform.removedirs
62 samedevice = platform.samedevice
63 samedevice = platform.samedevice
63 samefile = platform.samefile
64 samefile = platform.samefile
64 samestat = platform.samestat
65 samestat = platform.samestat
@@ -270,7 +270,7 b' def groupname(gid=None):'
270 If gid is None, return the name of the current group."""
270 If gid is None, return the name of the current group."""
271 return None
271 return None
272
272
273 def _removedirs(name):
273 def removedirs(name):
274 """special version of os.removedirs that does not remove symlinked
274 """special version of os.removedirs that does not remove symlinked
275 directories or junction points if they actually contain files"""
275 directories or junction points if they actually contain files"""
276 if osutil.listdir(name):
276 if osutil.listdir(name):
@@ -297,7 +297,7 b' def unlinkpath(f, ignoremissing=False):'
297 raise
297 raise
298 # try removing directories that might now be empty
298 # try removing directories that might now be empty
299 try:
299 try:
300 _removedirs(os.path.dirname(f))
300 removedirs(os.path.dirname(f))
301 except OSError:
301 except OSError:
302 pass
302 pass
303
303
General Comments 0
You need to be logged in to leave comments. Login now