1.1 --- a/astgrep.py Mon Oct 27 20:47:35 2008 +0100
1.2 +++ b/astgrep.py Mon Oct 27 22:49:29 2008 +0100
1.3 @@ -22,6 +22,7 @@
1.4
1.5 import compiler
1.6 import os
1.7 +import linecache
1.8
1.9 __version__ = "0.1"
1.10
1.11 @@ -108,11 +109,13 @@
1.12
1.13 # Main program.
1.14
1.15 -if __name__ == "__main__":
1.16 +def run_command():
1.17 +
1.18 + "The functionality of the main program."
1.19 +
1.20 import sys
1.21 import cmdsyntax
1.22 import re
1.23 - import linecache
1.24
1.25 # Match command arguments.
1.26
1.27 @@ -166,4 +169,7 @@
1.28
1.29 print format % tuple(output)
1.30
1.31 +if __name__ == "__main__":
1.32 + run_command()
1.33 +
1.34 # vim: tabstop=4 expandtab shiftwidth=4
2.1 --- a/scripts/astgrep Mon Oct 27 20:47:35 2008 +0100
2.2 +++ b/scripts/astgrep Mon Oct 27 22:49:29 2008 +0100
2.3 @@ -1,3 +1,7 @@
2.4 #!/bin/sh
2.5
2.6 -python -m astgrep $*
2.7 +# Python 2.4 and later:
2.8 +#python -m astgrep $*
2.9 +
2.10 +# Python 2.0 and later:
2.11 +python -c "import astgrep; astgrep.run_command()" $*