diff -Nru simplegeneric-0.7/PKG-INFO simplegeneric-0.8.1/PKG-INFO --- simplegeneric-0.7/PKG-INFO 2010-07-29 19:49:54.000000000 +0000 +++ simplegeneric-0.8.1/PKG-INFO 2012-04-01 15:38:32.000000000 +0000 @@ -1,14 +1,15 @@ Metadata-Version: 1.0 Name: simplegeneric -Version: 0.7 +Version: 0.8.1 Summary: Simple generic functions (similar to Python's own len(), pickle.dump(), etc.) Home-page: http://cheeseshop.python.org/pypi/simplegeneric Author: Phillip J. Eby Author-email: peak@eby-sarna.com -License: http://www.apache.org/licenses/LICENSE-2.0 -Description: (NEW in 0.7: `Multiple Types or Objects`_) - - (NEW in 0.6: `Inspection and Extension`_, and thread-safe method registration.) +License: ZPL 2.1 +Description: * New in 0.8: Source and tests are compatible with Python 3 (w/o ``setup.py``) + * 0.8.1: setup.py is now compatible with Python 3 as well + * New in 0.7: `Multiple Types or Objects`_ + * New in 0.6: `Inspection and Extension`_, and thread-safe method registration The ``simplegeneric`` module lets you define simple single-dispatch generic functions, akin to Python's built-in generic functions like @@ -40,22 +41,22 @@ >>> @generic ... def move(item, target): ... """Default implementation goes here""" - ... print "what you say?!" + ... print("what you say?!") >>> @move.when_type(int) ... def move_int(item, target): - ... print "In AD %d, %s was beginning." % (item, target) + ... print("In AD %d, %s was beginning." % (item, target)) >>> @move.when_type(str) ... def move_str(item, target): - ... print "How are you %s!!" % item - ... print "All your %s are belong to us." % (target,) + ... print("How are you %s!!" % item) + ... print("All your %s are belong to us." % (target,)) >>> zig = object() >>> @move.when_object(zig) ... def move_zig(item, target): - ... print "You know what you %s." % (target,) - ... print "For great justice!" + ... print("You know what you %s." % (target,)) + ... print("For great justice!") >>> move(2101, "war") In AD 2101, war was beginning. @@ -82,7 +83,7 @@ ... pass Traceback (most recent call last): ... - TypeError: already has method for type + TypeError: already has method for type <...'str'> >>> @move.when_object(zig) ... def this_is_wrong(item, target): pass @@ -94,7 +95,7 @@ >>> @move.when_type(23) ... def move_23(item, target): - ... print "You have no chance to survive!" + ... print("You have no chance to survive!") Traceback (most recent call last): ... TypeError: 23 is not a type or class @@ -116,7 +117,7 @@ >>> @move.when_type(X) ... def move_x(item, target): - ... print "Someone set us up the %s!!!" % (target,) + ... print("Someone set us up the %s!!!" % (target,)) >>> move(X(), "bomb") Someone set us up the bomb!!! @@ -145,7 +146,7 @@ True >>> isbuiltin(object()) False - >>> isbuiltin(X) + >>> isbuiltin(X()) False >>> isbuiltin(None) True @@ -161,7 +162,7 @@ >>> @move.when_type(Y) ... def move_y(item, target): - ... print "Someone set us up the %s!!!" % (target,) + ... print("Someone set us up the %s!!!" % (target,)) ... move.default(item, target) >>> move(Y(), "dance") @@ -216,7 +217,7 @@ >>> @move2.when_type(X) ... def move2_X(item, target): - ... print "You have no chance to survive make your %s!" % (target,) + ... print("You have no chance to survive make your %s!" % (target,)) >>> move2(X(), "time") You have no chance to survive make your time! @@ -263,3 +264,16 @@ Platform: UNKNOWN +Classifier: Development Status :: 6 - Mature +Classifier: Development Status :: 7 - Inactive +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Zope Public License +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.4 +Classifier: Programming Language :: Python :: 2.5 +Classifier: Programming Language :: Python :: 2.6 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Operating System :: OS Independent +Classifier: Topic :: Software Development :: Libraries :: Python Modules diff -Nru simplegeneric-0.7/README.txt simplegeneric-0.8.1/README.txt --- simplegeneric-0.7/README.txt 2010-07-29 19:39:28.000000000 +0000 +++ simplegeneric-0.8.1/README.txt 2012-03-14 11:30:22.000000000 +0000 @@ -2,9 +2,10 @@ Trivial Generic Functions ========================= -(NEW in 0.7: `Multiple Types or Objects`_) - -(NEW in 0.6: `Inspection and Extension`_, and thread-safe method registration.) +* New in 0.8: Source and tests are compatible with Python 3 (w/o ``setup.py``) + * 0.8.1: setup.py is now compatible with Python 3 as well +* New in 0.7: `Multiple Types or Objects`_ +* New in 0.6: `Inspection and Extension`_, and thread-safe method registration The ``simplegeneric`` module lets you define simple single-dispatch generic functions, akin to Python's built-in generic functions like @@ -36,22 +37,22 @@ >>> @generic ... def move(item, target): ... """Default implementation goes here""" - ... print "what you say?!" + ... print("what you say?!") >>> @move.when_type(int) ... def move_int(item, target): - ... print "In AD %d, %s was beginning." % (item, target) + ... print("In AD %d, %s was beginning." % (item, target)) >>> @move.when_type(str) ... def move_str(item, target): - ... print "How are you %s!!" % item - ... print "All your %s are belong to us." % (target,) + ... print("How are you %s!!" % item) + ... print("All your %s are belong to us." % (target,)) >>> zig = object() >>> @move.when_object(zig) ... def move_zig(item, target): - ... print "You know what you %s." % (target,) - ... print "For great justice!" + ... print("You know what you %s." % (target,)) + ... print("For great justice!") >>> move(2101, "war") In AD 2101, war was beginning. @@ -78,7 +79,7 @@ ... pass Traceback (most recent call last): ... - TypeError: already has method for type + TypeError: already has method for type <...'str'> >>> @move.when_object(zig) ... def this_is_wrong(item, target): pass @@ -90,7 +91,7 @@ >>> @move.when_type(23) ... def move_23(item, target): - ... print "You have no chance to survive!" + ... print("You have no chance to survive!") Traceback (most recent call last): ... TypeError: 23 is not a type or class @@ -112,7 +113,7 @@ >>> @move.when_type(X) ... def move_x(item, target): - ... print "Someone set us up the %s!!!" % (target,) + ... print("Someone set us up the %s!!!" % (target,)) >>> move(X(), "bomb") Someone set us up the bomb!!! @@ -127,26 +128,26 @@ As a convenience, you can now pass more than one type or object to the registration methods:: ->>> @generic -... def isbuiltin(ob): -... return False ->>> @isbuiltin.when_type(int, str, float, complex, type) -... @isbuiltin.when_object(None, Ellipsis) -... def yes(ob): -... return True - ->>> isbuiltin(1) -True ->>> isbuiltin(object) -True ->>> isbuiltin(object()) -False ->>> isbuiltin(X) -False ->>> isbuiltin(None) -True ->>> isbuiltin(Ellipsis) -True + >>> @generic + ... def isbuiltin(ob): + ... return False + >>> @isbuiltin.when_type(int, str, float, complex, type) + ... @isbuiltin.when_object(None, Ellipsis) + ... def yes(ob): + ... return True + + >>> isbuiltin(1) + True + >>> isbuiltin(object) + True + >>> isbuiltin(object()) + False + >>> isbuiltin(X()) + False + >>> isbuiltin(None) + True + >>> isbuiltin(Ellipsis) + True Defaults and Docs @@ -157,7 +158,7 @@ >>> @move.when_type(Y) ... def move_y(item, target): - ... print "Someone set us up the %s!!!" % (target,) + ... print("Someone set us up the %s!!!" % (target,)) ... move.default(item, target) >>> move(Y(), "dance") @@ -212,7 +213,7 @@ >>> @move2.when_type(X) ... def move2_X(item, target): - ... print "You have no chance to survive make your %s!" % (target,) + ... print("You have no chance to survive make your %s!" % (target,)) >>> move2(X(), "time") You have no chance to survive make your time! diff -Nru simplegeneric-0.7/classifiers.txt simplegeneric-0.8.1/classifiers.txt --- simplegeneric-0.7/classifiers.txt 1970-01-01 00:00:00.000000000 +0000 +++ simplegeneric-0.8.1/classifiers.txt 2012-03-14 11:30:14.000000000 +0000 @@ -0,0 +1,14 @@ +Development Status :: 6 - Mature +Development Status :: 7 - Inactive +Intended Audience :: Developers +License :: OSI Approved :: Zope Public License +Programming Language :: Python +Programming Language :: Python :: 2 +Programming Language :: Python :: 2.4 +Programming Language :: Python :: 2.5 +Programming Language :: Python :: 2.6 +Programming Language :: Python :: 2.7 +Programming Language :: Python :: 3 +Operating System :: OS Independent +Topic :: Software Development :: Libraries :: Python Modules + diff -Nru simplegeneric-0.7/debian/changelog simplegeneric-0.8.1/debian/changelog --- simplegeneric-0.7/debian/changelog 2012-04-14 13:45:31.000000000 +0000 +++ simplegeneric-0.8.1/debian/changelog 2013-03-14 15:59:36.000000000 +0000 @@ -1,8 +1,36 @@ -simplegeneric (0.7-1build1) precise; urgency=low +simplegeneric (0.8.1-1~cloud0) precise-grizzly; urgency=low - * Rebuild to drop python2.6 dependencies and provides. + * New package for the Ubuntu Cloud Archive to support inclusion of + ceilometer. - -- Matthias Klose Sat, 14 Apr 2012 13:45:31 +0000 + -- James Page Thu, 14 Mar 2013 15:59:36 +0000 + +simplegeneric (0.8.1-1) unstable; urgency=low + + * New upstream release (Closes: #640531) + - With Python 3 support + * Builded Python 3 package + * debian/control + - Removed Cédric and added Debian Python Modules Team to Maintainer + Thanks to Cédric Delfosse for his past work! + - Added myself to Uploaders (Closes: #668915) + - Bumped Standards-Version to 3.9.3 (no changes needed) + - Removed Provides: ${python:Provides} + - Removed ${shlibs:Depends} from python-simplegeneric's Depends + field + - Switched Priority to optional + - Added Vcs-* fields + * debian/{control,rules} + - Switched to dh_python2. Thanks to Julian Taylor for the report + and the patch (Closes: #631408) + * debian/copyright + - Made DEP5 compliant + - Upstream switched to ZPL-2.1 + * debian/rules + - Clean properly to build packages twice in a row + - Run tests at build time + + -- Daniele Tricoli Fri, 04 May 2012 12:51:10 +0200 simplegeneric (0.7-1) unstable; urgency=low diff -Nru simplegeneric-0.7/debian/control simplegeneric-0.8.1/debian/control --- simplegeneric-0.7/debian/control 2010-08-04 19:47:04.000000000 +0000 +++ simplegeneric-0.8.1/debian/control 2012-05-06 17:54:24.000000000 +0000 @@ -1,19 +1,43 @@ Source: simplegeneric +Maintainer: Debian Python Modules Team +Uploaders: Daniele Tricoli Section: python -Priority: extra -Maintainer: Cédric Delfosse -Build-Depends: debhelper (>= 7.0.50~), python-all, python-support, python-setuptools -Standards-Version: 3.9.1 -XS-Python-Version: all +Priority: optional +Build-Depends: + debhelper (>= 7.0.50~), + python-all (>= 2.6.6-3~), + python-setuptools, + python3-all, + python3-setuptools +Standards-Version: 3.9.3 +X-Python-Version: >= 2.4 +X-Python3-Version: >= 3.0 Homepage: http://pypi.python.org/pypi/simplegeneric +Vcs-Svn: svn://svn.debian.org/python-modules/packages/simplegeneric/trunk/ +Vcs-Browser: http://svn.debian.org/viewsvn/python-modules/packages/simplegeneric/trunk/ Package: python-simplegeneric Architecture: all -Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends} -Provides: ${python:Provides} -Description: Simple generic functions for Python +Depends: + ${misc:Depends}, + ${python:Depends} +Description: simple generic functions for Python The simplegeneric module lets you define simple single-dispatch generic functions, akin to Python's built-in generic functions like len(), iter() and so on. However, instead of using specially-named methods, these generic functions use simple lookup tables, akin to those used by e.g. pickle.dump() and other generic functions found in the Python standard library. + +Package: python3-simplegeneric +Architecture: all +Depends: + ${misc:Depends}, + ${python3:Depends} +Description: simple generic functions for Python3 + The simplegeneric module lets you define simple single-dispatch generic + functions, akin to Python's built-in generic functions like len(), iter() and + so on. However, instead of using specially-named methods, these generic + functions use simple lookup tables, akin to those used by e.g. pickle.dump() + and other generic functions found in the Python standard library. + . + This package contains the Python 3 version of the library. diff -Nru simplegeneric-0.7/debian/copyright simplegeneric-0.8.1/debian/copyright --- simplegeneric-0.7/debian/copyright 2010-08-04 19:18:30.000000000 +0000 +++ simplegeneric-0.8.1/debian/copyright 2012-05-04 22:26:56.000000000 +0000 @@ -1,39 +1,76 @@ -This work was packaged for Debian by: - - Cédric Delfosse on Wed, 04 Aug 2010 20:53:42 +0200 - -It was downloaded from: - - http://pypi.python.org/pypi/simplegeneric - -Upstream Author(s): - - Phillip J. Eby - -Copyright: - - Copyright (C) 2010 Phillip J. Eby - -License: - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -On Debian systems, the complete text of the Apache version 2.0 license -can be found in "/usr/share/common-licenses/Apache-2.0". - -The Debian packaging is: - - Copyright (C) 2010 Cédric Delfosse - -and is licensed under the GPL version 3, -see "/usr/share/common-licenses/GPL-3". +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: simplegeneric +Upstream-Contact: Phillip J. Eby +Source: http://pypi.python.org/pypi/simplegeneric + +Files: * +Copyright: 2006-2012, Phillip J. Eby +License: ZPL-2.1 + +Files: debian/* +Copyright: 2010, Cédric Delfosse + 2012, Daniele Tricoli +License: GPL-3 + +License: ZPL-2.1 + Zope Public License (ZPL) Version 2.1 + . + A copyright notice accompanies this license document that identifies the + copyright holders. + . + This license has been certified as open source. It has also been designated as + GPL compatible by the Free Software Foundation (FSF). + . + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + . + 1. Redistributions in source code must retain the accompanying copyright + notice, this list of conditions, and the following disclaimer. + . + 2. Redistributions in binary form must reproduce the accompanying copyright + notice, this list of conditions, and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + 3. Names of the copyright holders must not be used to endorse or promote + products derived from this software without prior written permission from the + copyright holders. + . + 4. The right to distribute this software or to use it for any purpose does not + give you the right to use Servicemarks (sm) or Trademarks (tm) of the + copyright + holders. Use of them is covered by separate agreement with the copyright + holders. + . + 5. If any files are modified, you must cause the modified files to carry + prominent notices stating that you changed the files and the date of any + change. + . + Disclaimer + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: GPL-3 + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see . + . + The complete text of the GNU General Public License + can be found in /usr/share/common-licenses/GPL-3 file. diff -Nru simplegeneric-0.7/debian/docs simplegeneric-0.8.1/debian/docs --- simplegeneric-0.7/debian/docs 2010-08-04 19:10:18.000000000 +0000 +++ simplegeneric-0.8.1/debian/docs 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -README.txt \ No newline at end of file diff -Nru simplegeneric-0.7/debian/python-simplegeneric.docs simplegeneric-0.8.1/debian/python-simplegeneric.docs --- simplegeneric-0.7/debian/python-simplegeneric.docs 1970-01-01 00:00:00.000000000 +0000 +++ simplegeneric-0.8.1/debian/python-simplegeneric.docs 2012-05-04 22:26:56.000000000 +0000 @@ -0,0 +1 @@ +README.txt \ No newline at end of file diff -Nru simplegeneric-0.7/debian/python3-simplegeneric.docs simplegeneric-0.8.1/debian/python3-simplegeneric.docs --- simplegeneric-0.7/debian/python3-simplegeneric.docs 1970-01-01 00:00:00.000000000 +0000 +++ simplegeneric-0.8.1/debian/python3-simplegeneric.docs 2012-05-04 22:26:56.000000000 +0000 @@ -0,0 +1 @@ +README.txt \ No newline at end of file diff -Nru simplegeneric-0.7/debian/rules simplegeneric-0.8.1/debian/rules --- simplegeneric-0.7/debian/rules 2010-08-04 19:13:09.000000000 +0000 +++ simplegeneric-0.8.1/debian/rules 2012-05-04 22:26:56.000000000 +0000 @@ -1,8 +1,43 @@ #!/usr/bin/make -f -# -*- makefile -*- -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 +export PYTHONWARNINGS=d + +PYVERS := $(shell pyversions -r) +PY3VERS := $(shell py3versions -r) %: - dh $@ + dh $@ --with python2,python3 + +override_dh_auto_build: + set -ex; \ + for python in $(PYVERS) $(PY3VERS); do \ + $$python setup.py build; \ + done + +override_dh_auto_clean: + rm -rf build + rm -rf *.egg-info + dh_auto_clean + +override_dh_auto_install: + set -ex; \ + for python in $(PYVERS); do \ + $$python setup.py install --skip-build \ + --root debian/python-simplegeneric \ + --install-layout deb; \ + done + + set -ex; \ + for python in $(PY3VERS); do \ + $$python setup.py install --skip-build \ + --root debian/python3-simplegeneric \ + --install-layout deb; \ + done + +override_dh_auto_test: +ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) + set -ex; \ + for python in $(PYVERS) $(PY3VERS); do \ + $$python setup.py test -vv; \ + done +endif diff -Nru simplegeneric-0.7/ez_setup/README.txt simplegeneric-0.8.1/ez_setup/README.txt --- simplegeneric-0.7/ez_setup/README.txt 2006-10-05 18:44:02.000000000 +0000 +++ simplegeneric-0.8.1/ez_setup/README.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -This directory exists so that Subversion-based projects can share a single -copy of the ``ez_setup`` bootstrap module for ``setuptools``, and have it -automatically updated in their projects when ``setuptools`` is updated. - -For your convenience, you may use the following svn:externals definition:: - - ez_setup svn://svn.eby-sarna.com/svnroot/ez_setup - -You can set this by executing this command in your project directory:: - - svn propedit svn:externals . - -And then adding the line shown above to the file that comes up for editing. -Then, whenever you update your project, ``ez_setup`` will be updated as well. - diff -Nru simplegeneric-0.7/ez_setup/__init__.py simplegeneric-0.8.1/ez_setup/__init__.py --- simplegeneric-0.7/ez_setup/__init__.py 2009-10-19 13:54:32.000000000 +0000 +++ simplegeneric-0.8.1/ez_setup/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,280 +0,0 @@ -#!python -"""Bootstrap setuptools installation - -If you want to use setuptools in your package's setup.py, just include this -file in the same directory with it, and add this to the top of your setup.py:: - - from ez_setup import use_setuptools - use_setuptools() - -If you want to require a specific version of setuptools, set a download -mirror, or use an alternate download directory, you can do so by supplying -the appropriate options to ``use_setuptools()``. - -This file can also be run as a script to install or upgrade setuptools. -""" -import sys -DEFAULT_VERSION = "0.6c10" -DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3] - -md5_data = { - 'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca', - 'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb', - 'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b', - 'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a', - 'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618', - 'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac', - 'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5', - 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4', - 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c', - 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b', - 'setuptools-0.6c10-py2.3.egg': 'ce1e2ab5d3a0256456d9fc13800a7090', - 'setuptools-0.6c10-py2.4.egg': '57d6d9d6e9b80772c59a53a8433a5dd4', - 'setuptools-0.6c10-py2.5.egg': 'de46ac8b1c97c895572e5e8596aeb8c7', - 'setuptools-0.6c10-py2.6.egg': '58ea40aef06da02ce641495523a0b7f5', - 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27', - 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277', - 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa', - 'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e', - 'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e', - 'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f', - 'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2', - 'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc', - 'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167', - 'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64', - 'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d', - 'setuptools-0.6c6-py2.3.egg': '35686b78116a668847237b69d549ec20', - 'setuptools-0.6c6-py2.4.egg': '3c56af57be3225019260a644430065ab', - 'setuptools-0.6c6-py2.5.egg': 'b2f8a7520709a5b34f80946de5f02f53', - 'setuptools-0.6c7-py2.3.egg': '209fdf9adc3a615e5115b725658e13e2', - 'setuptools-0.6c7-py2.4.egg': '5a8f954807d46a0fb67cf1f26c55a82e', - 'setuptools-0.6c7-py2.5.egg': '45d2ad28f9750e7434111fde831e8372', - 'setuptools-0.6c8-py2.3.egg': '50759d29b349db8cfd807ba8303f1902', - 'setuptools-0.6c8-py2.4.egg': 'cba38d74f7d483c06e9daa6070cce6de', - 'setuptools-0.6c8-py2.5.egg': '1721747ee329dc150590a58b3e1ac95b', - 'setuptools-0.6c9-py2.3.egg': 'a83c4020414807b496e4cfbe08507c03', - 'setuptools-0.6c9-py2.4.egg': '260a2be2e5388d66bdaee06abec6342a', - 'setuptools-0.6c9-py2.5.egg': 'fe67c3e5a17b12c0e7c541b7ea43a8e6', - 'setuptools-0.6c9-py2.6.egg': 'ca37b1ff16fa2ede6e19383e7b59245a', -} - -import sys, os -try: from hashlib import md5 -except ImportError: from md5 import md5 - -def _validate_md5(egg_name, data): - if egg_name in md5_data: - digest = md5(data).hexdigest() - if digest != md5_data[egg_name]: - print >>sys.stderr, ( - "md5 validation of %s failed! (Possible download problem?)" - % egg_name - ) - sys.exit(2) - return data - -def use_setuptools( - version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, - download_delay=15 -): - """Automatically find/download setuptools and make it available on sys.path - - `version` should be a valid setuptools version number that is available - as an egg for download under the `download_base` URL (which should end with - a '/'). `to_dir` is the directory where setuptools will be downloaded, if - it is not already available. If `download_delay` is specified, it should - be the number of seconds that will be paused before initiating a download, - should one be required. If an older version of setuptools is installed, - this routine will print a message to ``sys.stderr`` and raise SystemExit in - an attempt to abort the calling script. - """ - was_imported = 'pkg_resources' in sys.modules or 'setuptools' in sys.modules - def do_download(): - egg = download_setuptools(version, download_base, to_dir, download_delay) - sys.path.insert(0, egg) - import setuptools; setuptools.bootstrap_install_from = egg - try: - import pkg_resources - except ImportError: - return do_download() - try: - pkg_resources.require("setuptools>="+version); return - except pkg_resources.VersionConflict, e: - if was_imported: - print >>sys.stderr, ( - "The required version of setuptools (>=%s) is not available, and\n" - "can't be installed while this script is running. Please install\n" - " a more recent version first, using 'easy_install -U setuptools'." - "\n\n(Currently using %r)" - ) % (version, e.args[0]) - sys.exit(2) - else: - del pkg_resources, sys.modules['pkg_resources'] # reload ok - return do_download() - except pkg_resources.DistributionNotFound: - return do_download() - -def download_setuptools( - version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, - delay = 15 -): - """Download setuptools from a specified location and return its filename - - `version` should be a valid setuptools version number that is available - as an egg for download under the `download_base` URL (which should end - with a '/'). `to_dir` is the directory where the egg will be downloaded. - `delay` is the number of seconds to pause before an actual download attempt. - """ - import urllib2, shutil - egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3]) - url = download_base + egg_name - saveto = os.path.join(to_dir, egg_name) - src = dst = None - if not os.path.exists(saveto): # Avoid repeated downloads - try: - from distutils import log - if delay: - log.warn(""" ---------------------------------------------------------------------------- -This script requires setuptools version %s to run (even to display -help). I will attempt to download it for you (from -%s), but -you may need to enable firewall access for this script first. -I will start the download in %d seconds. - -(Note: if this machine does not have network access, please obtain the file - - %s - -and place it in this directory before rerunning this script.) ----------------------------------------------------------------------------""", - version, download_base, delay, url - ); from time import sleep; sleep(delay) - log.warn("Downloading %s", url) - src = urllib2.urlopen(url) - # Read/write all in one block, so we don't create a corrupt file - # if the download is interrupted. - data = _validate_md5(egg_name, src.read()) - dst = open(saveto,"wb"); dst.write(data) - finally: - if src: src.close() - if dst: dst.close() - return os.path.realpath(saveto) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -def main(argv, version=DEFAULT_VERSION): - """Install or upgrade setuptools and EasyInstall""" - try: - import setuptools - except ImportError: - egg = None - try: - egg = download_setuptools(version, delay=0) - sys.path.insert(0,egg) - from setuptools.command.easy_install import main - return main(list(argv)+[egg]) # we're done here - finally: - if egg and os.path.exists(egg): - os.unlink(egg) - else: - if setuptools.__version__ == '0.0.1': - print >>sys.stderr, ( - "You have an obsolete version of setuptools installed. Please\n" - "remove it from your system entirely before rerunning this script." - ) - sys.exit(2) - - req = "setuptools>="+version - import pkg_resources - try: - pkg_resources.require(req) - except pkg_resources.VersionConflict: - try: - from setuptools.command.easy_install import main - except ImportError: - from easy_install import main - main(list(argv)+[download_setuptools(delay=0)]) - sys.exit(0) # try to force an exit - else: - if argv: - from setuptools.command.easy_install import main - main(argv) - else: - print "Setuptools version",version,"or greater has been installed." - print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)' - -def update_md5(filenames): - """Update our built-in md5 registry""" - - import re - - for name in filenames: - base = os.path.basename(name) - f = open(name,'rb') - md5_data[base] = md5(f.read()).hexdigest() - f.close() - - data = [" %r: %r,\n" % it for it in md5_data.items()] - data.sort() - repl = "".join(data) - - import inspect - srcfile = inspect.getsourcefile(sys.modules[__name__]) - f = open(srcfile, 'rb'); src = f.read(); f.close() - - match = re.search("\nmd5_data = {\n([^}]+)}", src) - if not match: - print >>sys.stderr, "Internal error!" - sys.exit(2) - - src = src[:match.start(1)] + repl + src[match.end(1):] - f = open(srcfile,'w') - f.write(src) - f.close() - - -if __name__=='__main__': - if len(sys.argv)>2 and sys.argv[1]=='--md5update': - update_md5(sys.argv[2:]) - else: - main(sys.argv[1:]) - - - - - - diff -Nru simplegeneric-0.7/setup.py simplegeneric-0.8.1/setup.py --- simplegeneric-0.7/setup.py 2010-07-29 19:48:28.000000000 +0000 +++ simplegeneric-0.8.1/setup.py 2012-03-14 11:31:26.000000000 +0000 @@ -1,17 +1,17 @@ #!/usr/bin/env python """Distutils setup file""" - -import ez_setup -ez_setup.use_setuptools() -from setuptools import setup +try: + from setuptools import setup +except ImportError: + from distutils.core import setup # Metadata PACKAGE_NAME = "simplegeneric" -PACKAGE_VERSION = "0.7" +PACKAGE_VERSION = "0.8.1" def get_description(): # Get our long description from the documentation - f = file('README.txt') + f = open('README.txt') lines = [] for line in f: if not line.strip(): @@ -32,8 +32,10 @@ url = "http://cheeseshop.python.org/pypi/simplegeneric", author="Phillip J. Eby", author_email="peak@eby-sarna.com", - license="http://www.apache.org/licenses/LICENSE-2.0", + license="ZPL 2.1", test_suite = 'simplegeneric.test_suite', py_modules = ['simplegeneric'], + classifiers = [ + line.strip() for line in open('classifiers.txt') if line.strip() + ], ) - diff -Nru simplegeneric-0.7/simplegeneric.egg-info/PKG-INFO simplegeneric-0.8.1/simplegeneric.egg-info/PKG-INFO --- simplegeneric-0.7/simplegeneric.egg-info/PKG-INFO 2010-07-29 19:49:52.000000000 +0000 +++ simplegeneric-0.8.1/simplegeneric.egg-info/PKG-INFO 2012-04-01 15:38:30.000000000 +0000 @@ -1,14 +1,15 @@ Metadata-Version: 1.0 Name: simplegeneric -Version: 0.7 +Version: 0.8.1 Summary: Simple generic functions (similar to Python's own len(), pickle.dump(), etc.) Home-page: http://cheeseshop.python.org/pypi/simplegeneric Author: Phillip J. Eby Author-email: peak@eby-sarna.com -License: http://www.apache.org/licenses/LICENSE-2.0 -Description: (NEW in 0.7: `Multiple Types or Objects`_) - - (NEW in 0.6: `Inspection and Extension`_, and thread-safe method registration.) +License: ZPL 2.1 +Description: * New in 0.8: Source and tests are compatible with Python 3 (w/o ``setup.py``) + * 0.8.1: setup.py is now compatible with Python 3 as well + * New in 0.7: `Multiple Types or Objects`_ + * New in 0.6: `Inspection and Extension`_, and thread-safe method registration The ``simplegeneric`` module lets you define simple single-dispatch generic functions, akin to Python's built-in generic functions like @@ -40,22 +41,22 @@ >>> @generic ... def move(item, target): ... """Default implementation goes here""" - ... print "what you say?!" + ... print("what you say?!") >>> @move.when_type(int) ... def move_int(item, target): - ... print "In AD %d, %s was beginning." % (item, target) + ... print("In AD %d, %s was beginning." % (item, target)) >>> @move.when_type(str) ... def move_str(item, target): - ... print "How are you %s!!" % item - ... print "All your %s are belong to us." % (target,) + ... print("How are you %s!!" % item) + ... print("All your %s are belong to us." % (target,)) >>> zig = object() >>> @move.when_object(zig) ... def move_zig(item, target): - ... print "You know what you %s." % (target,) - ... print "For great justice!" + ... print("You know what you %s." % (target,)) + ... print("For great justice!") >>> move(2101, "war") In AD 2101, war was beginning. @@ -82,7 +83,7 @@ ... pass Traceback (most recent call last): ... - TypeError: already has method for type + TypeError: already has method for type <...'str'> >>> @move.when_object(zig) ... def this_is_wrong(item, target): pass @@ -94,7 +95,7 @@ >>> @move.when_type(23) ... def move_23(item, target): - ... print "You have no chance to survive!" + ... print("You have no chance to survive!") Traceback (most recent call last): ... TypeError: 23 is not a type or class @@ -116,7 +117,7 @@ >>> @move.when_type(X) ... def move_x(item, target): - ... print "Someone set us up the %s!!!" % (target,) + ... print("Someone set us up the %s!!!" % (target,)) >>> move(X(), "bomb") Someone set us up the bomb!!! @@ -145,7 +146,7 @@ True >>> isbuiltin(object()) False - >>> isbuiltin(X) + >>> isbuiltin(X()) False >>> isbuiltin(None) True @@ -161,7 +162,7 @@ >>> @move.when_type(Y) ... def move_y(item, target): - ... print "Someone set us up the %s!!!" % (target,) + ... print("Someone set us up the %s!!!" % (target,)) ... move.default(item, target) >>> move(Y(), "dance") @@ -216,7 +217,7 @@ >>> @move2.when_type(X) ... def move2_X(item, target): - ... print "You have no chance to survive make your %s!" % (target,) + ... print("You have no chance to survive make your %s!" % (target,)) >>> move2(X(), "time") You have no chance to survive make your time! @@ -263,3 +264,16 @@ Platform: UNKNOWN +Classifier: Development Status :: 6 - Mature +Classifier: Development Status :: 7 - Inactive +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Zope Public License +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.4 +Classifier: Programming Language :: Python :: 2.5 +Classifier: Programming Language :: Python :: 2.6 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Operating System :: OS Independent +Classifier: Topic :: Software Development :: Libraries :: Python Modules diff -Nru simplegeneric-0.7/simplegeneric.egg-info/SOURCES.txt simplegeneric-0.8.1/simplegeneric.egg-info/SOURCES.txt --- simplegeneric-0.7/simplegeneric.egg-info/SOURCES.txt 2010-07-29 19:49:52.000000000 +0000 +++ simplegeneric-0.8.1/simplegeneric.egg-info/SOURCES.txt 2012-04-01 15:38:30.000000000 +0000 @@ -1,8 +1,8 @@ README.txt +classifiers.txt +setup.cfg setup.py simplegeneric.py -ez_setup/README.txt -ez_setup/__init__.py simplegeneric.egg-info/PKG-INFO simplegeneric.egg-info/SOURCES.txt simplegeneric.egg-info/dependency_links.txt diff -Nru simplegeneric-0.7/simplegeneric.py simplegeneric-0.8.1/simplegeneric.py --- simplegeneric-0.7/simplegeneric.py 2010-07-29 19:41:54.000000000 +0000 +++ simplegeneric-0.8.1/simplegeneric.py 2011-08-31 20:44:56.000000000 +0000 @@ -1,7 +1,10 @@ __all__ = ["generic"] - -from types import ClassType, InstanceType -classtypes = type, ClassType +try: + from types import ClassType, InstanceType + classtypes = type, ClassType +except ImportError: + classtypes = type + InstanceType = None def generic(func): """Create a simple generic function""" @@ -36,9 +39,6 @@ return f return decorate - - - _by_object = {} _gbo = _by_object.get @@ -87,10 +87,10 @@ optionflags=doctest.ELLIPSIS|doctest.REPORT_ONLY_FIRST_FAILURE, ) - - - - +if __name__=='__main__': + import unittest + r = unittest.TextTestRunner() + r.run(test_suite())