[buildout]
parts =
  slapos.core-setup
  slapos-test-runner
  sh-environment

eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true

[create-directory]
recipe = slapos.cookbook:mkdirectory
bin = $${buildout:directory}/bin
etc = $${buildout:directory}/etc
services = $${:etc}/run
srv = $${buildout:directory}/srv
source-code = $${:srv}/eggs-source-code

[download-source]
recipe = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git

# Local development
[slapos.core]
<= download-source
repository = ${slapos.core-repository:location}

[slapos.core-setup]
recipe = plone.recipe.command
command = echo "Updating setup...";cd $${slapos.core:location}; export PATH="$${slapos-test-runner:prepend-path}:$PATH"; export CPPFLAGS="$${environment:CPPFLAGS}"; export LDFLAGS="$${environment:LDFLAGS}"; export PYTHONPATH="$${environment:PYTHONPATH}"; python setup.py test -n; python setup.py test -n; python setup.py test -n; python setup.py test -n 
update-command = $${:command}


[slapos.recipe.template]
<= download-source
repository = ${slapos.recipe.template-repository:location}

[slapos.recipe.build]
<= download-source
repository = ${slapos.recipe.build-repository:location}

[slapos-test-runner]
recipe = slapos.cookbook:egg_test
run-test-suite = $${create-directory:bin}/runTestSuite
run-test-suite-binary = ${buildout:bin-directory}/runTestSuite
# The list of executables should be defined here and a combination
# of tests should dynamically generated.
#python-list = $${}
test-list =
  $${slapos.core:location}
  $${slapos.recipe.template:location}
  $${slapos.recipe.build:location}
prepend-path = ${git:location}/bin:${libxslt:location}/bin:${python2.7:location}/bin
environment = environment

[environment]
CPPFLAGS = -I${python2.7:location}/include/python2.7 -I${libxml2:location}/include -I${libxslt:location}/include
LDFLAGS = -L${python2.7:location}/lib -L${libxml2:location}/lib -L${libxslt:location}/lib -L${libxslt:location}/lib -L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib -Wl,-rpath=${python2.7:location}/lib -Wl,-rpath=${libxml2:location}/lib -Wl,-rpath=${libxslt:location}/lib -Wl,-rpath=${zlib:location}/lib
LD_LIBRARY_PATH = ${python2.7:location}/lib:${libxml2:location}/lib:${libxslt:location}/lib:${libxslt:location}/lib:${zlib:location}/lib
PYTHONPATH = ${python-setuptools:pythonpath}

[sh-environment]
# Section exposes testing default environment as sh file. It is thus easy
# to directly develop and test the egg inside of this instance.
recipe = collective.recipe.template
input = inline:
  export PATH="$${slapos-test-runner:prepend-path}:$PATH"
  export CPPFLAGS="$${environment:CPPFLAGS}"
  export LDFLAGS="$${environment:LDFLAGS}"
  export PYTHONPATH="$${environment:PYTHONPATH}"
  export PS1="[slapos-testing env Active] $PS1"
output = $${create-directory:bin}/environment.sh
mode = 755