From e95acfe671c6c40ffdc92f466008dce3fce723a6 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 29 Mar 2010 21:42:11 +0200 Subject: do not require files to end in .py if they are passed on the command line or if they contain python somewhere in the shebang line. --- debian/changelog | 2 ++ utils/migrate-0.8.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 66f78d06..c0ff72c7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,8 @@ python-apt (0.7.94.3) UNRELEASED; urgency=low - 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. + - do not require files to end in .py if they are passed on the command + line or if they contain python somewhere in the shebang line. [ Michael Vogt ] * apt/cache.py: diff --git a/utils/migrate-0.8.py b/utils/migrate-0.8.py index 49596fc4..9f7790f7 100755 --- a/utils/migrate-0.8.py +++ b/utils/migrate-0.8.py @@ -193,7 +193,10 @@ def find_deprecated_py(): def find_occurences(all_old, files): """Find all ocurrences in the given Python files.""" for fname in files: - if fname.endswith('setup3.py') or not fname.endswith('.py'): + if not os.path.exists(fname): + continue + if not (fname in sys.argv or fname.endswith('.py') or + re.match('^#.*python.*', open(fname).readline())): continue words = defaultdict(lambda: set()) -- cgit v1.2.3