Commit c37f0a49 authored by Julien Muchembled's avatar Julien Muchembled

fixup! buildout.py: Optimize _install_and_load by using cache.

parent 27a43288
...@@ -1356,10 +1356,11 @@ _install_and_load_cache = {} ...@@ -1356,10 +1356,11 @@ _install_and_load_cache = {}
def _install_and_load(spec, group, entry, buildout): def _install_and_load(spec, group, entry, buildout):
__doing__ = 'Loading recipe %r.', spec __doing__ = 'Loading recipe %r.', spec
key = spec, group, entry
try: try:
return _install_and_load_cache[(spec, group, entry)] return _install_and_load_cache[key]
except KeyError: except KeyError:
pass pass
try: try:
req = pkg_resources.Requirement.parse(spec) req = pkg_resources.Requirement.parse(spec)
...@@ -1387,9 +1388,8 @@ def _install_and_load(spec, group, entry, buildout): ...@@ -1387,9 +1388,8 @@ def _install_and_load(spec, group, entry, buildout):
) )
__doing__ = 'Loading %s recipe entry %s:%s.', group, spec, entry __doing__ = 'Loading %s recipe entry %s:%s.', group, spec, entry
result = pkg_resources.load_entry_point( result = _install_and_load_cache[key] = pkg_resources.load_entry_point(
req.project_name, group, entry) req.project_name, group, entry)
_install_and_load_cache[(spec, group, entry)] = result
return result return result
except Exception: except Exception:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment