]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Changed logic so it now replaces anything that has #! and python in
authorGuido van Rossum <guido@python.org>
Wed, 27 Nov 1996 19:43:01 +0000 (19:43 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 27 Nov 1996 19:43:01 +0000 (19:43 +0000)
the first line, replacing the entire line.

Tools/scripts/pathfix.py

index b80ce7ea72ae39e818da571d76d7858190e145c5..be04b2114adabe64ed6c1e85bc53644d325eb790 100755 (executable)
@@ -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()