[sabayon] Ignore errors from shutil.rmtree()
- From: Federico Mena Quintero <federico src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [sabayon] Ignore errors from shutil.rmtree()
- Date: Tue, 18 Aug 2009 17:44:44 +0000 (UTC)
commit 444cf150113447f8d25cd32f36188f17da0289cf
Author: Scott Balneaves <sbalneav legalaid mb ca>
Date: Tue Aug 18 12:44:40 2009 -0500
Ignore errors from shutil.rmtree()
None of the places where we recursively remove directories
really need to know about errors, anyway.
Signed-off-by: Federico Mena Quintero <federico novell com>
admin-tool/editorwindow.py | 6 +++---
admin-tool/sabayon-apply | 4 ++--
lib/protosession.py | 2 +-
lib/storage.py | 14 +++++++-------
4 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/admin-tool/editorwindow.py b/admin-tool/editorwindow.py
index 4d8dcca..0368979 100755
--- a/admin-tool/editorwindow.py
+++ b/admin-tool/editorwindow.py
@@ -261,11 +261,11 @@ class ProfileEditorWindow:
if source_name == _("GConf"):
viewer = gconfviewer.GConfViewer (extracted_path, description, self.window)
- viewer.connect ("destroy", lambda v, dir: shutil.rmtree (dir), extract_dir)
+ viewer.connect ("destroy", lambda v, dir: shutil.rmtree (dir, True), extract_dir)
viewer.show ()
elif source_name == _("Files") or source_name == _("Panel"):
viewer = fileviewer.FileViewer (extracted_path, description, self.window)
- viewer.connect ("destroy", lambda v, dir: shutil.rmtree (dir), extract_dir)
+ viewer.connect ("destroy", lambda v, dir: shutil.rmtree (dir, True), extract_dir)
viewer.show ()
else:
- shutil.rmtree (extract_dir)
+ shutil.rmtree (extract_dir, True)
diff --git a/admin-tool/sabayon-apply b/admin-tool/sabayon-apply
index a179019..ecab0ce 100755
--- a/admin-tool/sabayon-apply
+++ b/admin-tool/sabayon-apply
@@ -84,8 +84,8 @@ if __name__ == '__main__':
if userdb.get_database().is_sabayon_controlled (user_name):
try:
- shutil.rmtree (os.path.join (util.get_home_dir (), ".gconf.xml.defaults"))
- shutil.rmtree (os.path.join (util.get_home_dir (), ".gconf.xml.mandatory"))
+ shutil.rmtree (os.path.join (util.get_home_dir (), ".gconf.xml.defaults"), True)
+ shutil.rmtree (os.path.join (util.get_home_dir (), ".gconf.xml.mandatory"), True)
os.mkdir (os.path.join (util.get_home_dir (), ".gconf.xml.defaults"))
os.mkdir (os.path.join (util.get_home_dir (), ".gconf.xml.mandatory"))
except:
diff --git a/lib/protosession.py b/lib/protosession.py
index 8133131..899ed90 100644
--- a/lib/protosession.py
+++ b/lib/protosession.py
@@ -79,7 +79,7 @@ def reset_shell_and_homedir (username, temp_homedir):
usermod.set_homedir (username, "")
dprint ("Deleting temporary homedir '%s'", temp_homedir)
- shutil.rmtree (temp_homedir)
+ shutil.rmtree (temp_homedir, True)
dprint ("Resetting shell for '%s' to '%s'", username, NOLOGIN_SHELL)
usermod.set_shell (username, NOLOGIN_SHELL)
diff --git a/lib/storage.py b/lib/storage.py
index 595ab0b..e5c6fc0 100755
--- a/lib/storage.py
+++ b/lib/storage.py
@@ -136,7 +136,7 @@ class ProfileStorage:
def __del__ (self):
if self.temp_path:
- shutil.rmtree (self.temp_path)
+ shutil.rmtree (self.temp_path, True)
self.temp_path = None
if self.metadata:
@@ -644,7 +644,7 @@ class ProfileStorage:
os.remove (backup)
if self.temp_path:
- shutil.rmtree (self.temp_path)
+ shutil.rmtree (self.temp_path, True)
self.temp_path = None
self.needs_saving = False
@@ -782,7 +782,7 @@ def run_unit_tests ():
assert file (os.path.join (temp_dir2, "foobar/foo.txt")).read () == "new test file 6"
# Remove temporary extraction dir
- shutil.rmtree (temp_dir2)
+ shutil.rmtree (temp_dir2, True)
########## Create second revision
@@ -806,7 +806,7 @@ def run_unit_tests ():
profile.add ("blaas", temp_dir, "Waterford", { "nice" : True, "with-butter" : "but of course" })
# Remove temporary dir
- shutil.rmtree (temp_dir)
+ shutil.rmtree (temp_dir, True)
# Save the profile (second revision)
os.remove (profile_path)
@@ -874,7 +874,7 @@ def run_unit_tests ():
assert file (os.path.join (temp_dir2, "blaas/are/nice/foo.txt")).read () == "blaas are nice"
# Remove temporary extraction dir
- shutil.rmtree (temp_dir2)
+ shutil.rmtree (temp_dir2, True)
########## Create third revision
@@ -897,7 +897,7 @@ def run_unit_tests ():
assert os.path.exists (profile_path)
# Remove temp dir again
- shutil.rmtree (temp_dir)
+ shutil.rmtree (temp_dir, True)
########## Verify the third revision
@@ -958,6 +958,6 @@ def run_unit_tests ():
assert file (os.path.join (temp_dir, "foobar/foo.txt")).read () == "new test file 2005"
# Remove temporary extraction dir
- shutil.rmtree (temp_dir)
+ shutil.rmtree (temp_dir, True)
os.remove (profile_path)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]