[jhbuild] uninstall: Use logging API, be more robust against files not existing
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild] uninstall: Use logging API, be more robust against files not existing
- Date: Fri, 15 Jul 2011 15:29:07 +0000 (UTC)
commit 93e1527a45666e5a5b79882add9a3fa8ac76b127
Author: Colin Walters <walters verbum org>
Date: Fri Jul 15 11:21:40 2011 -0400
uninstall: Use logging API, be more robust against files not existing
If a file in the manifest was deleted for some reason, don't hard
fail; maybe the user tried to uninstall by hand, and then remembered
'jhbuild uninstall'.
Also, use the logging API over 'print' for consistency.
jhbuild/utils/packagedb.py | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/jhbuild/utils/packagedb.py b/jhbuild/utils/packagedb.py
index c4ddf67..083e727 100644
--- a/jhbuild/utils/packagedb.py
+++ b/jhbuild/utils/packagedb.py
@@ -20,6 +20,7 @@
import os
import sys
import time
+import logging
import xml.dom.minidom as DOM
import xml.etree.ElementTree as ET
from StringIO import StringIO
@@ -187,8 +188,13 @@ class PackageDB:
if os.path.isdir(path):
directories.append(path)
else:
- os.unlink(path)
- print "Deleted %r" % (path, )
+ try:
+ os.unlink(path)
+ logging.info(_("Deleted: %s" % (path, )))
+ except OSError, e:
+ logging.warn(_("Failed to delete %(file)r: %(msg)s") % { 'file': path,
+ 'msg': e.strerror})
+
for directory in directories:
if not directory.startswith(buildscript.config.prefix):
# Skip non-prefix directories; otherwise we
@@ -197,7 +203,7 @@ class PackageDB:
continue
try:
os.rmdir(directory)
- print "Deleted %r" % (path, )
+ logging.info(_("Deleted: %s" % (path, )))
except OSError, e:
# Allow multiple components to use directories
pass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]