Commit 85bdc124 authored by Kazuhiko's avatar Kazuhiko

Cache _open() result in zc/buildout/buildout.py to accelerate extends.

parent 4d6a8c28
1.7.1-dev-SlapOS-004
--------------------
- Cache _open() result in zc/buildout/buildout.py to accelerate extends.
1.7.1-dev-SlapOS-003 1.7.1-dev-SlapOS-003
-------------------- --------------------
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# #
############################################################################## ##############################################################################
name = "zc.buildout" name = "zc.buildout"
version = "1.7.1-dev-SlapOS-003" version = "1.7.1-dev-SlapOS-004"
import os import os
from setuptools import setup from setuptools import setup
......
...@@ -1691,6 +1691,7 @@ def _save_options(section, options, f): ...@@ -1691,6 +1691,7 @@ def _save_options(section, options, f):
for option in sorted(options.keys()): for option in sorted(options.keys()):
_save_option(option, options.get(option), f) _save_option(option, options.get(option), f)
_open_result_cache = {}
def _open(base, filename, seen, dl_options, override, downloaded): def _open(base, filename, seen, dl_options, override, downloaded):
"""Open a configuration file and return the result as a dictionary, """Open a configuration file and return the result as a dictionary,
...@@ -1730,6 +1731,9 @@ def _open(base, filename, seen, dl_options, override, downloaded): ...@@ -1730,6 +1731,9 @@ def _open(base, filename, seen, dl_options, override, downloaded):
base = os.path.dirname(filename) base = os.path.dirname(filename)
downloaded.add(filename) downloaded.add(filename)
if filename in _open_result_cache:
return _open_result_cache[filename]
if filename in seen: if filename in seen:
if is_temp: if is_temp:
fp.close() fp.close()
...@@ -1790,6 +1794,7 @@ def _open(base, filename, seen, dl_options, override, downloaded): ...@@ -1790,6 +1794,7 @@ def _open(base, filename, seen, dl_options, override, downloaded):
result = _update(eresult, result) result = _update(eresult, result)
seen.pop() seen.pop()
_open_result_cache[filename] = result
return result return result
......
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