Commit fc8dcbb8 authored by Julien Muchembled's avatar Julien Muchembled

default: add support for inline templates

parent 0f8a8b27
...@@ -29,6 +29,7 @@ import os ...@@ -29,6 +29,7 @@ import os
import stat import stat
import tempfile import tempfile
import zc.buildout import zc.buildout
from zc.buildout import UserError
if str is bytes: if str is bytes:
str2bytes = lambda s: s str2bytes = lambda s: s
...@@ -72,9 +73,22 @@ class Recipe(object): ...@@ -72,9 +73,22 @@ class Recipe(object):
def _init(self, name, options): def _init(self, name, options):
self.output = options['output'] self.output = options['output']
options_sub = options._sub rendered = options.get('inline')
self.rendered = '$'.join(options_sub(s, None) try:
for s in self._read(options['url']).split('$$')) url = options['url']
except KeyError:
if rendered is None:
raise
if self.md5sum:
raise UserError("options 'inline' & 'md5sum' conflict")
self.md5sum = True # tell update() to do nothing
self.rendered = rendered
else:
if rendered:
raise UserError("options 'inline' & 'url' conflict")
options_sub = options._sub
self.rendered = '$'.join(options_sub(s, None)
for s in self._read(url).split('$$'))
def _read(self, url, *args): def _read(self, url, *args):
path, is_temp = zc.buildout.download.Download( path, is_temp = zc.buildout.download.Download(
......
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