Hello community, here is the log from the commit of package python-six for openSUSE:Factory checked in at 2013-05-02 11:44:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-six (Old) and /work/SRC/openSUSE:Factory/.python-six.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-six" Changes: -------- --- /work/SRC/openSUSE:Factory/python-six/python-six.changes 2012-09-21 14:56:15.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-six.new/python-six.changes 2013-05-02 11:44:56.000000000 +0200 @@ -1,0 +2,14 @@ +Mon Apr 29 11:14:05 UTC 2013 - [email protected] + +- update to 1.3.0: + - In six.iter(items/keys/values/lists), passed keyword arguments through to the + underlying method. + - Add six.iterlists(). + - Fix Jython detection. + +------------------------------------------------------------------- +Thu Nov 22 14:18:55 UTC 2012 - [email protected] + +- Removed openSUSE 11.4 spec file workarounds + +------------------------------------------------------------------- --- /work/SRC/openSUSE:Factory/python-six/python3-six.changes 2012-11-25 14:04:44.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.python-six.new/python3-six.changes 2013-05-02 11:44:56.000000000 +0200 @@ -1,0 +2,9 @@ +Mon Apr 29 11:14:05 UTC 2013 - [email protected] + +- update to 1.3.0: + - In six.iter(items/keys/values/lists), passed keyword arguments through to the + underlying method. + - Add six.iterlists(). + - Fix Jython detection. + +------------------------------------------------------------------- Old: ---- six-1.2.0.tar.gz New: ---- six-1.3.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-six.spec ++++++ --- /var/tmp/diff_new_pack.Q8hc3c/_old 2013-05-02 11:44:58.000000000 +0200 +++ /var/tmp/diff_new_pack.Q8hc3c/_new 2013-05-02 11:44:58.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-six # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %define modname six Name: python-%{modname} -Version: 1.2.0 +Version: 1.3.0 Release: 0 Url: http://pypi.python.org/pypi/six/ Summary: Python 2 and 3 compatibility utilities ++++++ python3-six.spec ++++++ --- /var/tmp/diff_new_pack.Q8hc3c/_old 2013-05-02 11:44:58.000000000 +0200 +++ /var/tmp/diff_new_pack.Q8hc3c/_new 2013-05-02 11:44:58.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package python3-six # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %define modname six Name: python3-%{modname} -Version: 1.2.0 +Version: 1.3.0 Release: 0 Url: http://pypi.python.org/pypi/six/ Summary: Python 2 and 3 compatibility utilities ++++++ six-1.2.0.tar.gz -> six-1.3.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/six-1.2.0/CHANGES new/six-1.3.0/CHANGES --- old/six-1.2.0/CHANGES 1970-01-01 01:00:00.000000000 +0100 +++ new/six-1.3.0/CHANGES 2013-03-18 21:35:07.000000000 +0100 @@ -0,0 +1,72 @@ +Changelog for Six +----------------- + +This file lists the changes in each six version. + +1.3.0 +----- + +- Issue #21: Add methods to access the closure and globals of a function. + +- In six.iter(items/keys/values/lists), passed keyword arguments through to the + underlying method. + +- Add six.iterlists(). + +- Issue #20: Fix tests if tkinter is not available. + +- Issue #17: Define callable to be builtin callable when it is available again + in Python 3.2+. + +- Issue #16: Rename Python 2 exec_'s arguments, so casually calling exec_ with + keyword arguments will raise. + +- Issue #14: Put the six.moves package in sys.modules based on the name six is + imported under. + +- Fix Jython detection. + +- Pull request #4: Add email_mime_multipart, email_mime_text, and + email_mime_base to six.moves. + +1.2.0 +----- + +- Issue #13: Make iterkeys/itervalues/iteritems return iterators on Python 3 + instead of iterables. + +- Issue #11: Fix maxsize support on Jython. + +- Add six.next() as an alias for six.advance_iterator(). + +- Use the builtin next() function for advance_iterator() where is available + (2.6+), not just Python 3. + +- Add the Iterator class for writing portable iterators. + +1.1.0 +----- + +- Add the int2byte function. + +- Add compatibility mappings for iterators over the keys, values, and items of a + dictionary. + +- Fix six.MAXSIZE on platforms where sizeof(long) != sizeof(Py_ssize_t). + +- Issue #3: Add six.moves mappings for filter, map, and zip. + + +1.0.0 +----- + +- Issue #2: u() on Python 2.x now resolves unicode escapes. + +- Expose an API for adding mappings to six.moves. + + +1.0 beta 1 +---------- + +- Reworked six into one .py file. This breaks imports. Please tell me if you + are interested in an import compatibility layer. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/six-1.2.0/LICENSE new/six-1.3.0/LICENSE --- old/six-1.2.0/LICENSE 2012-05-20 08:35:39.000000000 +0200 +++ new/six-1.3.0/LICENSE 2013-03-17 05:09:50.000000000 +0100 @@ -1,4 +1,4 @@ -Copyright (c) 2010-2011 Benjamin Peterson +Copyright (c) 2010-2013 Benjamin Peterson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/six-1.2.0/PKG-INFO new/six-1.3.0/PKG-INFO --- old/six-1.2.0/PKG-INFO 2012-08-28 21:55:21.000000000 +0200 +++ new/six-1.3.0/PKG-INFO 2013-03-18 21:40:09.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: six -Version: 1.2.0 +Version: 1.3.0 Summary: Python 2 and 3 compatibility utilities Home-page: http://pypi.python.org/pypi/six/ Author: Benjamin Peterson @@ -18,6 +18,9 @@ Bugs can be reported to http://bitbucket.org/gutworth/six. The code can also be found there. + For questions about six or porting in general, email the python-porting mailing + list: http://mail.python.org/mailman/listinfo/python-porting + Platform: UNKNOWN Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/six-1.2.0/README new/six-1.3.0/README --- old/six-1.2.0/README 2012-05-20 08:35:39.000000000 +0200 +++ new/six-1.3.0/README 2012-09-29 17:20:10.000000000 +0200 @@ -9,3 +9,6 @@ Bugs can be reported to http://bitbucket.org/gutworth/six. The code can also be found there. + +For questions about six or porting in general, email the python-porting mailing +list: http://mail.python.org/mailman/listinfo/python-porting diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/six-1.2.0/documentation/index.rst new/six-1.3.0/documentation/index.rst --- old/six-1.2.0/documentation/index.rst 2012-06-11 18:12:41.000000000 +0200 +++ new/six-1.3.0/documentation/index.rst 2013-03-18 21:13:44.000000000 +0100 @@ -10,7 +10,8 @@ Six provides simple utilities for wrapping over differences between Python 2 and Python 3. It is intended to support codebases that work on both Python 2 and 3 -without modification. +without modification. six consists of only one Python file, so it is painless +to copy into a project. Six can be downloaded on `PyPi <http://pypi.python.org/pypi/six/>`_. Its bug tracker and code hosting is on `BitBucket <http://bitbucket.org/gutworth/six>`_. @@ -127,14 +128,31 @@ Get the ``self`` of bound method *meth*. +.. function:: get_function_closure(func) + + Get the closure (list of cells) associated with *func*. This is equivalent + to ``func.__closure__`` on Python 2.6+ and ``func.func_closure`` on Python + 2.4 and 2.5. + + .. function:: get_function_code(func) - Get the code object associated with *func*. + Get the code object associated with *func*. This is equivalent to + ``func.__code__`` on Python 2.6+ and ``func.func_code`` on Python 2.4 and + 2.5. .. function:: get_function_defaults(func) - Get the defaults tuple associated with *func*. + Get the defaults tuple associated with *func*. This is equivalent to + ``func.__defaults__`` on Python 2.6+ and ``func.func_defaults`` on Python 2.4 + and 2.5. + + +.. function:: get_function_globals(func) + + Get the globals of *func*. This is equivalent to ``func.__globals__`` on + Python 2.6+ and ``func.func_globals`` on Python 2.4 and 2.5. .. function:: next(it) @@ -151,24 +169,34 @@ so using six's version is only necessary when supporting Python 3.0 or 3.1. -.. function:: iterkeys(dictionary) +.. function:: iterkeys(dictionary, **kwargs) Returns an iterator over *dictionary*\'s keys. This replaces - ``dictionary.iterkeys()`` on Python 2 and ``dictionary.keys()`` on Python 3. + ``dictionary.iterkeys()`` on Python 2 and ``dictionary.keys()`` on + Python 3. *kwargs* are passed through to the underlying method. -.. function:: itervalues(dictionary) +.. function:: itervalues(dictionary, **kwargs) Returns an iterator over *dictionary*\'s values. This replaces ``dictionary.itervalues()`` on Python 2 and ``dictionary.values()`` on - Python 3. + Python 3. *kwargs* are passed through to the underlying method. -.. function:: iteritems(dictionary) +.. function:: iteritems(dictionary, **kwargs) Returns an iterator over *dictionary*\'s items. This replaces ``dictionary.iteritems()`` on Python 2 and ``dictionary.items()`` on - Python 3. + Python 3. *kwargs* are passed through to the underlying method. + + +.. function:: iterlists(dictionary, **kwargs) + + Calls ``dictionary.iterlists()`` on Python 2 and ``dictionary.lists()`` on + Python 3. No builtin Python mapping type has such a method; this method is + intended for use with multi-valued dictionaries like `Werkzeug's + <http://werkzeug.pocoo.org/docs/datastructures/#werkzeug.datastructures.MultiDict>`_. + *kwargs* are passed through to the underlying method. .. class:: Iterator @@ -196,6 +224,11 @@ default to the scope of the caller. If just *globals* is given, it will also be used as *locals*. + .. note:: + + Python 3's :func:`py3:exec` doesn't take keyword arguments, so calling + :func:`exec` with them should be avoided. + .. function:: print_(*args, *, file=sys.stdout, end="\n", sep=" ") @@ -250,6 +283,12 @@ with the latin-1 encoding to bytes. +.. note:: + + Since all Python versions 2.6 and after support the ``b`` prefix, + :func:`b`, code without 2.5 support doesn't need :func:`b`. + + .. function:: u(text) A "fake" unicode literal. *text* should always be a normal string literal. @@ -262,9 +301,14 @@ In Python 3.3, the ``u`` prefix has been reintroduced. Code that only supports Python 3 versions greater than 3.3 thus does not need - :func:`u`. Additionally, since all Python versions 2.6 and after support - the ``b`` prefix, :func:`b`, code without 2.5 support doesn't need - :func:`b`. + :func:`u`. + + .. note:: + + On Python 2, :func:`u` doesn't know what the encoding of the literal + is. Each byte is converted directly to the unicode codepoint of the same + value. Because of this, it's only safe to use :func:`u` with strings of + ASCII data. .. function:: int2byte(i) @@ -341,6 +385,12 @@ +------------------------------+-------------------------------------+---------------------------------+ | ``cStringIO`` | :func:`py2:cStringIO.StringIO` | :class:`py3:io.StringIO` | +------------------------------+-------------------------------------+---------------------------------+ +| ``email_mime_multipart`` | :mod:`py2:email.MIMEMultipart` | :mod:`py3:email.mime.multipart` | ++------------------------------+-------------------------------------+---------------------------------+ +| ``email_mime_text`` | :mod:`py2:email.MIMEText` | :mod:`py3:email.mime.text` | ++------------------------------+-------------------------------------+---------------------------------+ +| ``email_mime_base`` | :mod:`py2:email.MIMEBase` | :mod:`py3:email.mime.base` | ++------------------------------+-------------------------------------+---------------------------------+ | ``filter`` | :func:`py2:itertools.ifilter` | :func:`py3:filter` | +------------------------------+-------------------------------------+---------------------------------+ | ``http_cookiejar`` | :mod:`py2:cookielib` | :mod:`py3:http.cookiejar` | diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/six-1.2.0/six.py new/six-1.3.0/six.py --- old/six-1.2.0/six.py 2012-08-28 21:39:22.000000000 +0200 +++ new/six-1.3.0/six.py 2013-03-18 20:58:36.000000000 +0100 @@ -1,11 +1,30 @@ """Utilities for writing code that runs on Python 2 and 3""" +# Copyright (c) 2010-2013 Benjamin Peterson +# +# Permission is hereby granted, free of charge, to any person obtaining a copy of +# this software and associated documentation files (the "Software"), to deal in +# the Software without restriction, including without limitation the rights to +# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +# the Software, and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + import operator import sys import types __author__ = "Benjamin Peterson <[email protected]>" -__version__ = "1.2.0" +__version__ = "1.3.0" # True if we are running on Python 3. @@ -26,7 +45,7 @@ text_type = unicode binary_type = str - if sys.platform == "java": + if sys.platform.startswith("java"): # Jython always uses 32 bits. MAXSIZE = int((1 << 31) - 1) else: @@ -133,6 +152,9 @@ MovedModule("html_entities", "htmlentitydefs", "html.entities"), MovedModule("html_parser", "HTMLParser", "html.parser"), MovedModule("http_client", "httplib", "http.client"), + MovedModule("email_mime_multipart", "email.MIMEMultipart", "email.mime.multipart"), + MovedModule("email_mime_text", "email.MIMEText", "email.mime.text"), + MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"), MovedModule("BaseHTTPServer", "BaseHTTPServer", "http.server"), MovedModule("CGIHTTPServer", "CGIHTTPServer", "http.server"), MovedModule("SimpleHTTPServer", "SimpleHTTPServer", "http.server"), @@ -164,7 +186,7 @@ setattr(_MovedItems, attr.name, attr) del attr -moves = sys.modules["six.moves"] = _MovedItems("moves") +moves = sys.modules[__name__ + ".moves"] = _MovedItems("moves") def add_move(move): @@ -187,22 +209,28 @@ _meth_func = "__func__" _meth_self = "__self__" + _func_closure = "__closure__" _func_code = "__code__" _func_defaults = "__defaults__" + _func_globals = "__globals__" _iterkeys = "keys" _itervalues = "values" _iteritems = "items" + _iterlists = "lists" else: _meth_func = "im_func" _meth_self = "im_self" + _func_closure = "func_closure" _func_code = "func_code" _func_defaults = "func_defaults" + _func_globals = "func_globals" _iterkeys = "iterkeys" _itervalues = "itervalues" _iteritems = "iteritems" + _iterlists = "iterlists" try: @@ -213,14 +241,18 @@ next = advance_iterator +try: + callable = callable +except NameError: + def callable(obj): + return any("__call__" in klass.__dict__ for klass in type(obj).__mro__) + + if PY3: def get_unbound_function(unbound): return unbound Iterator = object - - def callable(obj): - return any("__call__" in klass.__dict__ for klass in type(obj).__mro__) else: def get_unbound_function(unbound): return unbound.im_func @@ -237,21 +269,27 @@ get_method_function = operator.attrgetter(_meth_func) get_method_self = operator.attrgetter(_meth_self) +get_function_closure = operator.attrgetter(_func_closure) get_function_code = operator.attrgetter(_func_code) get_function_defaults = operator.attrgetter(_func_defaults) +get_function_globals = operator.attrgetter(_func_globals) -def iterkeys(d): +def iterkeys(d, **kw): """Return an iterator over the keys of a dictionary.""" - return iter(getattr(d, _iterkeys)()) + return iter(getattr(d, _iterkeys)(**kw)) -def itervalues(d): +def itervalues(d, **kw): """Return an iterator over the values of a dictionary.""" - return iter(getattr(d, _itervalues)()) + return iter(getattr(d, _itervalues)(**kw)) -def iteritems(d): +def iteritems(d, **kw): """Return an iterator over the (key, value) pairs of a dictionary.""" - return iter(getattr(d, _iteritems)()) + return iter(getattr(d, _iteritems)(**kw)) + +def iterlists(d, **kw): + """Return an iterator over the (key, [values]) pairs of a dictionary.""" + return iter(getattr(d, _iterlists)(**kw)) if PY3: @@ -295,17 +333,17 @@ del builtins else: - def exec_(code, globs=None, locs=None): + def exec_(_code_, _globs_=None, _locs_=None): """Execute code in a namespace.""" - if globs is None: + if _globs_ is None: frame = sys._getframe(1) - globs = frame.f_globals - if locs is None: - locs = frame.f_locals + _globs_ = frame.f_globals + if _locs_ is None: + _locs_ = frame.f_locals del frame - elif locs is None: - locs = globs - exec("""exec code in globs, locs""") + elif _locs_ is None: + _locs_ = _globs_ + exec("""exec _code_ in _globs_, _locs_""") exec_("""def reraise(tp, value, tb=None): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/six-1.2.0/test_six.py new/six-1.3.0/test_six.py --- old/six-1.2.0/test_six.py 2012-07-16 22:27:05.000000000 +0200 +++ new/six-1.3.0/test_six.py 2013-03-17 05:01:29.000000000 +0100 @@ -77,6 +77,13 @@ assert "htmlparser" not in six._MovedItems.__dict__ +try: + import _tkinter +except ImportError: + have_tkinter = False +else: + have_tkinter = True + @py.test.mark.parametrize("item_name", [item.name for item in six._moved_attributes]) def test_move_items(item_name): @@ -86,7 +93,7 @@ except ImportError: if item_name == "winreg" and not sys.platform.startswith("win"): py.test.skip("Windows only module") - if "_tkinter" in str(sys.exc_info()[1]): + if item_name.startswith("tkinter") and not have_tkinter: py.test.skip("requires tkinter") raise @@ -204,11 +211,22 @@ py.test.raises(AttributeError, six.get_method_function, hasattr) +def test_get_function_closure(): + def f(): + x = 42 + def g(): + return x + return g + cell = six.get_function_closure(f())[0] + assert type(cell).__name__ == "cell" + + def test_get_function_code(): def f(): pass assert isinstance(six.get_function_code(f), types.CodeType) - py.test.raises(AttributeError, six.get_function_code, hasattr) + if not hasattr(sys, "pypy_version_info"): + py.test.raises(AttributeError, six.get_function_code, hasattr) def test_get_function_defaults(): @@ -217,13 +235,38 @@ assert six.get_function_defaults(f) == (3, 4) -def test_dictionary_iterators(): - d = dict(zip(range(10), reversed(range(10)))) - for name in "keys", "values", "items": - it = getattr(six, "iter" + name)(d) +def test_get_function_globals(): + def f(): + pass + assert six.get_function_globals(f) is globals() + + +def test_dictionary_iterators(monkeypatch): + class MyDict(dict): + if not six.PY3: + def lists(self, **kw): + return [1, 2, 3] + def iterlists(self, **kw): + return iter([1, 2, 3]) + f = MyDict.iterlists + del MyDict.iterlists + setattr(MyDict, six._iterlists, f) + d = MyDict(zip(range(10), reversed(range(10)))) + for name in "keys", "values", "items", "lists": + meth = getattr(six, "iter" + name) + it = meth(d) assert not isinstance(it, list) assert list(it) == list(getattr(d, name)()) py.test.raises(StopIteration, six.advance_iterator, it) + record = [] + def with_kw(*args, **kw): + record.append(kw["kw"]) + return old(*args) + old = getattr(MyDict, getattr(six, "_iter" + name)) + monkeypatch.setattr(MyDict, getattr(six, "_iter" + name), with_kw) + meth(d, kw=42) + assert record == [42] + monkeypatch.undo() def test_advance_iterator(): -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
