pythonbuildout

zc.buildout variable substitution prepends a "="


When using collective.recipe.template, my template is generated fine, except that variables are inserted with a extra = in front of it.

So in the config and template below, the generated bin/npm script, on the third line ends up reading:

cd = /home/andre/dev/myapp/webapp/frontend/static

... when if fact it should be:

cd /home/andre/dev/myapp/webapp/frontend/static

buildout.cfg

[baseconfig]
webapp_dir= = ${buildout:directory}/webapp
resources_dir = ${buildout:directory}/resources
playbooks_dir = ${buildout:directory}/playbooks
npm_root = ${:resources_dir}/static/

[config]
<= baseconfig
npm_root = ${:webapp_dir}/frontend/static

[npm]
recipe = collective.recipe.template
input = templates/npm.sh.in
output = ${buildout:bin-directory}/npm
mode = 744

templates/npm.sh.in

#!/bin/bash

cd ${config:npm_root}

case "$1" in
    install)
        npm install
        ;;

    workbox)
        npm run workbox
        ;;

    copy-workbox)
        npm run copy-workbox
        ;;

    build-bower)
        npm run build-bower
        ;;

    build-sw)
        npm run build-sw
        ;;

    build-all)
        npm run build-all
        ;;

    *)
        echo $"Usage: $0 {install|workbox|copy-workbox|build-bower|build-sw|build-all}"
        exit 1
esac

Solution

  • Woops, discovered my error. Typo in webapp_dir which I never saw for some reason even after reading and re-reading multiple times.