Commit 931a4b73 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

Cache parser object in zc/buildout/buildout.py:_open() in memory to accelerate extends.

parent 4d6a8c28
1.7.1-dev-SlapOS-004
--------------------
- Cache parser object in zc/buildout/buildout.py:_open() in memory 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_parser_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,
...@@ -1741,9 +1742,12 @@ def _open(base, filename, seen, dl_options, override, downloaded): ...@@ -1741,9 +1742,12 @@ def _open(base, filename, seen, dl_options, override, downloaded):
result = {} result = {}
parser = _open_parser_cache.get(filename)
if parser is None:
parser = ConfigParser.RawConfigParser() parser = ConfigParser.RawConfigParser()
parser.optionxform = lambda s: s parser.optionxform = lambda s: s
parser.readfp(fp) parser.readfp(fp)
_open_parser_cache[filename] = parser
if is_temp: if is_temp:
fp.close() fp.close()
os.remove(path) os.remove(path)
......
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