changeset 20:5bfa23cd638d

More ZIP archive fixes One typo and one Windows incompatibility fixed.
author Oleg Oshmyan <chortos@inbox.lv>
date Mon, 14 Jun 2010 21:02:06 +0000
parents d4fc9341664e
children ec6f1a132109
files 1.20/test.py test-svn.py
diffstat 2 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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:
--- 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: