# HG changeset patch # User Oleg Oshmyan # Date 1276549326 0 # Node ID 5bfa23cd638d22e21aca0323b85fe9b9b5da1fc9 # Parent d4fc9341664eb1d949a2c72f4ac78d72918d613a More ZIP archive fixes One typo and one Windows incompatibility fixed. diff -r d4fc9341664e -r 5bfa23cd638d 1.20/test.py --- a/1.20/test.py Sun Jun 13 12:46:49 2010 +0000 +++ b/1.20/test.py Mon Jun 14 21:02:06 2010 +0000 @@ -3,7 +3,7 @@ import os, sys, shutil, time, subprocess, filecmp, optparse, signal, tempfile, tarfile, zipfile -parser = optparse.OptionParser(version='test.py 1.20.2', usage='usage: %prog [options] [problem names] [[path/to/]solution-app] [test case numbers]\n\nTest case numbers can be specified in plain text or as a Python expression\nif there is only one positional argument.\n\nOnly problem names listed in testconf.py are recognized.') +parser = optparse.OptionParser(version='test.py 1.20.3', usage='usage: %prog [options] [problem names] [[path/to/]solution-app] [test case numbers]\n\nTest case numbers can be specified in plain text or as a Python expression\nif there is only one positional argument.\n\nOnly problem names listed in testconf.py are recognized.') parser.add_option('-e', '--exclude', dest='exclude', action='append', help='test case number(s) to exclude, as a Python expression; multiple -e options can be supplied') parser.add_option('-c', '--cleanup', dest='clean', action='store_true', default=False, help='delete the copies of input/output files and exit') parser.add_option('-s', '--save-io', dest='erase', action='store_false', default=True, help='do not delete the copies of input/output files after the last test case; create copies of input files and store output in files even if the solution uses standard I/O; delete the stored input/output files if the solution uses standard I/O and the -c/--cleanup option is specified') @@ -297,14 +297,14 @@ f = zipfile.ZipFile(oldcwd + '/tests.zip') try: m = f.getinfo(name) - m.filename = target[1:] + m.filename = os.path.relpath(target) f.extract(m) f.close() os.chdir(oldcwd) return True except KeyError: f.close() - os.chdir(oldwcd) + os.chdir(oldcwd) if os.path.isfile('tests.tgz'): f = tarfile.open('tests.tgz') try: diff -r d4fc9341664e -r 5bfa23cd638d test-svn.py --- a/test-svn.py Sun Jun 13 12:46:49 2010 +0000 +++ b/test-svn.py Mon Jun 14 21:02:06 2010 +0000 @@ -356,14 +356,14 @@ f = zipfile.ZipFile(os.path.join(oldcwd, 'tests.zip')) try: m = f.getinfo(name) - m.filename = target[1:] + m.filename = os.path.relpath(target) f.extract(m) f.close() os.chdir(oldcwd) return True except KeyError: f.close() - os.chdir(oldwcd) + os.chdir(oldcwd) if os.path.isfile('tests.tgz'): f = tarfile.open('tests.tgz') try: