Commit 43e698cb authored by Thomas Leymonerie's avatar Thomas Leymonerie

component/macros.cfg: Create a new macro with pygolang

Using macros.cfg to add a new macro.
This macro will works like [macro-virtual-env].
Neverthless, it will use pygolang to create a more "classic" interpreter.
parent c9ea0172
[buildout]
extends =
../component/pygolang/buildout.cfg
[macro-virtual-env]
recipe = slapos.recipe.build
_name = ${:_buildout_section_name_}
init =
from zc.buildout.easy_install import working_set
import os
name = options['_name']
eggs = options['eggs']
self.buildout.parse("""
[.%(name)s.install]
recipe = zc.recipe.egg
eggs = %(eggs)s
[.%(name)s.add]
<= python-interpreter
eggs += %(eggs)s
""" % locals())
install =
with open(location, "w") as f:
f.write(options['template'] % {
"path" : self.buildout['buildout']['bin-directory'],
"name" : self.name,
})
# Template virtual env for bash shell in posix
[macro-virtual-env:posix]
template =
deactivate () {
for e in PATH PS1
do
eval "if [ \"\$_OLD_VENV_$e\" ]; then $e=\$_OLD_VENV_$e; else unset $e; fi; unset \$_OLD_VENV_$e"
done
unset -f deactivate
}
VENV_PATH=%(path)s
_OLD_VENV_PATH=$PATH
_OLD_VENV_PS1=$PS1
PATH=$VENV_PATH:$PATH
PS1='(%(name)s) '$PS1
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