summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2010-03-29 21:42:11 +0200
committerJulian Andres Klode <jak@debian.org>2010-03-29 21:42:11 +0200
commite95acfe671c6c40ffdc92f466008dce3fce723a6 (patch)
tree9d733b93ca596e5130d21af7f28dd62d553a9b10
parent48b32fb4b820d92ca92b454a00131fb64ff6f883 (diff)
downloadpython-apt-e95acfe671c6c40ffdc92f466008dce3fce723a6.tar.gz
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.
-rw-r--r--debian/changelog2
-rwxr-xr-xutils/migrate-0.8.py5
2 files changed, 6 insertions, 1 deletions
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())