diff options
author | Guido van Rossum <guido@python.org> | 1998-04-06 14:20:27 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-04-06 14:20:27 (GMT) |
commit | e4e41062f58bbb78b584aea0f4d1871396c78ce2 (patch) | |
tree | 1590d27a7fa3a65cca02c93c4211eda1bfdd8721 /Tools/versioncheck | |
parent | 1ae297ae8b1852c771b131fde87ba1bf55e2291d (diff) | |
download | cpython-e4e41062f58bbb78b584aea0f4d1871396c78ce2.zip cpython-e4e41062f58bbb78b584aea0f4d1871396c78ce2.tar.gz cpython-e4e41062f58bbb78b584aea0f4d1871396c78ce2.tar.bz2 |
Reindented without tabs and with uniform 4 space indent.
Diffstat (limited to 'Tools/versioncheck')
-rw-r--r-- | Tools/versioncheck/pyversioncheck.py | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/Tools/versioncheck/pyversioncheck.py b/Tools/versioncheck/pyversioncheck.py index 612e02f..b6e50d3 100644 --- a/Tools/versioncheck/pyversioncheck.py +++ b/Tools/versioncheck/pyversioncheck.py @@ -18,61 +18,61 @@ _TESTDIR="http://www.cwi.nl/~jack/versiontestdir/" def versioncheck(package, url, version, verbose=0): ok, newversion, fp = checkonly(package, url, version, verbose) if verbose > VERBOSE_NORMAL: - return ok + return ok if ok < 0: - print '%s: No correctly formatted current version file found'%(package) + print '%s: No correctly formatted current version file found'%(package) elif ok == 1: - print '%s: up-to-date (version %s)'%(package, version) + print '%s: up-to-date (version %s)'%(package, version) else: - print '%s: version %s installed, version %s found:' % \ - (package, version, newversion) - if verbose > VERBOSE_SILENT: - while 1: - line = fp.readline() - if not line: break - sys.stdout.write('\t'+line) + print '%s: version %s installed, version %s found:' % \ + (package, version, newversion) + if verbose > VERBOSE_SILENT: + while 1: + line = fp.readline() + if not line: break + sys.stdout.write('\t'+line) return ok - + def checkonly(package, url, version, verbose=0): if verbose >= VERBOSE_EACHFILE: - print '%s:'%package + print '%s:'%package if type(url) == types.StringType: - ok, newversion, fp = _check1version(package, url, version, verbose) + ok, newversion, fp = _check1version(package, url, version, verbose) else: - for u in url: - ok, newversion, fp = _check1version(package, u, version, verbose) - if ok >= 0 and verbose < VERBOSE_CHECKALL: - break + for u in url: + ok, newversion, fp = _check1version(package, u, version, verbose) + if ok >= 0 and verbose < VERBOSE_CHECKALL: + break return ok, newversion, fp - + def _check1version(package, url, version, verbose=0): if verbose >= VERBOSE_EACHFILE: - print ' Checking %s'%url + print ' Checking %s'%url try: - fp = urllib.urlopen(url) + fp = urllib.urlopen(url) except IOError, arg: - if verbose >= VERBOSE_EACHFILE: - print ' Cannot open:', arg - return -1, None, None + if verbose >= VERBOSE_EACHFILE: + print ' Cannot open:', arg + return -1, None, None msg = rfc822.Message(fp, seekable=0) newversion = msg.getheader('current-version') if not newversion: - if verbose >= VERBOSE_EACHFILE: - print ' No "Current-Version:" header in URL or URL not found' - return -1, None, None + if verbose >= VERBOSE_EACHFILE: + print ' No "Current-Version:" header in URL or URL not found' + return -1, None, None version = string.strip(string.lower(version)) newversion = string.strip(string.lower(newversion)) if version == newversion: - if verbose >= VERBOSE_EACHFILE: - print ' Version identical (%s)'%newversion - return 1, version, fp + if verbose >= VERBOSE_EACHFILE: + print ' Version identical (%s)'%newversion + return 1, version, fp else: - if verbose >= VERBOSE_EACHFILE: - print ' Versions different (installed: %s, new: %s)'% \ - (version, newversion) - return 0, newversion, fp - - + if verbose >= VERBOSE_EACHFILE: + print ' Versions different (installed: %s, new: %s)'% \ + (version, newversion) + return 0, newversion, fp + + def _test(): print '--- TEST VERBOSE=1' print '--- Testing existing and identical version file' @@ -96,6 +96,6 @@ def _test(): versioncheck('VersionTestPackage', versfiles, '1.0', verbose=2) if __name__ == '__main__': - _test() + _test() |