Hello community, here is the log from the commit of package python-stevedore for openSUSE:Factory checked in at 2013-01-14 22:25:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-stevedore (Old) and /work/SRC/openSUSE:Factory/.python-stevedore.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-stevedore", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/python-stevedore/python-stevedore.changes 2012-12-14 10:47:37.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.python-stevedore.new/python-stevedore.changes 2013-01-14 22:26:00.000000000 +0100 @@ -1,0 +2,10 @@ +Sat Jan 5 10:47:11 UTC 2013 - [email protected] + +- Update to 0.8: + - Ignore AssertionError exceptions generated when plugins are + loaded. + - Update :class:`~stevedore.named.NamedExtensionManager` to check + the name of a plugin before loading its code to avoid importing + anything we are not going to use. + +------------------------------------------------------------------- Old: ---- stevedore-0.7.2.tar.gz New: ---- stevedore-0.8.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-stevedore.spec ++++++ --- /var/tmp/diff_new_pack.NBSt5U/_old 2013-01-14 22:26:00.000000000 +0100 +++ /var/tmp/diff_new_pack.NBSt5U/_new 2013-01-14 22:26:00.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-stevedore # -# 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 @@ -17,7 +17,7 @@ Name: python-stevedore -Version: 0.7.2 +Version: 0.8 Release: 0 Summary: Manage dynamic plugins for Python applications License: Apache-2.0 ++++++ stevedore-0.7.2.tar.gz -> stevedore-0.8.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stevedore-0.7.2/PKG-INFO new/stevedore-0.8/PKG-INFO --- old/stevedore-0.7.2/PKG-INFO 2012-11-28 12:24:01.000000000 +0100 +++ new/stevedore-0.8/PKG-INFO 2013-01-05 01:17:42.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: stevedore -Version: 0.7.2 +Version: 0.8 Summary: Manage dynamic plugins for Python applications Home-page: https://github.com/dreamhost/stevedore Author: Doug Hellmann diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stevedore-0.7.2/announce.rst new/stevedore-0.8/announce.rst --- old/stevedore-0.7.2/announce.rst 2012-11-26 18:43:03.000000000 +0100 +++ new/stevedore-0.8/announce.rst 2013-01-05 01:16:40.000000000 +0100 @@ -1,5 +1,5 @@ =============== - stevedore 0.7 + stevedore 0.8 =============== .. tags:: stevedore release python @@ -25,9 +25,11 @@ What's New? =========== -- Add memoization to the entrypoint scanning code in - ``ExtensionManager`` to avoid performance issues in situations where - lots of managers are instantiated with the same namespace argument. +- Ignore AssertionError exceptions generated when plugins are + loaded. +- Update ``NamedExtensionManager`` to check the name of a plugin + before loading its code to avoid importing anything we are not going + to use. Installing ========== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stevedore-0.7.2/docs/source/history.rst new/stevedore-0.8/docs/source/history.rst --- old/stevedore-0.7.2/docs/source/history.rst 2012-11-28 12:22:26.000000000 +0100 +++ new/stevedore-0.8/docs/source/history.rst 2013-01-05 01:16:12.000000000 +0100 @@ -2,6 +2,14 @@ History ========= +0.8 + + - Ignore AssertionError exceptions generated when plugins are + loaded. + - Update :class:`~stevedore.named.NamedExtensionManager` to check + the name of a plugin before loading its code to avoid importing + anything we are not going to use. + 0.7.2 - Fix logging support for Python 2.6. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stevedore-0.7.2/setup.py new/stevedore-0.8/setup.py --- old/stevedore-0.7.2/setup.py 2012-11-28 12:23:02.000000000 +0100 +++ new/stevedore-0.8/setup.py 2013-01-05 01:16:08.000000000 +0100 @@ -16,7 +16,7 @@ setup( name='stevedore', - version='0.7.2', + version='0.8', description='Manage dynamic plugins for Python applications', long_description=long_description, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stevedore-0.7.2/stevedore/extension.py new/stevedore-0.8/stevedore/extension.py --- old/stevedore-0.7.2/stevedore/extension.py 2012-11-26 18:41:27.000000000 +0100 +++ new/stevedore-0.8/stevedore/extension.py 2013-01-05 01:03:25.000000000 +0100 @@ -76,7 +76,7 @@ ) if ext: extensions.append(ext) - except KeyboardInterrupt: + except (KeyboardInterrupt, AssertionError): raise except Exception as err: LOG.error('Could not load %r: %s', ep.name, err) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stevedore-0.7.2/stevedore/named.py new/stevedore-0.8/stevedore/named.py --- old/stevedore-0.7.2/stevedore/named.py 2012-10-29 15:45:57.000000000 +0100 +++ new/stevedore-0.8/stevedore/named.py 2013-01-05 01:11:19.000000000 +0100 @@ -1,7 +1,7 @@ -from .enabled import EnabledExtensionManager +from .extension import ExtensionManager -class NamedExtensionManager(EnabledExtensionManager): +class NamedExtensionManager(ExtensionManager): """Loads only the named extensions. This is useful for explictly enabling extensions in a @@ -9,8 +9,8 @@ :param namespace: The namespace for the entry points. :type namespace: str - :param name: The names of the extensions to load. - :type name: str + :param names: The names of the extensions to load. + :type names: str :param invoke_on_load: Boolean controlling whether to invoke the object returned by the entry point after the driver is loaded. :type invoke_on_load: bool @@ -26,12 +26,20 @@ def __init__(self, namespace, names, invoke_on_load=False, invoke_args=(), invoke_kwds={}): - def check(ep): - return ep.name in names + self._names = names super(NamedExtensionManager, self).__init__( namespace, - check, invoke_on_load=invoke_on_load, invoke_args=invoke_args, invoke_kwds=invoke_kwds, ) + + def _load_one_plugin(self, ep, invoke_on_load, invoke_args, invoke_kwds): + # Check the name before going any further to prevent + # undesirable code from being loaded at all if we are not + # going to use it. + if ep.name not in self._names: + return None + return super(NamedExtensionManager, self)._load_one_plugin( + ep, invoke_on_load, invoke_args, invoke_kwds, + ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stevedore-0.7.2/stevedore/tests/test_named.py new/stevedore-0.8/stevedore/tests/test_named.py --- old/stevedore-0.7.2/stevedore/tests/test_named.py 2012-09-15 21:55:53.000000000 +0200 +++ new/stevedore-0.8/stevedore/tests/test_named.py 2013-01-05 01:05:32.000000000 +0100 @@ -1,13 +1,37 @@ from stevedore import named +import mock + def test_named(): em = named.NamedExtensionManager( 'stevedore.test.extension', - ['t1'], + names=['t1'], invoke_on_load=True, invoke_args=('a',), invoke_kwds={'b': 'B'}, ) - assert len(em.extensions) == 1 - assert em.names() == ['t1'] + actual = em.names() + assert actual == ['t1'] + + +def test_enabled_before_load(): + # Set up the constructor for the FauxExtension to cause an + # AssertionError so the test fails if the class is instantiated, + # which should only happen if it is loaded before the name of the + # extension is compared against the names that should be loaded by + # the manager. + init_name = 'stevedore.tests.test_extension.FauxExtension.__init__' + with mock.patch(init_name) as m: + m.side_effect = AssertionError + em = named.NamedExtensionManager( + 'stevedore.test.extension', + # Look for an extension that does not exist so the + # __init__ we mocked should never be invoked. + names=['no-such-extension'], + invoke_on_load=True, + invoke_args=('a',), + invoke_kwds={'b': 'B'}, + ) + actual = em.names() + assert actual == [] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stevedore-0.7.2/stevedore.egg-info/PKG-INFO new/stevedore-0.8/stevedore.egg-info/PKG-INFO --- old/stevedore-0.7.2/stevedore.egg-info/PKG-INFO 2012-11-28 12:24:01.000000000 +0100 +++ new/stevedore-0.8/stevedore.egg-info/PKG-INFO 2013-01-05 01:17:42.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: stevedore -Version: 0.7.2 +Version: 0.8 Summary: Manage dynamic plugins for Python applications Home-page: https://github.com/dreamhost/stevedore Author: Doug Hellmann -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
