[Python-checkins] CVS: python/dist/src/Tools/compiler regrtest.py,1.1,1.1.6.1
Jeremy Hylton
jhylton@users.sourceforge.net
Wed, 19 Dec 2001 11:42:54 -0800
Update of /cvsroot/python/python/dist/src/Tools/compiler
In directory usw-pr-cvs1:/tmp/cvs-serv25934
Modified Files:
Tag: release21-maint
regrtest.py
Log Message:
Backport changes from the 2.2 trunk
Index: regrtest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/compiler/regrtest.py,v
retrieving revision 1.1
retrieving revision 1.1.6.1
diff -C2 -d -r1.1 -r1.1.6.1
*** regrtest.py 2000/10/13 22:00:13 1.1
--- regrtest.py 2001/12/19 19:42:52 1.1.6.1
***************
*** 22,31 ****
return dest
def compile_files(dir):
! print "Compiling",
line_len = 10
for file in os.listdir(dir):
base, ext = os.path.splitext(file)
! if ext == '.py' and base[:4] == 'test':
source = os.path.join(dir, file)
line_len = line_len + len(file) + 1
--- 22,40 ----
return dest
+ def copy_library():
+ dest = tempfile.mktemp()
+ os.mkdir(dest)
+ libdir = os.path.split(test.__path__[0])[0]
+ print "Found standard library in", libdir
+ print "Creating copy of standard library in", dest
+ os.system("cp -r %s/* %s" % (libdir, dest))
+ return dest
+
def compile_files(dir):
! print "Compiling", dir, "\n\t",
line_len = 10
for file in os.listdir(dir):
base, ext = os.path.splitext(file)
! if ext == '.py':
source = os.path.join(dir, file)
line_len = line_len + len(file) + 1
***************
*** 34,45 ****
line_len = len(source) + 9
print file,
! compile(source)
# make sure the .pyc file is not over-written
os.chmod(source + "c", 444)
print
! def run_regrtest(test_dir):
os.chdir(test_dir)
! os.system("%s -v regrtest.py" % sys.executable)
def cleanup(dir):
--- 43,67 ----
line_len = len(source) + 9
print file,
! try:
! compile(source)
! except SyntaxError, err:
! print err
! continue
# make sure the .pyc file is not over-written
os.chmod(source + "c", 444)
+ else:
+ path = os.path.join(dir, file)
+ if os.path.isdir(path):
+ print
+ print
+ compile_files(path)
+ print "\t",
+ line_len = 10
print
! def run_regrtest(lib_dir):
! test_dir = os.path.join(lib_dir, "test")
os.chdir(test_dir)
! os.system("PYTHONPATH=%s %s -v regrtest.py" % (lib_dir, sys.executable))
def cleanup(dir):
***************
*** 47,54 ****
def main():
! test_dir = copy_test_suite()
! compile_files(test_dir)
! run_regrtest(test_dir)
! cleanup(test_dir)
if __name__ == "__main__":
--- 69,77 ----
def main():
! lib_dir = copy_library()
! compile_files(lib_dir)
! run_regrtest(lib_dir)
! raw_input("Cleanup?")
! cleanup(lib_dir)
if __name__ == "__main__":