equal
deleted
inserted
replaced
268 """Return the name of the group with the given gid. |
268 """Return the name of the group with the given gid. |
269 |
269 |
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): |
277 return |
277 return |
278 os.rmdir(name) |
278 os.rmdir(name) |
295 except OSError, e: |
295 except OSError, e: |
296 if not (ignoremissing and e.errno == errno.ENOENT): |
296 if not (ignoremissing and e.errno == errno.ENOENT): |
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 |
304 def rename(src, dst): |
304 def rename(src, dst): |
305 '''atomically rename file src to dst, replacing dst if it exists''' |
305 '''atomically rename file src to dst, replacing dst if it exists''' |