# SlapOS component for ZODB.
# https://zodb.org/

[buildout]
extends =
    ../git/buildout.cfg
    ../python-cffi/buildout.cfg

parts = ZODB/scripts


# ZODB allows to use either ZODB4 or ZODB5.
# To select which version to use users should do:
#
#   [ZODB]
#   major = <ZODB-version-major>
#
# By default ZODB4 is used.
[ZODB]
recipe = slapos.recipe.build
major  = 4
init =
  # link/depend ZODB -> ZODB<X>
  zodb_x = 'ZODB'+options['major']
  zodb_x = self.buildout[zodb_x]
  options['depends'] = '$${%s:egg}' % zodb_x.name

  options['egg'] = zodb_x['egg']

  # update [versions] from what is needed by ZODB<X>
  self.buildout.parse('[_ZODB-versions]\n' + zodb_x['egg-versions'])
  versions = self.buildout['versions']
  versions.update(self.buildout['_ZODB-versions'])
  # propagate updated [versions] -> easy_install
  # (buildout does this in Buildout constructor)
  import zc.buildout.easy_install
  zc.buildout.easy_install.default_versions(versions)


# ZODB/scripts installs scripts from ZODB
[ZODB/scripts]
recipe  = zc.recipe.egg:scripts
eggs    = ${ZODB:egg}

# ZODB4 and ZODB5 are plain upstream eggs
[_ZODB]
recipe  = zc.recipe.egg:eggs
egg     = ZODB
eggs    = ${:egg}
depends = ${persistent:egg} ${BTrees:egg}

[ZODB4]
<= _ZODB
egg-versions =
  ZODB = 4.4.5
  transaction = 1.7.0

[ZODB5]
<= _ZODB
egg-versions =
  ZODB = 5.6.0
  transaction = 2.4.0


# XXX: buildout fails to install properly eggs with setup_requires
[BTrees]
recipe = zc.recipe.egg:custom
egg = ${:_buildout_section_name_}
setup-eggs = ${persistent:egg}

[persistent]
recipe = zc.recipe.egg:custom
egg = ${:_buildout_section_name_}
setup-eggs = ${python-cffi:egg}


# eggs that are common to ZODB4 and ZODB5.
[versions]
BTrees = 4.5.1
persistent = 4.6.4
zodbpickle = 1.0.4

# Provide ZODB3 for those eggs that still care about ZODB3 compatibility -
# for example wendelin.core. ZODB3 3.11 is just a dependency egg on _latest_
# ZODB, persistent, BTrees and ZEO.
ZODB3 = 3.11.0