zc.buildout变量替换前置" ="

时间:2018-02-20 10:13:51

标签: python buildout

使用collective.recipe.template时,我的模板生成正常,但变量插入前面加了=

因此,在下面的配置和模板中,第三行生成的bin/npm脚本最终会显示:

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

...如果事实应该

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

模板/ 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

1 个答案:

答案 0 :(得分:0)

Woops,发现了我的错误。 webapp_dir中的错字,即使在多次阅读和重读之后,我也从未见过某种原因。