From 33a28f0c0a787e0f78682d9326508316c781bbc7 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Mon, 29 Oct 2007 16:59:06 -0400 Subject: [PATCH] Fix reget better. Don't try to stat a nonexistant file --- pypungi/gather.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pypungi/gather.py b/pypungi/gather.py index e8c709ee..21d16e24 100755 --- a/pypungi/gather.py +++ b/pypungi/gather.py @@ -330,17 +330,18 @@ class Gather(pypungi.PungiBase): local = os.path.join(self.config.get('default', 'cachedir'), basename) target = os.path.join(pkgdir, basename) - cursize = os.stat(local)[6] totsize = long(po.size) + # this block needs work to be more efficient if os.path.exists(local) and self.verifyCachePkg(po, local): self.logger.debug("%s already exists and appears to be complete" % local) if os.path.exists(target): os.remove(target) # avoid traceback after interrupted download self._link(local, target) continue - else: + elif os.path.exists(local): # Check to see if the file on disk is bigger, and if so, remove it + cursize = os.stat(local)[6] if cursize >= totsize: os.unlink(local)