[Rpm-metadata] genpkgmetadata.py

zpavlas at osuosl.org zpavlas at osuosl.org
Thu Dec 19 14:54:05 UTC 2013


 genpkgmetadata.py |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

New commits:
commit a45146a2e7bd623c72823edbeef1f22753625d78
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date:   Thu Dec 19 15:48:52 2013 +0100

    catch IOErrors when loading pkglist. BZ 1044997

diff --git a/genpkgmetadata.py b/genpkgmetadata.py
index 946f6b6..35e7fc9 100755
--- a/genpkgmetadata.py
+++ b/genpkgmetadata.py
@@ -199,14 +199,15 @@ def parse_args(args, conf):
 
     lst = []
     if conf.pkglist:
-        pfo = open(conf.pkglist, 'r')
-        for line in pfo.readlines():
-            line = line.strip()
-            if re.match('^\s*\#.*', line) or re.match('^\s*$', line):
-                continue
-            lst.append(line)
-        pfo.close()
-
+        try:
+            for line in open(conf.pkglist):
+                line = line.strip()
+                if re.match('^\s*\#.*', line) or re.match('^\s*$', line):
+                    continue
+                lst.append(line)
+        except EnvironmentError, e:
+            print >> sys.stderr, e
+            sys.exit(1)
     conf.pkglist = lst
 
     if conf.includepkg:


More information about the Rpm-metadata mailing list