Hello community, here is the log from the commit of package python-six for openSUSE:Factory checked in at 2012-09-21 14:56:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-six (Old) and /work/SRC/openSUSE:Factory/.python-six.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-six", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/python-six/python-six.changes 2012-06-07 15:39:55.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-six.new/python-six.changes 2012-09-21 14:56:15.000000000 +0200 @@ -1,0 +2,12 @@ +Wed Sep 12 03:01:59 UTC 2012 - os-...@jacraig.com + +- Update to 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. + +------------------------------------------------------------------- python3-six.changes: same change Old: ---- six-1.1.0.tar.gz New: ---- six-1.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-six.spec ++++++ --- /var/tmp/diff_new_pack.zAjrCQ/_old 2012-09-21 14:56:17.000000000 +0200 +++ /var/tmp/diff_new_pack.zAjrCQ/_new 2012-09-21 14:56:17.000000000 +0200 @@ -15,9 +15,10 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # + %define modname six Name: python-%{modname} -Version: 1.1.0 +Version: 1.2.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.zAjrCQ/_old 2012-09-21 14:56:17.000000000 +0200 +++ /var/tmp/diff_new_pack.zAjrCQ/_new 2012-09-21 14:56:17.000000000 +0200 @@ -15,9 +15,10 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # + %define modname six Name: python3-%{modname} -Version: 1.1.0 +Version: 1.2.0 Release: 0 Url: http://pypi.python.org/pypi/six/ Summary: Python 2 and 3 compatibility utilities ++++++ six-1.1.0.tar.gz -> six-1.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/six-1.1.0/PKG-INFO new/six-1.2.0/PKG-INFO --- old/six-1.1.0/PKG-INFO 2011-11-23 06:43:15.000000000 +0100 +++ new/six-1.2.0/PKG-INFO 2012-08-28 21:55:21.000000000 +0200 @@ -1,6 +1,6 @@ -Metadata-Version: 1.0 +Metadata-Version: 1.1 Name: six -Version: 1.1.0 +Version: 1.2.0 Summary: Python 2 and 3 compatibility utilities Home-page: http://pypi.python.org/pypi/six/ Author: Benjamin Peterson diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/six-1.1.0/documentation/index.rst new/six-1.2.0/documentation/index.rst --- old/six-1.1.0/documentation/index.rst 2011-10-14 17:36:53.000000000 +0200 +++ new/six-1.2.0/documentation/index.rst 2012-06-11 18:12:41.000000000 +0200 @@ -9,7 +9,8 @@ Six provides simple utilities for wrapping over differences between Python 2 and -Python 3. +Python 3. It is intended to support codebases that work on both Python 2 and 3 +without modification. 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>`_. @@ -136,6 +137,7 @@ Get the defaults tuple associated with *func*. +.. function:: next(it) .. function:: advance_iterator(it) Get the next item of iterator *it*. :exc:`py3:StopIteration` is raised if @@ -169,6 +171,17 @@ Python 3. +.. class:: Iterator + + A class for making portable iterators. The intention is that it be subclassed + and subclasses provide a ``__next__`` method. In Python 2, :class:`Iterator` + has one method: ``next``. It simply delegates to ``__next__``. An alternate + way to do this would be to simply alias ``next`` to ``__next__``. However, + this interacts badly with subclasses that override + ``__next__``. :class:`Iterator` is empty on Python 3. (In fact, it is just + aliased to :class:`py3:object`.) + + Syntax compatibility >>>>>>>>>>>>>>>>>>>> @@ -245,6 +258,15 @@ allows unicode escapes to be used in it. + .. note:: + + 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`. + + .. function:: int2byte(i) Converts *i* to a byte. *i* must be in ``range(0, 256)``. This is @@ -337,7 +359,9 @@ +------------------------------+-------------------------------------+---------------------------------+ | ``SimpleHTTPServer`` | :mod:`py2:SimpleHTTPServer` | :mod:`py3:http.server` | +------------------------------+-------------------------------------+---------------------------------+ -| ``map`` | :mod:`py2:itertools.imap` | :mod:`py3:map` | +| ``input`` | :func:`py2:raw_input` | :func:`py3:input` | ++------------------------------+-------------------------------------+---------------------------------+ +| ``map`` | :func:`py2:itertools.imap` | :func:`py3:map` | +------------------------------+-------------------------------------+---------------------------------+ | ``queue`` | :mod:`py2:Queue` | :mod:`py3:queue` | +------------------------------+-------------------------------------+---------------------------------+ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/six-1.1.0/six.py new/six-1.2.0/six.py --- old/six-1.1.0/six.py 2011-11-23 06:25:30.000000000 +0100 +++ new/six-1.2.0/six.py 2012-08-28 21:39:22.000000000 +0200 @@ -5,7 +5,7 @@ import types __author__ = "Benjamin Peterson <benja...@python.org>" -__version__ = "1.1.0" +__version__ = "1.2.0" # True if we are running on Python 3. @@ -26,19 +26,23 @@ text_type = unicode binary_type = str - # It's possible to have sizeof(long) != sizeof(Py_ssize_t). - class X(object): - def __len__(self): - return 1 << 31 - try: - len(X()) - except OverflowError: - # 32-bit + if sys.platform == "java": + # Jython always uses 32 bits. MAXSIZE = int((1 << 31) - 1) else: - # 64-bit - MAXSIZE = int((1 << 63) - 1) - del X + # It's possible to have sizeof(long) != sizeof(Py_ssize_t). + class X(object): + def __len__(self): + return 1 << 31 + try: + len(X()) + except OverflowError: + # 32-bit + MAXSIZE = int((1 << 31) - 1) + else: + # 64-bit + MAXSIZE = int((1 << 63) - 1) + del X def _add_doc(func, doc): @@ -113,6 +117,7 @@ _moved_attributes = [ MovedAttribute("cStringIO", "cStringIO", "io", "StringIO"), MovedAttribute("filter", "itertools", "builtins", "ifilter", "filter"), + MovedAttribute("input", "__builtin__", "builtins", "raw_input", "input"), MovedAttribute("map", "itertools", "builtins", "imap", "map"), MovedAttribute("reload_module", "__builtin__", "imp", "reload"), MovedAttribute("reduce", "__builtin__", "functools"), @@ -200,12 +205,19 @@ _iteritems = "iteritems" +try: + advance_iterator = next +except NameError: + def advance_iterator(it): + return it.next() +next = advance_iterator + + if PY3: def get_unbound_function(unbound): return unbound - - advance_iterator = next + Iterator = object def callable(obj): return any("__call__" in klass.__dict__ for klass in type(obj).__mro__) @@ -213,9 +225,10 @@ def get_unbound_function(unbound): return unbound.im_func + class Iterator(object): - def advance_iterator(it): - return it.next() + def next(self): + return type(self).__next__(self) callable = callable _add_doc(get_unbound_function, @@ -230,15 +243,15 @@ def iterkeys(d): """Return an iterator over the keys of a dictionary.""" - return getattr(d, _iterkeys)() + return iter(getattr(d, _iterkeys)()) def itervalues(d): """Return an iterator over the values of a dictionary.""" - return getattr(d, _itervalues)() + return iter(getattr(d, _itervalues)()) def iteritems(d): """Return an iterator over the (key, value) pairs of a dictionary.""" - return getattr(d, _iteritems)() + return iter(getattr(d, _iteritems)()) if PY3: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/six-1.1.0/test_six.py new/six-1.2.0/test_six.py --- old/six-1.1.0/test_six.py 1970-01-01 01:00:00.000000000 +0100 +++ new/six-1.2.0/test_six.py 2012-07-16 22:27:05.000000000 +0200 @@ -0,0 +1,415 @@ +import operator +import sys +import types + +import py + +import six + + +def test_add_doc(): + def f(): + """Icky doc""" + pass + six._add_doc(f, """New doc""") + assert f.__doc__ == "New doc" + + +def test_import_module(): + from logging import handlers + m = six._import_module("logging.handlers") + assert m is handlers + + +def test_integer_types(): + assert isinstance(1, six.integer_types) + assert isinstance(-1, six.integer_types) + assert isinstance(six.MAXSIZE + 23, six.integer_types) + assert not isinstance(.1, six.integer_types) + + +def test_string_types(): + assert isinstance("hi", six.string_types) + assert isinstance(six.u("hi"), six.string_types) + assert issubclass(six.text_type, six.string_types) + + +def test_class_types(): + class X: + pass + class Y(object): + pass + assert isinstance(X, six.class_types) + assert isinstance(Y, six.class_types) + assert not isinstance(X(), six.class_types) + + +def test_text_type(): + assert type(six.u("hi")) is six.text_type + + +def test_binary_type(): + assert type(six.b("hi")) is six.binary_type + + +def test_MAXSIZE(): + try: + # This shouldn't raise an overflow error. + six.MAXSIZE.__index__() + except AttributeError: + # Before Python 2.6. + pass + if sys.version_info[:2] == (2, 4): + exc = ValueError + else: + exc = OverflowError + py.test.raises(exc, operator.mul, [None], six.MAXSIZE + 1) + + +def test_lazy(): + if six.PY3: + html_name = "html.parser" + else: + html_name = "HTMLParser" + assert html_name not in sys.modules + mod = six.moves.html_parser + assert sys.modules[html_name] is mod + assert "htmlparser" not in six._MovedItems.__dict__ + + +@py.test.mark.parametrize("item_name", + [item.name for item in six._moved_attributes]) +def test_move_items(item_name): + """Ensure that everything loads correctly.""" + try: + getattr(six.moves, item_name) + 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]): + py.test.skip("requires tkinter") + raise + + +def test_filter(): + from six.moves import filter + f = filter(lambda x: x % 2, range(10)) + assert six.advance_iterator(f) == 1 + + +def test_map(): + from six.moves import map + assert six.advance_iterator(map(lambda x: x + 1, range(2))) == 1 + + +def test_zip(): + from six.moves import zip + assert six.advance_iterator(zip(range(2), range(2))) == (0, 0) + + +class TestCustomizedMoves: + + def teardown_method(self, meth): + try: + del six._MovedItems.spam + except AttributeError: + pass + try: + del six.moves.__dict__["spam"] + except KeyError: + pass + + + def test_moved_attribute(self): + attr = six.MovedAttribute("spam", "foo", "bar") + if six.PY3: + assert attr.mod == "bar" + else: + assert attr.mod == "foo" + assert attr.attr == "spam" + attr = six.MovedAttribute("spam", "foo", "bar", "lemma") + assert attr.attr == "lemma" + attr = six.MovedAttribute("spam", "foo", "bar", "lemma", "theorm") + if six.PY3: + assert attr.attr == "theorm" + else: + assert attr.attr == "lemma" + + + def test_moved_module(self): + attr = six.MovedModule("spam", "foo") + if six.PY3: + assert attr.mod == "spam" + else: + assert attr.mod == "foo" + attr = six.MovedModule("spam", "foo", "bar") + if six.PY3: + assert attr.mod == "bar" + else: + assert attr.mod == "foo" + + + def test_custom_move_module(self): + attr = six.MovedModule("spam", "six", "six") + six.add_move(attr) + six.remove_move("spam") + assert not hasattr(six.moves, "spam") + attr = six.MovedModule("spam", "six", "six") + six.add_move(attr) + from six.moves import spam + assert spam is six + six.remove_move("spam") + assert not hasattr(six.moves, "spam") + + + def test_custom_move_attribute(self): + attr = six.MovedAttribute("spam", "six", "six", "u", "u") + six.add_move(attr) + six.remove_move("spam") + assert not hasattr(six.moves, "spam") + attr = six.MovedAttribute("spam", "six", "six", "u", "u") + six.add_move(attr) + from six.moves import spam + assert spam is six.u + six.remove_move("spam") + assert not hasattr(six.moves, "spam") + + + def test_empty_remove(self): + py.test.raises(AttributeError, six.remove_move, "eggs") + + +def test_get_unbound_function(): + class X(object): + def m(self): + pass + assert six.get_unbound_function(X.m) is X.__dict__["m"] + + +def test_get_method_self(): + class X(object): + def m(self): + pass + x = X() + assert six.get_method_self(x.m) is x + py.test.raises(AttributeError, six.get_method_self, 42) + + +def test_get_method_function(): + class X(object): + def m(self): + pass + x = X() + assert six.get_method_function(x.m) is X.__dict__["m"] + py.test.raises(AttributeError, six.get_method_function, hasattr) + + +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) + + +def test_get_function_defaults(): + def f(x, y=3, b=4): + pass + 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) + assert not isinstance(it, list) + assert list(it) == list(getattr(d, name)()) + py.test.raises(StopIteration, six.advance_iterator, it) + + +def test_advance_iterator(): + assert six.next is six.advance_iterator + l = [1, 2] + it = iter(l) + assert six.next(it) == 1 + assert six.next(it) == 2 + py.test.raises(StopIteration, six.next, it) + py.test.raises(StopIteration, six.next, it) + + +def test_iterator(): + class myiter(six.Iterator): + def __next__(self): + return 13 + assert six.advance_iterator(myiter()) == 13 + class myitersub(myiter): + def __next__(self): + return 14 + assert six.advance_iterator(myitersub()) == 14 + + +def test_callable(): + class X: + def __call__(self): + pass + def method(self): + pass + assert six.callable(X) + assert six.callable(X()) + assert six.callable(test_callable) + assert six.callable(hasattr) + assert six.callable(X.method) + assert six.callable(X().method) + assert not six.callable(4) + assert not six.callable("string") + + +if six.PY3: + + def test_b(): + data = six.b("\xff") + assert isinstance(data, bytes) + assert len(data) == 1 + assert data == bytes([255]) + + + def test_u(): + s = six.u("hi") + assert isinstance(s, str) + assert s == "hi" + +else: + + def test_b(): + data = six.b("\xff") + assert isinstance(data, str) + assert len(data) == 1 + assert data == "\xff" + + + def test_u(): + s = six.u("hi") + assert isinstance(s, unicode) + assert s == "hi" + + +def test_u_escapes(): + s = six.u("\u1234") + assert len(s) == 1 + + +def test_int2byte(): + assert six.int2byte(3) == six.b("\x03") + py.test.raises((OverflowError, ValueError), six.int2byte, 256) + + +def test_StringIO(): + fp = six.StringIO() + fp.write(six.u("hello")) + assert fp.getvalue() == six.u("hello") + + +def test_BytesIO(): + fp = six.BytesIO() + fp.write(six.b("hello")) + assert fp.getvalue() == six.b("hello") + + +def test_exec_(): + def f(): + l = [] + six.exec_("l.append(1)") + assert l == [1] + f() + ns = {} + six.exec_("x = 42", ns) + assert ns["x"] == 42 + glob = {} + loc = {} + six.exec_("global y; y = 42; x = 12", glob, loc) + assert glob["y"] == 42 + assert "x" not in glob + assert loc["x"] == 12 + assert "y" not in loc + + +def test_reraise(): + def get_next(tb): + if six.PY3: + return tb.tb_next.tb_next + else: + return tb.tb_next + e = Exception("blah") + try: + raise e + except Exception: + tp, val, tb = sys.exc_info() + try: + six.reraise(tp, val, tb) + except Exception: + tp2, value2, tb2 = sys.exc_info() + assert tp2 is Exception + assert value2 is e + assert tb is get_next(tb2) + try: + six.reraise(tp, val) + except Exception: + tp2, value2, tb2 = sys.exc_info() + assert tp2 is Exception + assert value2 is e + assert tb2 is not tb + try: + six.reraise(tp, val, tb2) + except Exception: + tp2, value2, tb3 = sys.exc_info() + assert tp2 is Exception + assert value2 is e + assert get_next(tb3) is tb2 + + +def test_print_(): + save = sys.stdout + out = sys.stdout = six.moves.StringIO() + try: + six.print_("Hello,", "person!") + finally: + sys.stdout = save + assert out.getvalue() == "Hello, person!\n" + out = six.StringIO() + six.print_("Hello,", "person!", file=out) + assert out.getvalue() == "Hello, person!\n" + out = six.StringIO() + six.print_("Hello,", "person!", file=out, end="") + assert out.getvalue() == "Hello, person!" + out = six.StringIO() + six.print_("Hello,", "person!", file=out, sep="X") + assert out.getvalue() == "Hello,Xperson!\n" + out = six.StringIO() + six.print_(six.u("Hello,"), six.u("person!"), file=out) + result = out.getvalue() + assert isinstance(result, six.text_type) + assert result == six.u("Hello, person!\n") + six.print_("Hello", file=None) # This works. + out = six.StringIO() + six.print_(None, file=out) + assert out.getvalue() == "None\n" + + +def test_print_exceptions(): + py.test.raises(TypeError, six.print_, x=3) + py.test.raises(TypeError, six.print_, end=3) + py.test.raises(TypeError, six.print_, sep=42) + + +def test_with_metaclass(): + class Meta(type): + pass + class X(six.with_metaclass(Meta)): + pass + assert type(X) is Meta + assert issubclass(X, object) + class Base(object): + pass + class X(six.with_metaclass(Meta, Base)): + pass + assert type(X) is Meta + assert issubclass(X, Base) -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org