summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-10-06 08:35:38 (GMT)
committerGeorg Brandl <georg@python.org>2010-10-06 08:35:38 (GMT)
commit13f959b50185bc664497d95f3d370aa9aad34365 (patch)
treef9198559fe16a7d7ffc90eeefa8a367295eeb5a1 /Tools
parent4009c9edfc18a37ea0be473542a30c7c858155e0 (diff)
downloadcpython-13f959b50185bc664497d95f3d370aa9aad34365.zip
cpython-13f959b50185bc664497d95f3d370aa9aad34365.tar.gz
cpython-13f959b50185bc664497d95f3d370aa9aad34365.tar.bz2
Merged revisions 83561,83563,83565-83566,83569,83571,83574-83575,83580,83584,83599,83612,83659,83977,84015-84018,84020,84141 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k ........ r83561 | georg.brandl | 2010-08-02 22:17:50 +0200 (Mo, 02 Aug 2010) | 1 line #4280: remove outdated "versionchecker" tool. ........ r83563 | georg.brandl | 2010-08-02 22:21:21 +0200 (Mo, 02 Aug 2010) | 1 line #9037: add example how to raise custom exceptions from C code. ........ r83565 | georg.brandl | 2010-08-02 22:27:20 +0200 (Mo, 02 Aug 2010) | 1 line #9111: document that do_help() looks at docstrings. ........ r83566 | georg.brandl | 2010-08-02 22:30:57 +0200 (Mo, 02 Aug 2010) | 1 line #9019: remove false (in 3k) claim about Headers updates. ........ r83569 | georg.brandl | 2010-08-02 22:39:35 +0200 (Mo, 02 Aug 2010) | 1 line #7797: be explicit about bytes-oriented interface of base64 functions. ........ r83571 | georg.brandl | 2010-08-02 22:44:34 +0200 (Mo, 02 Aug 2010) | 1 line Clarify that abs() is not a namespace. ........ r83574 | georg.brandl | 2010-08-02 22:47:56 +0200 (Mo, 02 Aug 2010) | 1 line #6867: epoll.register() returns None. ........ r83575 | georg.brandl | 2010-08-02 22:52:10 +0200 (Mo, 02 Aug 2010) | 1 line #9238: zipfile does handle archive comments. ........ r83580 | georg.brandl | 2010-08-02 23:02:36 +0200 (Mo, 02 Aug 2010) | 1 line #8119: fix copy-paste error. ........ r83584 | georg.brandl | 2010-08-02 23:07:14 +0200 (Mo, 02 Aug 2010) | 1 line #9457: fix documentation links for 3.2. ........ r83599 | georg.brandl | 2010-08-02 23:51:18 +0200 (Mo, 02 Aug 2010) | 1 line #9061: warn that single quotes are never escaped. ........ r83612 | georg.brandl | 2010-08-03 00:59:44 +0200 (Di, 03 Aug 2010) | 1 line Fix unicode literal. ........ r83659 | georg.brandl | 2010-08-03 14:06:29 +0200 (Di, 03 Aug 2010) | 1 line Terminology fix: exceptions are raised, except in generator.throw(). ........ r83977 | georg.brandl | 2010-08-13 17:10:49 +0200 (Fr, 13 Aug 2010) | 1 line Fix copy-paste error. ........ r84015 | georg.brandl | 2010-08-14 17:44:34 +0200 (Sa, 14 Aug 2010) | 1 line Add some maintainers. ........ r84016 | georg.brandl | 2010-08-14 17:46:15 +0200 (Sa, 14 Aug 2010) | 1 line Wording fix. ........ r84017 | georg.brandl | 2010-08-14 17:46:59 +0200 (Sa, 14 Aug 2010) | 1 line Typo fix. ........ r84018 | georg.brandl | 2010-08-14 17:48:49 +0200 (Sa, 14 Aug 2010) | 1 line Typo fix. ........ r84020 | georg.brandl | 2010-08-14 17:57:20 +0200 (Sa, 14 Aug 2010) | 1 line Fix format. ........ r84141 | georg.brandl | 2010-08-17 16:11:59 +0200 (Di, 17 Aug 2010) | 1 line Markup nits. ........
Diffstat (limited to 'Tools')
-rw-r--r--Tools/scripts/win_add2path.py2
-rw-r--r--Tools/versioncheck/README41
-rw-r--r--Tools/versioncheck/_checkversion.py16
-rw-r--r--Tools/versioncheck/checkversions.py52
-rw-r--r--Tools/versioncheck/pyversioncheck.py97
5 files changed, 1 insertions, 207 deletions
diff --git a/Tools/scripts/win_add2path.py b/Tools/scripts/win_add2path.py
index b024789..9259b44 100644
--- a/Tools/scripts/win_add2path.py
+++ b/Tools/scripts/win_add2path.py
@@ -15,7 +15,7 @@ import winreg
HKCU = winreg.HKEY_CURRENT_USER
ENV = "Environment"
PATH = "PATH"
-DEFAULT = u"%PATH%"
+DEFAULT = "%PATH%"
def modify():
pythonpath = os.path.dirname(os.path.normpath(sys.executable))
diff --git a/Tools/versioncheck/README b/Tools/versioncheck/README
deleted file mode 100644
index 1dd2eca..0000000
--- a/Tools/versioncheck/README
+++ /dev/null
@@ -1,41 +0,0 @@
-This is versioncheck 1.0, a first stab at automatic checking of versions of
-Python extension packages installed on your system.
-
-The basic idea is that each package contains a _checkversion.py
-somewhere, probably at the root level of the package. In addition, each
-package maintainer makes a file available on the net, through ftp or
-http, which contains the version number of the most recent distribution
-and some readable text explaining the differences with previous
-versions, where to download the package, etc.
-
-The checkversions.py script walks through the installed Python tree (or
-through a tree of choice), and runs each _checkversion.py script. These
-scripts retrieve the current-version file over the net, compares version
-numbers and tells the user about new versions of packages available.
-
-A boilerplate for the _checkversion.py file can be found here. Replace
-package name, version and the URL of the version-check file and put it in
-your distribution. In stead of a single URL you can also specify a list
-of URLs. Each of these will be checked in order until one is available,
-this is handy for distributions that live in multiple places. Put the
-primary distribution site (the most up-to-date site) before others.
-The script is read and executed with exec(), not imported, and the current
-directory is the checkversion directory, so be careful with globals,
-importing, etc.
-
-The version-check file consists of an rfc822-style header followed by
-plaintext. The only header field checked currently is
-'Current-Version:', which should contain te current version and is
-matched against the string contained in the _checkversion.py script.
-The rest of the file is human-readable text and presented to the user if
-there is a version mismatch. It should contain at the very least a URL
-of either the current distribution or a webpage describing it.
-
-Pycheckversion.py is the module that does the actual checking of versions.
-It should be fine where it is, it is imported by checkversion before anything
-else is done, but if imports fail you may want to move it to somewhere
-along sys.path.
-
- Jack Jansen, CWI, 23-Dec-97.
- <jack@cwi.nl>
-
diff --git a/Tools/versioncheck/_checkversion.py b/Tools/versioncheck/_checkversion.py
deleted file mode 100644
index 7b3bb50..0000000
--- a/Tools/versioncheck/_checkversion.py
+++ /dev/null
@@ -1,16 +0,0 @@
-"""This file (which is sourced, not imported) checks the version of the
-"versioncheck" package. It is also an example of how to format your own
-_checkversion.py file"""
-
-import pyversioncheck
-
-_PACKAGE="versioncheck"
-_VERSION="1.0"
-_URL="http://www.cwi.nl/~jack/versioncheck/curversion.txt"
-
-try:
- _myverbose=VERBOSE
-except NameError:
- _myverbose=1
-
-pyversioncheck.versioncheck(_PACKAGE, _URL, _VERSION, verbose=_myverbose)
diff --git a/Tools/versioncheck/checkversions.py b/Tools/versioncheck/checkversions.py
deleted file mode 100644
index f110cac..0000000
--- a/Tools/versioncheck/checkversions.py
+++ /dev/null
@@ -1,52 +0,0 @@
-"""Checkversions - recursively search a directory (default: sys.prefix)
-for _checkversion.py files, and run each of them. This will tell you of
-new versions available for any packages you have installed."""
-
-import os
-import getopt
-import sys
-import pyversioncheck
-
-CHECKNAME="_checkversion.py"
-
-VERBOSE=1
-
-USAGE="""Usage: checkversions [-v verboselevel] [dir ...]
-Recursively examine a tree (default: sys.prefix) and for each package
-with a _checkversion.py file compare the installed version against the current
-version.
-
-Values for verboselevel:
-0 - Minimal output, one line per package
-1 - Also print descriptions for outdated packages (default)
-2 - Print information on each URL checked
-3 - Check every URL for packages with multiple locations"""
-
-def check1dir(dummy, dir, files):
- if CHECKNAME in files:
- fullname = os.path.join(dir, CHECKNAME)
- try:
- exec(open(fullname).read())
- except:
- print('** Exception in', fullname)
-
-def walk1tree(tree):
- os.walk(tree, check1dir, None)
-
-def main():
- global VERBOSE
- try:
- options, arguments = getopt.getopt(sys.argv[1:], 'v:')
- except getopt.error:
- print(USAGE)
- sys.exit(1)
- for o, a in options:
- if o == '-v':
- VERBOSE = int(a)
- if not arguments:
- arguments = [sys.prefix]
- for dir in arguments:
- walk1tree(dir)
-
-if __name__ == '__main__':
- main()
diff --git a/Tools/versioncheck/pyversioncheck.py b/Tools/versioncheck/pyversioncheck.py
deleted file mode 100644
index 250d49d..0000000
--- a/Tools/versioncheck/pyversioncheck.py
+++ /dev/null
@@ -1,97 +0,0 @@
-"""pyversioncheck - Module to help with checking versions"""
-import urllib.request
-import email
-import sys
-
-# Verbose options
-VERBOSE_SILENT=0 # Single-line reports per package
-VERBOSE_NORMAL=1 # Single-line reports per package, more info if outdated
-VERBOSE_EACHFILE=2 # Report on each URL checked
-VERBOSE_CHECKALL=3 # Check each URL for each package
-
-# Test directory
-## urllib bug: _TESTDIR="ftp://ftp.cwi.nl/pub/jack/python/versiontestdir/"
-_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
- if ok < 0:
- print('%s: No correctly formatted current version file found'%(package))
- elif ok == 1:
- 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)
- return ok
-
-def checkonly(package, url, version, verbose=0):
- if verbose >= VERBOSE_EACHFILE:
- print('%s:'%package)
- if isinstance(url, str):
- 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
- return ok, newversion, fp
-
-def _check1version(package, url, version, verbose=0):
- if verbose >= VERBOSE_EACHFILE:
- print(' Checking %s'%url)
- try:
- fp = urllib.request.urlopen(url)
- except IOError as arg:
- if verbose >= VERBOSE_EACHFILE:
- print(' Cannot open:', arg)
- return -1, None, None
- msg = email.message_from_file(fp)
- newversion = msg.get('current-version')
- if not newversion:
- if verbose >= VERBOSE_EACHFILE:
- print(' No "Current-Version:" header in URL or URL not found')
- return -1, None, None
- version = version.lower().strip()
- newversion = newversion.lower().strip()
- if version == newversion:
- 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
-
-
-def _test():
- print('--- TEST VERBOSE=1')
- print('--- Testing existing and identical version file')
- versioncheck('VersionTestPackage', _TESTDIR+'Version10.txt', '1.0', verbose=1)
- print('--- Testing existing package with new version')
- versioncheck('VersionTestPackage', _TESTDIR+'Version11.txt', '1.0', verbose=1)
- print('--- Testing package with non-existing version file')
- versioncheck('VersionTestPackage', _TESTDIR+'nonexistent.txt', '1.0', verbose=1)
- print('--- Test package with 2 locations, first non-existing second ok')
- versfiles = [_TESTDIR+'nonexistent.txt', _TESTDIR+'Version10.txt']
- versioncheck('VersionTestPackage', versfiles, '1.0', verbose=1)
- print('--- TEST VERBOSE=2')
- print('--- Testing existing and identical version file')
- versioncheck('VersionTestPackage', _TESTDIR+'Version10.txt', '1.0', verbose=2)
- print('--- Testing existing package with new version')
- versioncheck('VersionTestPackage', _TESTDIR+'Version11.txt', '1.0', verbose=2)
- print('--- Testing package with non-existing version file')
- versioncheck('VersionTestPackage', _TESTDIR+'nonexistent.txt', '1.0', verbose=2)
- print('--- Test package with 2 locations, first non-existing second ok')
- versfiles = [_TESTDIR+'nonexistent.txt', _TESTDIR+'Version10.txt']
- versioncheck('VersionTestPackage', versfiles, '1.0', verbose=2)
-
-if __name__ == '__main__':
- _test()