Commit 84dc7957 authored by Vincent Pelletier's avatar Vincent Pelletier

Provide access to zc.buildout.buildout.dumps when it exists.

Loads support should not be required: the use-case is writing python values
when generating a buildout.cfg file.
parent e121459a
......@@ -31,6 +31,9 @@ import zc.buildout
from jinja2 import Template, StrictUndefined
from contextlib import contextmanager
_buildout_safe_dumps = getattr(zc.buildout.buildout, 'dumps', None)
DUMPS_KEY = 'dumps'
@contextmanager
def umask(mask):
original = os.umask(mask)
......@@ -70,6 +73,8 @@ class Recipe(object):
self.rendered = options['rendered']
self.extension_list = [x for x in (y.strip() for y in options.get('extensions', '').split()) if x]
self.context = context = {}
if _buildout_safe_dumps is not None:
context[DUMPS_KEY] = _buildout_safe_dumps
for line in options.get('context').splitlines(False):
if not line:
continue
......
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