The multiple mutation of Z3C_RECIPE_FILETEMPLATE_BASE are confusing.
Especially, the two identical Z3C_RECIPE_FILETEMPLATE_BASE=`dirname ...`
I assume that's the way to get to the parent directory of the script. Would be
clearer to use multiple variables, at the detriment of more namespace
polluting. At the very least a comment would help the reader. Your call.
I have a couple of minor comments and questions. Should be good to go.
> === modified file 'z3c/recipe/ filetemplate/ README. txt'
> + >>> cat(sample_ buildout, 'bin', 'dosomething.sh') # doctest: +ELLIPSIS FILETEMPLATE_ BASE=`\ FILETEMPLATE_ BASE=`dirname ${Z3C_RECIPE_ FILETEMPLATE_ BASE}` FILETEMPLATE_ BASE=`dirname ${Z3C_RECIPE_ FILETEMPLATE_ BASE}` FILETEMPLATE_ BASE"/data/ info.csv
> + #!/bin/sh
> + Z3C_RECIPE_
> + readlink -f "$0" 2>/dev/null || \
> + realpath "$0" 2>/dev/null || \
> + type -P "$0" 2>/dev/null`
> + Z3C_RECIPE_
> + Z3C_RECIPE_
> + cat "$Z3C_RECIPE_
> +
The multiple mutation of Z3C_RECIPE_ FILETEMPLATE_ BASE are confusing. FILETEMPLATE_ BASE=`dirname ...`
Especially, the two identical Z3C_RECIPE_
I assume that's the way to get to the parent directory of the script. Would be
clearer to use multiple variables, at the detriment of more namespace
polluting. At the very least a comment would help the reader. Your call.
> === modified file 'z3c/recipe/ filetemplate/ __init_ _.py'
> + def _get(self, section, option, start): dynamic_ options. get(option) colno_lineno( start) logger. error(msg, exc_info=True)
> + if section is None:
> + section = self.recipe.name # This sets up error messages properly.
> + if section == self.recipe.name:
> + factory = self.recipe.
> + if factory is not None:
> + try:
> + return factory(self, start, option)
> + except:
> + # Argh. Would like to raise wrapped exception.
> + colno, lineno = self.get_
> + msg = ('Dynamic option %r in line %d, col %d of %s '
> + 'crashed.') % (option, lineno, colno, self.source)
> + self.recipe.
> + raise
> + # else...
> + options = self.recipe.options
>
Shouldn't you catch and re-raise SystemExit and KeyboardInterrupt? Or was this 'braced_ single' ) recipe. options, recipe.name, option, seen, 'braced_ single' )) 'path_extension ') .split( '/')[1: ]) split(' |')[1:] : filters: colno_lineno( start) filters[ filter] ( colno_lineno( start) logger. error(msg, exc_info=True)
fixed in Python 2.5?
> - def substitute(self, recipe, seen):
> + def substitute(self):
> def convert(mo):
> + start = mo.start()
> # Check the most common path first.
> - option = mo.group(
> + option = mo.group('option')
> if option is not None:
> - val = self._get(
> - mo.start(
> + section = mo.group('section')
> + val = self._get(section, option, start)
> + path_extension = mo.group(
> + filters = mo.group('filters')
> + if path_extension is not None:
> + val = os.path.join(val, *path_extension
> + if filters is not None:
> + for filter in filters.
> + filter = filter.strip()
> + if filter not in self.recipe.
> + colno, lineno = self.get_
> + raise ValueError(
> + 'Unknown filter %r '
> + 'in line %d, col %d of %s' %
> + (filter, lineno, colno, self.source))
> + try:
> + val = self.recipe.
> + val, self, start, filter)
> + except:
> + # Argh. Would like to raise wrapped exception.
> + colno, lineno = self.get_
> + msg = ('Filter %r in line %d, col %d of %s '
> + 'crashed processing value %r') % (
> + filter, lineno, colno, self.source, val)
> + self.recipe.
> + raise
Same question about the bare except.
> +def _relative_ depth(common, path): easy_install.
> + # Helper ripped from zc.buildout.
Is the copy and paste really necessary? easy_install isn't something that can
be imported?