Mercurial > ~astiob > upreckon > hgweb
comparison upreckon-vcs @ 116:e17ae4ccbc58 2.00
Removed code omitted in 2.00 releases from the 2.00 branch
| author | Oleg Oshmyan <chortos@inbox.lv> |
|---|---|
| date | Fri, 08 Apr 2011 20:22:38 +0300 |
| parents | c4dba6d44194 |
| children |
comparison
equal
deleted
inserted
replaced
| 115:a28f84a8e603 | 116:e17ae4ccbc58 |
|---|---|
| 7 from compat import * | 7 from compat import * |
| 8 | 8 |
| 9 version = '2.00.1 ($$REV$$)' | 9 version = '2.00.1 ($$REV$$)' |
| 10 parser = optparse.OptionParser(version='Upreckon '+version, epilog='Python 2.5 or newer is required.') | 10 parser = optparse.OptionParser(version='Upreckon '+version, epilog='Python 2.5 or newer is required.') |
| 11 parser.add_option('-1', dest='legacy', action='store_true', default=False, help='handle configuration files in a way more compatible with test.py 1.x') | 11 parser.add_option('-1', dest='legacy', action='store_true', default=False, help='handle configuration files in a way more compatible with test.py 1.x') |
| 12 parser.add_option('-u', '--update', dest='update', action='store_true', default=False, help='update the installed Upreckon to the latest publicly available version') | |
| 13 parser.add_option('-p', '--problem', dest='problems', metavar='PROBLEM', action='append', help='test only the PROBLEM (this option can be specified more than once with different problem names, all of which will be tested)') | 12 parser.add_option('-p', '--problem', dest='problems', metavar='PROBLEM', action='append', help='test only the PROBLEM (this option can be specified more than once with different problem names, all of which will be tested)') |
| 14 parser.add_option('-m', '--copy-io', dest='copyonly', action='store_true', default=False, help='create a copy of the input/output files of the last test case for manual testing and exit') | 13 parser.add_option('-m', '--copy-io', dest='copyonly', action='store_true', default=False, help='create a copy of the input/output files of the last test case for manual testing and exit') |
| 15 parser.add_option('-x', '--auto-exit', dest='pause', action='store_false', default=True, help='do not wait for a key to be pressed after finishing testing') | 14 parser.add_option('-x', '--auto-exit', dest='pause', action='store_false', default=True, help='do not wait for a key to be pressed after finishing testing') |
| 16 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') | 15 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') |
| 17 parser.add_option('-t', '--detect-time', dest='autotime', action='store_true', default=False, help='spend a second detecting the most precise time measurement function') | 16 parser.add_option('-t', '--detect-time', dest='autotime', action='store_true', default=False, help='spend a second detecting the most precise time measurement function') |
| 18 parser.add_option('-k', '--skim', action='store_true', default=False, help='skip test groups as soon as one test case is failed') | 17 parser.add_option('-k', '--skim', action='store_true', default=False, help='skip test groups as soon as one test case is failed') |
| 19 parser.add_option('--no-time-limits', dest='no_maxtime', action='store_true', default=False, help='disable all time limits') | 18 parser.add_option('--no-time-limits', dest='no_maxtime', action='store_true', default=False, help='disable all time limits') |
| 20 | 19 |
| 21 options, args = parser.parse_args() | 20 options, args = parser.parse_args() |
| 22 parser.destroy() | 21 parser.destroy() |
| 23 del parser | 22 del parser |
| 24 | |
| 25 if options.update: | |
| 26 try: | |
| 27 urllib, urlread = compat.import_urllib() | |
| 28 except ImportError: | |
| 29 sys.exit('Error: the urllib Python module is missing. Without it, an automatic update is impossible.') | |
| 30 | |
| 31 latesttext = urlread('http://chortos.selfip.net/~astiob/test.py/version.txt') | |
| 32 latest = latesttext.split('.') | |
| 33 installed = version.split('.') | |
| 34 update = None | |
| 35 | |
| 36 if latest[0] > installed[0]: | |
| 37 update = 'major' | |
| 38 elif latest[0] == installed[0]: | |
| 39 if latest[1] > installed[1]: | |
| 40 update = 'feature' | |
| 41 elif latest[1] == installed[1]: | |
| 42 if latest[2] > installed[2]: | |
| 43 update = 'bug-fixing' | |
| 44 elif latest[2] == installed[2]: | |
| 45 say('You are using the latest publicly available version of Upreckon (%s).' % latesttext) | |
| 46 sys.exit() | |
| 47 | |
| 48 if not update: | |
| 49 say('Your copy of Upreckon is newer (%s) than the publicly available version (%s).' % (version, latesttext)) | |
| 50 sys.exit() | |
| 51 | |
| 52 say('A %s update to Upreckon is available (%s). Downloading...' % (update, latesttext)) | |
| 53 sys.stdout.flush() | |
| 54 # FIXME: need to update all files! | |
| 55 urllib.urlretrieve('http://chortos.selfip.net/~astiob/test.py/test.py', sys.argv[0]) | |
| 56 say('Downloaded and installed. Now you are using Upreckon %s.' % latesttext) | |
| 57 sys.exit() | |
| 58 | 23 |
| 59 import config, itertools, os, subprocess, sys, time | 24 import config, itertools, os, subprocess, sys, time |
| 60 | 25 |
| 61 if options.legacy: | 26 if options.legacy: |
| 62 compat.pseudobuiltins += 'xrange', | 27 compat.pseudobuiltins += 'xrange', |
