From 844b98643fa66410d228a6a2eecf75cab86fa9f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20A=C5=9F=C4=B1c=C4=B1?= Date: Wed, 7 Sep 2011 11:13:58 +0000 Subject: [PATCH] archive: Check existance of the directory before rmdir If the code path using os.renames is used, the directory would be removed. So check the existance of it before calling rmdir. --- pisi/archive.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pisi/archive.py b/pisi/archive.py index e9f443ab..a8f9cff0 100644 --- a/pisi/archive.py +++ b/pisi/archive.py @@ -319,7 +319,8 @@ class ArchiveTar(ArchiveBase): os.renames(old_path, new_path) - os.rmdir(tarinfo.name) + if os.path.exists(tarinfo.name): + os.rmdir(tarinfo.name) elif not os.path.lexists(tarinfo.linkname): # Symlink target does not exist. Assume the old