[Pkg-python-debian-commits] trunk r94: Improvements to exception handling in the grep-maintainer example.
Adeodato Simó
dato at net.com.org.es
Fri Dec 28 10:56:45 UTC 2007
------------------------------------------------------------
revno: 94
committer: Adeodato Simó <dato at net.com.org.es>
branch nick: trunk
timestamp: Fri 2007-12-28 11:56:45 +0100
message:
Improvements to exception handling in the grep-maintainer example.
modified:
debian/changelog
examples/deb822/grep-maintainer
------------------------------------------------------------
revno: 91.2.1
committer: Adeodato Simó <dato at net.com.org.es>
branch nick: pd.misc
timestamp: Thu 2007-12-27 18:08:00 +0100
message:
Good python practice: specify which exception to catch.
modified:
examples/packages/grep-maintainer
------------------------------------------------------------
revno: 91.2.2
committer: Adeodato Simó <dato at net.com.org.es>
branch nick: pd.misc
timestamp: Fri 2007-12-28 11:52:20 +0100
message:
Print errors to stderr, and catch re.error. Suggested by Enrico.
modified:
examples/packages/grep-maintainer
------------------------------------------------------------
revno: 91.2.3
committer: Adeodato Simó <dato at net.com.org.es>
branch nick: pd.misc
timestamp: Fri 2007-12-28 11:54:33 +0100
message:
Changelog entry.
modified:
debian/changelog
-------------- next part --------------
=== modified file 'debian/changelog'
--- a/debian/changelog 2007-12-27 17:25:09 +0000
+++ b/debian/changelog 2007-12-28 10:56:45 +0000
@@ -22,6 +22,9 @@
accomodate the above change, make it cope with stanzas without a
maintainer field as well. (Closes: #457855)
+ * Small improvements to the exception handling in the grep-maintainer
+ example.
+
-- Stefano Zacchiroli <zack at debian.org> Mon, 24 Dec 2007 12:06:49 +0100
python-debian (0.1.7) unstable; urgency=low
=== modified file 'examples/deb822/grep-maintainer'
--- a/examples/deb822/grep-maintainer 2007-12-27 17:25:09 +0000
+++ b/examples/deb822/grep-maintainer 2007-12-28 10:56:45 +0000
@@ -16,8 +16,11 @@
try:
maint_RE = re.compile(sys.argv[1])
-except:
- print "Usage: grep-maintainer REGEXP"
+except IndexError:
+ print >>sys.stderr, "Usage: grep-maintainer REGEXP"
+ sys.exit(1)
+except re.error, e:
+ print >>sys.stderr, "Error in the regexp: %s" % (e,)
sys.exit(1)
for pkg in deb822.Packages.iter_paragraphs(file('/var/lib/dpkg/status')):
More information about the pkg-python-debian-commits
mailing list