summaryrefslogtreecommitdiffstats
path: root/Tools/scripts/pathfix.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-11-27 19:43:01 (GMT)
committerGuido van Rossum <guido@python.org>1996-11-27 19:43:01 (GMT)
commitd5c58c34dbe460b4cbaa2c79f9ff79b7c126ddec (patch)
tree72a8c454320c5c94263791ccf848d382d61866e2 /Tools/scripts/pathfix.py
parentfc0588241cee6e2d38ff0ab8cf8cc0d35f5b790b (diff)
downloadcpython-d5c58c34dbe460b4cbaa2c79f9ff79b7c126ddec.zip
cpython-d5c58c34dbe460b4cbaa2c79f9ff79b7c126ddec.tar.gz
cpython-d5c58c34dbe460b4cbaa2c79f9ff79b7c126ddec.tar.bz2
Changed logic so it now replaces anything that has #! and python in
the first line, replacing the entire line.
Diffstat (limited to 'Tools/scripts/pathfix.py')
-rwxr-xr-xTools/scripts/pathfix.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/Tools/scripts/pathfix.py b/Tools/scripts/pathfix.py
index b80ce7e..be04b21 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()