Track changes to compiler API

This commit is contained in:
Jeremy Hylton 2001-09-17 21:31:35 +00:00
parent 9dca36432e
commit 5d1e34aa42
2 changed files with 15 additions and 9 deletions

View file

@ -1,7 +1,7 @@
import sys import sys
import getopt import getopt
from compiler import compile, visitor from compiler import compileFile, visitor
import profile import profile
@ -35,14 +35,16 @@ def main():
print filename print filename
try: try:
if PROFILE: if PROFILE:
profile.run('compile(%s, %s)' % (`filename`, `DISPLAY`), profile.run('compileFile(%s, %s)' % (`filename`,
`DISPLAY`),
filename + ".prof") filename + ".prof")
else: else:
compile(filename, DISPLAY) compileFile(filename, DISPLAY)
except SyntaxError, err: except SyntaxError, err:
print err print err
print err.lineno if err.lineno is not None:
print err.lineno
if not CONTINUE: if not CONTINUE:
sys.exit(-1) sys.exit(-1)

View file

@ -7,7 +7,7 @@ The regression test is run with the interpreter in verbose mode so
that import problems can be observed easily. that import problems can be observed easily.
""" """
from compiler import compile from compiler import compileFile
import os import os
import sys import sys
@ -25,12 +25,13 @@ def copy_library():
dest = tempfile.mktemp() dest = tempfile.mktemp()
os.mkdir(dest) os.mkdir(dest)
libdir = os.path.split(test.__path__[0])[0] libdir = os.path.split(test.__path__[0])[0]
os.system("cp -r %s/* %s" % (libdir, dest)) print "Found standard library in", libdir
print "Creating copy of standard library in", dest print "Creating copy of standard library in", dest
os.system("cp -r %s/* %s" % (libdir, dest))
return dest return dest
def compile_files(dir): def compile_files(dir):
print "Compiling", dir print "Compiling", dir, "\n\t",
line_len = 10 line_len = 10
for file in os.listdir(dir): for file in os.listdir(dir):
base, ext = os.path.splitext(file) base, ext = os.path.splitext(file)
@ -42,7 +43,7 @@ def compile_files(dir):
line_len = len(source) + 9 line_len = len(source) + 9
print file, print file,
try: try:
compile(source) compileFile(source)
except SyntaxError, err: except SyntaxError, err:
print err print err
continue continue
@ -51,14 +52,17 @@ def compile_files(dir):
else: else:
path = os.path.join(dir, file) path = os.path.join(dir, file)
if os.path.isdir(path): if os.path.isdir(path):
print
print print
compile_files(path) compile_files(path)
print "\t",
line_len = 10
print print
def run_regrtest(lib_dir): def run_regrtest(lib_dir):
test_dir = os.path.join(lib_dir, "test") test_dir = os.path.join(lib_dir, "test")
os.chdir(test_dir) os.chdir(test_dir)
os.system("PYTHONPATH=%s %s -v regrtest.py -r" % (lib_dir, sys.executable)) os.system("PYTHONPATH=%s %s -v regrtest.py" % (lib_dir, sys.executable))
def cleanup(dir): def cleanup(dir):
os.system("rm -rf %s" % dir) os.system("rm -rf %s" % dir)