buildout.cfg 2.32 KB
[buildout]
extends =
  ../defaults.cfg
  ../babeld/buildout.cfg
  ../geoip2/buildout.cfg
  ../openvpn/buildout.cfg
  ../python-cryptography/buildout.cfg
  ../python-PyYAML/buildout.cfg
  ../python-pim-dm/buildout.cfg

parts =
  re6stnet

[gcc]
min_version = 0

[re6stnet]
recipe = zc.recipe.egg
eggs =
  ${maxminddb-python:egg}
  ${python-cffi:egg}
  ${python-cryptography:egg}
  ${python-PyYAML:egg}
  pyOpenSSL
  re6stnet[geoip]

# Note: For now original PATH is appended to the end, as not all tools are
#       provided by SlapOS
initialization =
  import os
  os.environ['GEOIP2_MMDB'] = "${geolite2-country:location}/GeoLite2-Country.mmdb"
  os.environ['PATH'] = "${openvpn:location}/sbin:${babeld:location}/bin:${openssl:location}/bin:${python:location}/bin:${pim-dm-buildout:location}/bin:" + os.environ.get('PATH', '/usr/sbin:/usr/bin:/sbin:/bin')

[pim-dm-buildout]
recipe = slapos.recipe.build
base = ${:_profile_base_location_}
python = ${python3:executable}
install =
  import os
  from zc.buildout.buildout import _isurl, urljoin
  from slapos.rebootstrap.bootstrap import setup_script
  base = options['base']
  if _isurl(base):
    extends = lambda path: urljoin(base + '/', path)
  else:
    extends = lambda path: os.path.realpath(os.path.join(base, path))

  buildout_extra = []
  buildout_section = self.buildout['buildout']
  for option_name in ('download-cache', 'newest', 'shared-part-list'):
    option_value = buildout_section.get(option_name)
    if option_value:
      buildout_extra.append('%s = %s' % (option_name, option_value))
  os.mkdir(location)
  with open(os.path.join(location, 'buildout.cfg'), 'w') as buildout_conf:
    buildout_conf.write(
      options['template'] % {
        'extends': '\n  '.join(map(extends, (
          '../../stack/slapos.cfg',
          '../python-pim-dm/buildout.cfg',
          ))),
        'buildout': '\n'.join(buildout_extra),
      }
    )
  buildout = os.path.join(location, 'bin', 'buildout')
  os.mkdir(os.path.dirname(buildout))
  setup_script(buildout, options['python'])
  call((buildout, '-U'), cwd=location)
template =
  [buildout]
  extends = %(extends)s
  extends-cache = ${buildout:extends-cache}
  extensions -= slapos.rebootstrap
  %(buildout)s
  [libpcap]
  recipe =
  location = ${libpcap:location}
  environment =
  [libyaml]
  recipe =
  location = ${libyaml:location}
  pre-configure =