From 6262939888a68bdf8ddfa539b8bdb7e97edaa60d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Wed, 12 Oct 2005 10:56:38 +0000 Subject: [PATCH] * loosen the requirement on hashes for external symlinks * cosmetics --- pisi-cli | 8 ++++---- pisi/files.py | 21 +++++++++++++-------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/pisi-cli b/pisi-cli index 6b28c37d..db068f46 100755 --- a/pisi-cli +++ b/pisi-cli @@ -36,18 +36,18 @@ def handle_exception(exception, value, tb): ui.error(unicode(value)) sys.exit(1) elif isinstance(value, pisi.Error): - ui.error(_("Fatal Error.")) + ui.error(_("\nFatal Error. Program Terminated.")) show_traceback = ctx.config.get_option('debug') elif isinstance(value, pisi.Exception): show_traceback = True ui.error(_(""" -Internal PISI Error. Please file a bug report. (http://bugs.uludag.org.tr) -""")) +Unhandled internal exception. +Please file a bug report. (http://bugs.uludag.org.tr)""")) else: # For any other exception (possibly Python exceptions) show # the traceback! show_traceback = ctx.config.get_option('debug') - ui.error(_("System Error.")) + ui.error(_("\nSystem Error. Program Terminated.")) ui.error("%s: %s\n" % (exception, value)) diff --git a/pisi/files.py b/pisi/files.py index fb4a8b2d..40399d39 100644 --- a/pisi/files.py +++ b/pisi/files.py @@ -22,7 +22,7 @@ import pisi.lockeddbshelve as shelve class FileInfo: """FileInfo holds the information for a File node/tag in files.xml""" - def __init__(self, _path = "", _type = "", _size = "", _hash = ""): + def __init__(self, _path = "", _type = "", _size = "", _hash = None): self.path = _path self.type = _type self.size = _size @@ -38,7 +38,11 @@ class FileInfo: self.path = getNodeText(getNode(node, "Path")) self.type = getNodeText(getNode(node, "Type")) self.size = getNodeText(getNode(node, "Size")) - self.hash = getNodeText(getNode(node, "SHA1Sum")) + hashnode = getNode(node, "SHA1Sum") + if hashnode: + self.hash = getNodeText(hashnode) + else: + self.hash = None def elt(self, dom): ## FIXME: looking for a better way to do it @@ -46,16 +50,17 @@ class FileInfo: elt = dom.createElement("File") pathElt = dom.createElement("Path") pathElt.appendChild(dom.createTextNode(self.path)) + elt.appendChild(pathElt) typeElt = dom.createElement("Type") typeElt.appendChild(dom.createTextNode(self.type)) + elt.appendChild(typeElt) sizeElt = dom.createElement("Size") sizeElt.appendChild(dom.createTextNode(self.size)) - hashElt = dom.createElement("SHA1Sum") - hashElt.appendChild(dom.createTextNode(self.hash)) - elt.appendChild(pathElt) - elt.appendChild(typeElt) elt.appendChild(sizeElt) - elt.appendChild(hashElt) + if self.hash: + hashElt = dom.createElement("SHA1Sum") + hashElt.appendChild(dom.createTextNode(self.hash)) + elt.appendChild(hashElt) return elt def has_errors(self): @@ -63,7 +68,7 @@ class FileInfo: err.has_tag(self.path, "File", "Path") err.has_tag(self.type, "File", "Type") err.has_tag(self.size, "File", "Size") - err.has_tag(self.hash, "File", "SHA1Sum") + #err.has_tag(self.hash, "File", "SHA1Sum") return err.list def __str__(self):