Commit 0252a737 authored by Thomas Leymonerie's avatar Thomas Leymonerie

Generic instance macro

See merge request nexedi/slapos!1177
parents b1615a7d 844169f2
......@@ -4,11 +4,12 @@ extends =
[virtual-env-base]
recipe = slapos.recipe.build
_name = ${:_buildout_section_name_}
name = ${:_buildout_section_name_}
default-instance = true
init =
from zc.buildout.easy_install import working_set
import os
name = options['_name']
name = options['name']
eggs = options['eggs']
try:
scripts = "scripts = " + options['scripts']
......@@ -25,6 +26,26 @@ init =
<= python-interpreter
eggs += %(eggs)s
""" % locals())
if is_true(options.get('default-instance')):
cookbook = "{slapos-cookbook:recipe}"
self.buildout.parse("""
[.%(name)s.instance]
recipe = slapos.recipe.template
output = ${buildout:directory}/instance.cfg
depends = $%(cookbook)s
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 =
with open(location, "w") as f:
f.write(options['template'] % {
......
[buildout]
extends =
../../stack/slapos.cfg
../../component/macros/virtual-env.cfg
../../stack/slapos.cfg
../../component/macros/virtual-env.cfg
parts =
instance
slapos-cookbook
[python]
part = python3
django-env
[django-env]
<= virtual-env-base
location = ${buildout:directory}/activate
eggs = Django
[instance]
recipe = slapos.recipe.template
output = ${buildout:directory}/instance.cfg
inline =
[buildout]
parts = publish
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
[publish]
recipe = slapos.cookbook:publish
activate-script = ${django-env:location}
[python]
part = python3
[versions]
Django = 3.2.12
......
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