Commit 8f52adb1 authored by Thomas Leymonerie's avatar Thomas Leymonerie

component/macros/virtual-env: Create a default instance

Now, `virtual-env.cfg` will create an instance by default.

This instance will publish `activate` script path.
parent 6cb77ce1
...@@ -4,11 +4,12 @@ extends = ...@@ -4,11 +4,12 @@ extends =
[virtual-env-base] [virtual-env-base]
recipe = slapos.recipe.build recipe = slapos.recipe.build
_name = ${:_buildout_section_name_} name = ${:_buildout_section_name_}
default-instance = true
init = init =
from zc.buildout.easy_install import working_set from zc.buildout.easy_install import working_set
import os import os
name = options['_name'] name = options['name']
eggs = options['eggs'] eggs = options['eggs']
try: try:
scripts = "scripts = " + options['scripts'] scripts = "scripts = " + options['scripts']
...@@ -25,6 +26,25 @@ init = ...@@ -25,6 +26,25 @@ init =
<= python-interpreter <= python-interpreter
eggs += %(eggs)s eggs += %(eggs)s
""" % locals()) """ % locals())
if is_true(options.get('default-instance')):
self.buildout.parse("""
[.%(name)s.instance]
recipe = slapos.recipe.template
output = ${buildout:directory}/instance.cfg
depends = ${slapos-cookbook:recipe}
inline =
[buildout]
parts = publish
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
[publish]
recipe = slapos.cookbook:publish
activate-script = %(location)s
""" % locals())
install = install =
with open(location, "w") as f: with open(location, "w") as f:
f.write(options['template'] % { f.write(options['template'] % {
......
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