From: Guido van Rossum Date: Wed, 27 Nov 1996 19:43:01 +0000 (+0000) Subject: Changed logic so it now replaces anything that has #! and python in X-Git-Tag: v1.5a1~908 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d5c58c34dbe460b4cbaa2c79f9ff79b7c126ddec;p=thirdparty%2FPython%2Fcpython.git Changed logic so it now replaces anything that has #! and python in the first line, replacing the entire line. --- diff --git a/Tools/scripts/pathfix.py b/Tools/scripts/pathfix.py index b80ce7ea72ae..be04b2114ada 100755 --- a/Tools/scripts/pathfix.py +++ b/Tools/scripts/pathfix.py @@ -1,4 +1,4 @@ -#! /usr/local/bin/python +#! /usr/bin/env python # Change the #! line occurring in Python scripts. The new interpreter # pathname must be given with a -i option. @@ -139,12 +139,11 @@ def fix(filename): # Return succes return 0 -prog = regex.compile('\(#![ \t]*\)\(/[^ \t\n]*\)\(.*\n\)') - def fixline(line): - if prog.match(line) < 0: + if line[:2] != '#!': + return line + if string.find(line, "python") < 0: return line - head, tail = prog.group(1, 3) - return head + new_interpreter + tail + return '#! %s\n' % new_interpreter main()