diff options
| author | Julian Andres Klode <jak@debian.org> | 2009-01-12 17:01:34 +0100 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2009-01-12 17:01:34 +0100 |
| commit | 2e4443bbd9872f5599c9a8eb93a65d6c34c83ca2 (patch) | |
| tree | 86e6f869f2f0e59f99df0f49f679dcd7eeba5255 /aptsources/distinfo.py | |
| parent | eb32fb89da3e3e1ff4a9668aaed6d533f04e9ee7 (diff) | |
| download | python-apt-2e4443bbd9872f5599c9a8eb93a65d6c34c83ca2.tar.gz | |
Cleanup: Comparisons to True/False, ==/!= None, deprecated modules
Diffstat (limited to 'aptsources/distinfo.py')
| -rw-r--r-- | aptsources/distinfo.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/aptsources/distinfo.py b/aptsources/distinfo.py index 3c499b52..59fa7e02 100644 --- a/aptsources/distinfo.py +++ b/aptsources/distinfo.py @@ -27,11 +27,9 @@ import os import gettext from os import getenv import ConfigParser -import string -import apt_pkg +import re -#from gettext import gettext as _ -import gettext +import apt_pkg def _(s): @@ -76,9 +74,9 @@ class Component: self.description_long = long_desc def get_description(self): - if self.description_long != None: + if self.description_long is not None: return self.description_long - elif self.description != None: + elif self.description is not None: return self.description else: return None @@ -221,8 +219,8 @@ class DistInfo: mirror_set = {} try: mirror_data = filter(match_mirror_line.match, - map(string.strip, open(value))) - except: + [x.strip() for x in open(value)]) + except Exception: print "WARNING: Failed to read mirror file" mirror_data = [] for line in mirror_data: @@ -256,7 +254,7 @@ class DistInfo: if not template: return # reuse some properties of the parent template - if template.match_uri == None and template.child: + if template.match_uri is None and template.child: for t in template.parents: if t.match_uri: template.match_uri = t.match_uri |
