Commit 2c2b8c43 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

incase of symlink, we should just delete it instead of calling os.chmod that...

incase of symlink, we should just delete it instead of calling os.chmod that tries to chmod the original that can raise 'Operation not permitted' error.
parent 12706228
...@@ -54,8 +54,11 @@ def rmtree (path): ...@@ -54,8 +54,11 @@ def rmtree (path):
0 0
""" """
def retry_writeable (func, path, exc): def retry_writeable (func, path, exc):
os.chmod (path, 0600) if func == os.path.islink:
func (path) os.unlink(path)
else:
os.chmod (path, 0600)
func (path)
shutil.rmtree (path, onerror = retry_writeable) shutil.rmtree (path, onerror = retry_writeable)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment