Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5d1e34a

Browse files
committed
Track changes to compiler API
1 parent 9dca364 commit 5d1e34a

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

Tools/compiler/compile.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22
import getopt
33

4-
from compiler import compile, visitor
4+
from compiler import compileFile, visitor
55

66
import profile
77

@@ -35,14 +35,16 @@ def main():
3535
print filename
3636
try:
3737
if PROFILE:
38-
profile.run('compile(%s, %s)' % (`filename`, `DISPLAY`),
38+
profile.run('compileFile(%s, %s)' % (`filename`,
39+
`DISPLAY`),
3940
filename + ".prof")
4041
else:
41-
compile(filename, DISPLAY)
42+
compileFile(filename, DISPLAY)
4243

4344
except SyntaxError, err:
4445
print err
45-
print err.lineno
46+
if err.lineno is not None:
47+
print err.lineno
4648
if not CONTINUE:
4749
sys.exit(-1)
4850

Tools/compiler/regrtest.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
that import problems can be observed easily.
88
"""
99

10-
from compiler import compile
10+
from compiler import compileFile
1111

1212
import os
1313
import sys
@@ -25,12 +25,13 @@ def copy_library():
2525
dest = tempfile.mktemp()
2626
os.mkdir(dest)
2727
libdir = os.path.split(test.__path__[0])[0]
28-
os.system("cp -r %s/* %s" % (libdir, dest))
28+
print "Found standard library in", libdir
2929
print "Creating copy of standard library in", dest
30+
os.system("cp -r %s/* %s" % (libdir, dest))
3031
return dest
3132

3233
def compile_files(dir):
33-
print "Compiling", dir
34+
print "Compiling", dir, "\n\t",
3435
line_len = 10
3536
for file in os.listdir(dir):
3637
base, ext = os.path.splitext(file)
@@ -42,7 +43,7 @@ def compile_files(dir):
4243
line_len = len(source) + 9
4344
print file,
4445
try:
45-
compile(source)
46+
compileFile(source)
4647
except SyntaxError, err:
4748
print err
4849
continue
@@ -51,14 +52,17 @@ def compile_files(dir):
5152
else:
5253
path = os.path.join(dir, file)
5354
if os.path.isdir(path):
55+
print
5456
print
5557
compile_files(path)
58+
print "\t",
59+
line_len = 10
5660
print
5761

5862
def run_regrtest(lib_dir):
5963
test_dir = os.path.join(lib_dir, "test")
6064
os.chdir(test_dir)
61-
os.system("PYTHONPATH=%s %s -v regrtest.py -r" % (lib_dir, sys.executable))
65+
os.system("PYTHONPATH=%s %s -v regrtest.py" % (lib_dir, sys.executable))
6266

6367
def cleanup(dir):
6468
os.system("rm -rf %s" % dir)

0 commit comments

Comments
 (0)