summaryrefslogtreecommitdiffstats
path: root/Tools/scripts/fixps.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-12-09 23:14:40 (GMT)
committerGuido van Rossum <guido@python.org>1992-12-09 23:14:40 (GMT)
commit1d9741742ea6604f26c94a3ff4dd126ac097f797 (patch)
tree5a5dc8750181d3beca896dc18ac7ff654b98293d /Tools/scripts/fixps.py
parentd3592486cee15abf8bbd1ea5d70f92e7168376ce (diff)
downloadcpython-1d9741742ea6604f26c94a3ff4dd126ac097f797.zip
cpython-1d9741742ea6604f26c94a3ff4dd126ac097f797.tar.gz
cpython-1d9741742ea6604f26c94a3ff4dd126ac097f797.tar.bz2
Initial revision
Diffstat (limited to 'Tools/scripts/fixps.py')
-rwxr-xr-xTools/scripts/fixps.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/Tools/scripts/fixps.py b/Tools/scripts/fixps.py
new file mode 100755
index 0000000..c5e4cb3
--- /dev/null
+++ b/Tools/scripts/fixps.py
@@ -0,0 +1,32 @@
+#! /usr/local/bin/python
+
+# Fix Python script(s) to reference the interpreter in /usr/local/bin.
+
+import sys
+import regex
+import regsub
+
+
+def main():
+ for file in sys.argv[1:]:
+ try:
+ f = open(file, 'r+')
+ except IOError:
+ print f, ': can\'t open for update'
+ continue
+ line = f.readline()
+ if regex.match('^#! */usr/local/python', line) < 0:
+ print file, ': not a /usr/local/python script'
+ f.close()
+ continue
+ rest = f.read()
+ line = regsub.sub('/usr/local/python', \
+ '/usr/local/bin/python', line)
+ print file, ':', `line`
+ f.seek(0)
+ f.write(line)
+ f.write(rest)
+ f.close()
+
+
+main()