[Python-modules-commits] [contextlib2] 01/07: Import contextlib2_0.5.3.orig.tar.gz
Tristan Seligmann
mithrandi at moszumanska.debian.org
Thu May 5 01:13:03 UTC 2016
This is an automated email from the git hooks/post-receive script.
mithrandi pushed a commit to branch master
in repository contextlib2.
commit 63c8988c706bc375830595ce760d18679fdfb029
Author: Tristan Seligmann <mithrandi at debian.org>
Date: Thu May 5 03:06:32 2016 +0200
Import contextlib2_0.5.3.orig.tar.gz
---
MANIFEST.in | 3 ++
NEWS.rst | 48 +++++++++++++++++++++++++------
PKG-INFO | 39 ++++++++++++++++---------
README.rst | 36 ++++++++++++++---------
VERSION.txt | 2 +-
PKG-INFO => contextlib2.egg-info/PKG-INFO | 39 ++++++++++++++++---------
contextlib2.egg-info/SOURCES.txt | 17 +++++++++++
contextlib2.egg-info/dependency_links.txt | 1 +
contextlib2.egg-info/top_level.txt | 1 +
contextlib2.py | 22 +++++++++++---
docs/index.rst | 6 ++--
setup.cfg | 8 ++++++
setup.py | 10 +++----
test_contextlib2.py | 43 +++++++++++++++++++++++++++
14 files changed, 213 insertions(+), 62 deletions(-)
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..8d19207
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,3 @@
+include *.py *.txt *.rst MANIFEST.in
+recursive-include docs *.rst *.py make.bat Makefile
+
diff --git a/NEWS.rst b/NEWS.rst
index 1eb2c0f..ec57b0d 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -1,16 +1,41 @@
Release History
---------------
+0.5.3 (2016-05-02)
+^^^^^^^^^^^^^^^^^^
+
+* ``ExitStack`` now correctly handles context managers implemented as old-style
+ classes in Python 2.x (such as ``codecs.StreamReader`` and
+ ``codecs.StreamWriter``)
+
+* ``setup.py`` has been migrated to setuptools and configured to emit a
+ universal wheel file by default
+
+0.5.2 (2016-05-02)
+^^^^^^^^^^^^^^^^^^
+
+* development migrated from BitBucket to GitHub
+
+* ``redirect_stream``, ``redirect_stdout``, ``redirect_stderr`` and ``suppress``
+ now explicitly inherit from ``object``, ensuring compatibility with
+ ``ExitStack`` when run under Python 2.x (patch contributed by Devin
+ Jeanpierre).
+
+* ``MANIFEST.in`` is now included in the published sdist, ensuring the archive
+ can be precisely recreated even without access to the original source repo
+ (patch contributed by Guy Rozendorn)
+
+
0.5.1 (2016-01-13)
-~~~~~~~~~~~~~~~~~~
+^^^^^^^^^^^^^^^^^^
-* Python 2.6 compatilibity restored (although 2.6 is still missing from the
- current CI configuration)
+* Python 2.6 compatilibity restored (patch contributed by Armin Ronacher)
* README converted back to reStructured Text formatting
+
0.5.0 (2016-01-12)
-~~~~~~~~~~~~~~~~~~
+^^^^^^^^^^^^^^^^^^
* Updated to include all features from the Python 3.4 and 3.5 releases of
contextlib (also includes some ``ExitStack`` enhancements made following
@@ -21,23 +46,28 @@ Release History
* Python 2.6, 3.2 and 3.3 have been dropped from compatibility testing
+* tox is now supported for local version compatibility testing (patch by
+ Marc Abramowitz)
+
0.4.0 (2012-05-05)
-~~~~~~~~~~~~~~~~~~
+^^^^^^^^^^^^^^^^^^
* Issue #8: Replace ContextStack with ExitStack (old ContextStack API
retained for backwards compatibility)
+
* Fall back to unittest2 if unittest is missing required functionality
0.3.1 (2012-01-17)
-~~~~~~~~~~~~~~~~~~
+^^^^^^^^^^^^^^^^^^
* Issue #7: Add MANIFEST.in so PyPI package contains all relevant files
+ (patch contributed by Doug Latornell)
0.3 (2012-01-04)
-~~~~~~~~~~~~~~~~
+^^^^^^^^^^^^^^^^
* Issue #5: ContextStack.register no longer pointlessly returns the wrapped
function
@@ -53,14 +83,14 @@ Release History
0.2 (2011-12-15)
-~~~~~~~~~~~~~~~~
+^^^^^^^^^^^^^^^^
* Renamed CleanupManager to ContextStack (hopefully before anyone started
using the module for anything, since I didn't alias the old name at all)
0.1 (2011-12-13)
-~~~~~~~~~~~~~~~~
+^^^^^^^^^^^^^^^^
* Initial release as a backport module
* Added CleanupManager (based on a `Python feature request`_)
diff --git a/PKG-INFO b/PKG-INFO
index 7b735ff..b8fa6eb 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: contextlib2
-Version: 0.5.1
+Version: 0.5.3
Summary: Backports and enhancements for the contextlib module
Home-page: http://contextlib2.readthedocs.org
Author: Nick Coghlan
@@ -10,11 +10,14 @@ Description: .. image:: https://readthedocs.org/projects/contextlib2/badge/?vers
:target: https://contextlib2.readthedocs.org/
:alt: Latest Docs
- .. image:: https://codeship.com/projects/884e9500-3d1a-0133-3eb0-1abe7f570a4c/status?branch=default
- :target: https://codeship.com/projects/102388
+ .. image:: https://img.shields.io/travis/ncoghlan/contextlib2/master.svg
+ :target: http://travis-ci.org/ncoghlan/contextlib2
- .. image:: https://codecov.io/bitbucket/ncoghlan/contextlib2/coverage.svg?branch=default
- :target: https://codecov.io/bitbucket/ncoghlan/contextlib2?branch=default
+ .. image:: https://coveralls.io/repos/github/ncoghlan/contextlib2/badge.svg?branch=master
+ :target: https://coveralls.io/github/ncoghlan/contextlib2?branch=master
+
+ .. image:: https://landscape.io/github/ncoghlan/contextlib2/master/landscape.svg
+ :target: https://landscape.io/github/ncoghlan/contextlib2/
contextlib2 is a backport of the `standard library's contextlib
module <https://docs.python.org/3.5/library/contextlib.html>`_ to
@@ -26,33 +29,43 @@ Description: .. image:: https://readthedocs.org/projects/contextlib2/badge/?vers
Development
-----------
- contextlib2 currently has no dependencies.
+ contextlib2 has no runtime dependencies, but requires ``unittest2`` for testing
+ on Python 2.x.
- Local testing is currently just a matter of running ``python test_contextlib2.py``.
+ Local testing is just a matter of running ``python test_contextlib2.py``.
- You can test against multiple versions of Python with `tox <http://tox.testrun.org/>`_::
+ You can test against multiple versions of Python with
+ `tox <https://tox.testrun.org/>`_::
pip install tox
tox
- Versions currently tested in tox are:
+ Versions currently tested in both tox and Travis CI are:
- * CPython 2.7 (also tested in Codeship)
- * CPython 3.4 (also tested in Codeship)
+ * CPython 2.6
+ * CPython 2.7
+ * CPython 3.4
* CPython 3.5
+ * CPython 3.6 (CPython development branch)
* PyPy
- * PyPy3
- To install all the relevant runtimes on Fedora 23::
+ tox also has a PyPy3 configuration, but it is not configured in Travis
+ due to a
+ `known incompatibility <https://bitbucket.org/pypy/pypy/issues/1903>`_.
+
+ To install several of the relevant runtimes on Fedora 23::
sudo dnf install python python3 pypy pypy3
sudo dnf copr enable -y mstuchli/Python3.5
sudo dnf install python35-python3
+
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: Python Software Foundation License
Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
diff --git a/README.rst b/README.rst
index 74b1136..a8dfd6d 100644
--- a/README.rst
+++ b/README.rst
@@ -2,11 +2,14 @@
:target: https://contextlib2.readthedocs.org/
:alt: Latest Docs
-.. image:: https://codeship.com/projects/884e9500-3d1a-0133-3eb0-1abe7f570a4c/status?branch=default
- :target: https://codeship.com/projects/102388
+.. image:: https://img.shields.io/travis/ncoghlan/contextlib2/master.svg
+ :target: http://travis-ci.org/ncoghlan/contextlib2
-.. image:: https://codecov.io/bitbucket/ncoghlan/contextlib2/coverage.svg?branch=default
- :target: https://codecov.io/bitbucket/ncoghlan/contextlib2?branch=default
+.. image:: https://coveralls.io/repos/github/ncoghlan/contextlib2/badge.svg?branch=master
+ :target: https://coveralls.io/github/ncoghlan/contextlib2?branch=master
+
+.. image:: https://landscape.io/github/ncoghlan/contextlib2/master/landscape.svg
+ :target: https://landscape.io/github/ncoghlan/contextlib2/
contextlib2 is a backport of the `standard library's contextlib
module <https://docs.python.org/3.5/library/contextlib.html>`_ to
@@ -18,25 +21,32 @@ enhancements to the standard library version.
Development
-----------
-contextlib2 currently has no dependencies.
+contextlib2 has no runtime dependencies, but requires ``unittest2`` for testing
+on Python 2.x.
-Local testing is currently just a matter of running ``python test_contextlib2.py``.
+Local testing is just a matter of running ``python test_contextlib2.py``.
-You can test against multiple versions of Python with `tox <http://tox.testrun.org/>`_::
+You can test against multiple versions of Python with
+`tox <https://tox.testrun.org/>`_::
pip install tox
tox
-Versions currently tested in tox are:
+Versions currently tested in both tox and Travis CI are:
-* CPython 2.7 (also tested in Codeship)
-* CPython 3.4 (also tested in Codeship)
+* CPython 2.6
+* CPython 2.7
+* CPython 3.4
* CPython 3.5
+* CPython 3.6 (CPython development branch)
* PyPy
-* PyPy3
-To install all the relevant runtimes on Fedora 23::
+tox also has a PyPy3 configuration, but it is not configured in Travis
+due to a
+`known incompatibility <https://bitbucket.org/pypy/pypy/issues/1903>`_.
+
+To install several of the relevant runtimes on Fedora 23::
sudo dnf install python python3 pypy pypy3
sudo dnf copr enable -y mstuchli/Python3.5
- sudo dnf install python35-python3
\ No newline at end of file
+ sudo dnf install python35-python3
diff --git a/VERSION.txt b/VERSION.txt
index 4b9fcbe..be14282 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1 +1 @@
-0.5.1
+0.5.3
diff --git a/PKG-INFO b/contextlib2.egg-info/PKG-INFO
similarity index 52%
copy from PKG-INFO
copy to contextlib2.egg-info/PKG-INFO
index 7b735ff..b8fa6eb 100644
--- a/PKG-INFO
+++ b/contextlib2.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: contextlib2
-Version: 0.5.1
+Version: 0.5.3
Summary: Backports and enhancements for the contextlib module
Home-page: http://contextlib2.readthedocs.org
Author: Nick Coghlan
@@ -10,11 +10,14 @@ Description: .. image:: https://readthedocs.org/projects/contextlib2/badge/?vers
:target: https://contextlib2.readthedocs.org/
:alt: Latest Docs
- .. image:: https://codeship.com/projects/884e9500-3d1a-0133-3eb0-1abe7f570a4c/status?branch=default
- :target: https://codeship.com/projects/102388
+ .. image:: https://img.shields.io/travis/ncoghlan/contextlib2/master.svg
+ :target: http://travis-ci.org/ncoghlan/contextlib2
- .. image:: https://codecov.io/bitbucket/ncoghlan/contextlib2/coverage.svg?branch=default
- :target: https://codecov.io/bitbucket/ncoghlan/contextlib2?branch=default
+ .. image:: https://coveralls.io/repos/github/ncoghlan/contextlib2/badge.svg?branch=master
+ :target: https://coveralls.io/github/ncoghlan/contextlib2?branch=master
+
+ .. image:: https://landscape.io/github/ncoghlan/contextlib2/master/landscape.svg
+ :target: https://landscape.io/github/ncoghlan/contextlib2/
contextlib2 is a backport of the `standard library's contextlib
module <https://docs.python.org/3.5/library/contextlib.html>`_ to
@@ -26,33 +29,43 @@ Description: .. image:: https://readthedocs.org/projects/contextlib2/badge/?vers
Development
-----------
- contextlib2 currently has no dependencies.
+ contextlib2 has no runtime dependencies, but requires ``unittest2`` for testing
+ on Python 2.x.
- Local testing is currently just a matter of running ``python test_contextlib2.py``.
+ Local testing is just a matter of running ``python test_contextlib2.py``.
- You can test against multiple versions of Python with `tox <http://tox.testrun.org/>`_::
+ You can test against multiple versions of Python with
+ `tox <https://tox.testrun.org/>`_::
pip install tox
tox
- Versions currently tested in tox are:
+ Versions currently tested in both tox and Travis CI are:
- * CPython 2.7 (also tested in Codeship)
- * CPython 3.4 (also tested in Codeship)
+ * CPython 2.6
+ * CPython 2.7
+ * CPython 3.4
* CPython 3.5
+ * CPython 3.6 (CPython development branch)
* PyPy
- * PyPy3
- To install all the relevant runtimes on Fedora 23::
+ tox also has a PyPy3 configuration, but it is not configured in Travis
+ due to a
+ `known incompatibility <https://bitbucket.org/pypy/pypy/issues/1903>`_.
+
+ To install several of the relevant runtimes on Fedora 23::
sudo dnf install python python3 pypy pypy3
sudo dnf copr enable -y mstuchli/Python3.5
sudo dnf install python35-python3
+
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: Python Software Foundation License
Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
diff --git a/contextlib2.egg-info/SOURCES.txt b/contextlib2.egg-info/SOURCES.txt
new file mode 100644
index 0000000..090101c
--- /dev/null
+++ b/contextlib2.egg-info/SOURCES.txt
@@ -0,0 +1,17 @@
+LICENSE.txt
+MANIFEST.in
+NEWS.rst
+README.rst
+VERSION.txt
+contextlib2.py
+setup.cfg
+setup.py
+test_contextlib2.py
+contextlib2.egg-info/PKG-INFO
+contextlib2.egg-info/SOURCES.txt
+contextlib2.egg-info/dependency_links.txt
+contextlib2.egg-info/top_level.txt
+docs/Makefile
+docs/conf.py
+docs/index.rst
+docs/make.bat
\ No newline at end of file
diff --git a/contextlib2.egg-info/dependency_links.txt b/contextlib2.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/contextlib2.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/contextlib2.egg-info/top_level.txt b/contextlib2.egg-info/top_level.txt
new file mode 100644
index 0000000..03fdf8e
--- /dev/null
+++ b/contextlib2.egg-info/top_level.txt
@@ -0,0 +1 @@
+contextlib2
diff --git a/contextlib2.py b/contextlib2.py
index 2b80384..a6acf65 100644
--- a/contextlib2.py
+++ b/contextlib2.py
@@ -179,7 +179,7 @@ class closing(object):
self.thing.close()
-class _RedirectStream:
+class _RedirectStream(object):
_stream = None
@@ -219,7 +219,7 @@ class redirect_stderr(_RedirectStream):
_stream = "stderr"
-class suppress:
+class suppress(object):
"""Context manager to suppress specified exceptions
After the exception is suppressed, execution proceeds with the next
@@ -288,6 +288,20 @@ else:
exc_type, exc_value, exc_tb = exc_details
exec ("raise exc_type, exc_value, exc_tb")
+# Handle old-style classes if they exist
+try:
+ from types import InstanceType
+except ImportError:
+ # Python 3 doesn't have old-style classes
+ _get_type = type
+else:
+ # Need to handle old-style context managers on Python 2
+ def _get_type(obj):
+ obj_type = type(obj)
+ if obj_type is InstanceType:
+ return obj.__class__ # Old-style class
+ return obj_type # New-style class
+
# Inspired by discussions on http://bugs.python.org/issue13585
class ExitStack(object):
"""Context manager for dynamic management of a stack of exit callbacks
@@ -328,7 +342,7 @@ class ExitStack(object):
"""
# We use an unbound method rather than a bound method to follow
# the standard lookup behaviour for special methods
- _cb_type = type(exit)
+ _cb_type = _get_type(exit)
try:
exit_method = _cb_type.__exit__
except AttributeError:
@@ -358,7 +372,7 @@ class ExitStack(object):
returns the result of the __enter__ method.
"""
# We look up the special methods on the type to match the with statement
- _cm_type = type(cm)
+ _cm_type = _get_type(cm)
_exit = _cm_type.__exit__
result = _cm_type.__enter__(cm)
self._push_cm_exit(cm, _exit)
diff --git a/docs/index.rst b/docs/index.rst
index cd32393..71474a2 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -693,11 +693,11 @@ Supported Python versions are currently 2.7 and 3.2+.
Development and Support
-----------------------
-contextlib2 is developed and maintained on BitBucket_. Problems and suggested
+contextlib2 is developed and maintained on GitHub_. Problems and suggested
improvements can be posted to the `issue tracker`_.
-.. _BitBucket: https://bitbucket.org/ncoghlan/contextlib2/overview
-.. _issue tracker: https://bitbucket.org/ncoghlan/contextlib2/issues?status=new&status=open
+.. _GitHub: https://github.com/ncoghlan/contextlib2
+.. _issue tracker: https://github.com/ncoghlan/contextlib2/issues
.. include:: ../NEWS.rst
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..6f08d0e
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,8 @@
+[bdist_wheel]
+universal = 1
+
+[egg_info]
+tag_build =
+tag_date = 0
+tag_svn_revision = 0
+
diff --git a/setup.py b/setup.py
index 12f8f18..cbb0f5d 100755
--- a/setup.py
+++ b/setup.py
@@ -1,9 +1,5 @@
#!/usr/bin/env python
-from distutils.core import setup
-
-# Technically, unittest2 is a dependency to run the tests on 2.7
-# This file ignores that, since I don't want to depend on
-# setuptools just to get "tests_require" support
+from setuptools import setup
setup(
name='contextlib2',
@@ -20,10 +16,12 @@ setup(
'License :: OSI Approved :: Python Software Foundation License',
# These are the Python versions tested, it may work on others
'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
],
-)
\ No newline at end of file
+)
diff --git a/test_contextlib2.py b/test_contextlib2.py
index 3a12585..3aba52f 100755
--- a/test_contextlib2.py
+++ b/test_contextlib2.py
@@ -706,6 +706,39 @@ class TestExitStack(unittest.TestCase):
stack.push(cm)
self.assertIs(stack._exit_callbacks[-1], cm)
+ def test_default_class_semantics(self):
+ # For Python 2.x, this ensures compatibility with old-style classes
+ # For Python 3.x, it just reruns some of the other tests
+ class DefaultCM:
+ def __enter__(self):
+ result.append("Enter")
+ def __exit__(self, *exc_details):
+ result.append("Exit")
+ class DefaultCallable:
+ def __call__(self, *exc_details):
+ result.append("Callback")
+
+ result = []
+ cm = DefaultCM()
+ cb = DefaultCallable()
+ with ExitStack() as stack:
+ stack.enter_context(cm)
+ self.assertIs(stack._exit_callbacks[-1].__self__, cm)
+ stack.push(cb)
+ stack.push(cm)
+ self.assertIs(stack._exit_callbacks[-1].__self__, cm)
+ result.append("Running")
+ stack.callback(cb)
+ self.assertIs(stack._exit_callbacks[-1].__wrapped__, cb)
+ self.assertEqual(result, ["Enter", "Running",
+ "Callback", "Exit",
+ "Callback", "Exit",
+ ])
+
+ with ExitStack():
+ pass
+
+
class TestRedirectStream:
@@ -763,6 +796,11 @@ class TestRedirectStream:
s = f.getvalue()
self.assertEqual(s, "Hello World!\n")
+ def test_cm_is_exitstack_compatible(self):
+ with ExitStack() as stack:
+ # This shouldn't raise an exception.
+ stack.enter_context(self.redirect_stream(io.StringIO()))
+
class TestRedirectStdout(TestRedirectStream, unittest.TestCase):
@@ -830,6 +868,11 @@ class TestSuppress(unittest.TestCase):
1/0
self.assertTrue(outer_continued)
+ def test_cm_is_exitstack_compatible(self):
+ with ExitStack() as stack:
+ # This shouldn't raise an exception.
+ stack.enter_context(suppress())
+
if __name__ == "__main__":
import unittest
unittest.main()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/contextlib2.git
More information about the Python-modules-commits
mailing list