Commits

Anonymous committed 4341574

Changed logic so it now replaces anything that has #! and python in
the first line, replacing the entire line.

Comments (0)

Files changed (1)

Tools/scripts/pathfix.py

-#! /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.
 	# Return succes
 	return 0
 
-prog = regex.compile('\(#![ \t]*\)\(/[^ \t\n]*\)\(.*\n\)')
-
 def fixline(line):
-	if prog.match(line) < 0:
+	if line[:2] != '#!':
 		return line
-	head, tail = prog.group(1, 3)
-	return head + new_interpreter + tail
+	if string.find(line, "python") < 0:
+		return line
+	return '#! %s\n' % new_interpreter
 
 main()