diff options
| -rw-r--r-- | debian/changelog | 1 | ||||
| -rwxr-xr-x | utils/migrate-0.8.py | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog index 9a1ed281..66f78d06 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,7 @@ python-apt (0.7.94.3) UNRELEASED; urgency=low * utils/migrate-0.8.py: - Open files in universal newline support and pass filename to ast.parse. - Add has_key to the list of deprecated functions. + - Don't abort if parsing failed. [ Michael Vogt ] * apt/cache.py: diff --git a/utils/migrate-0.8.py b/utils/migrate-0.8.py index bc3bc599..49596fc4 100755 --- a/utils/migrate-0.8.py +++ b/utils/migrate-0.8.py @@ -197,7 +197,12 @@ def find_occurences(all_old, files): continue words = defaultdict(lambda: set()) - for i in ast.walk(ast.parse(open(fname, "rU").read(), fname)): + try: + node = ast.parse(open(fname, "rU").read(), fname) + except Exception, e: + print >> sys.stderr, "Ignoring %s: %s" % (fname, e) + continue + for i in ast.walk(node): if isinstance(i, _ast.ImportFrom): for alias in i.names: if alias.name in all_old: |
