[buildout]
extends =
  ../bzip2/buildout.cfg
  ../gdbm/buildout.cfg
  ../gettext/buildout.cfg
  ../libexpat/buildout.cfg
  ../libffi/buildout.cfg
  ../ncurses/buildout.cfg
  ../openssl/buildout.cfg
  ../patch/buildout.cfg
  ../readline/buildout.cfg
  ../sqlite3/buildout.cfg
  ../zlib/buildout.cfg
  ../file/buildout.cfg
  ../xz-utils/buildout.cfg

parts =
    python2.7

[bootstrap2.7]
recipe = zc.recipe.egg
eggs = zc.buildout
suffix =
scripts =
    buildout=bootstrap2.7
arguments = sys.argv[1:] + ["bootstrap"]
python = python2.7

[python2.7]
recipe = slapos.recipe.cmmi
shared = true
package_version = 2.7.18
package_version_suffix =
md5sum = fd6cc8ec0a78c44036f825e739f36e5a

# This is actually the default setting for prefix, but we can't use it in
# other settings in this part if we don't set it explicitly here.
prefix = @@LOCATION@@
version = 2.7
executable = ${:prefix}/bin/python${:version}

patch-options = -p1
patches =
  ${:_profile_base_location_}/fix_compiler_module_issue_20613.patch#94443a77f903e9de880a029967fa6aa7
  ${:_profile_base_location_}/pytracemalloc_pep445.patch#9f3145817afa2b7fad801fde8447e396
  ${:_profile_base_location_}/disabled_module_list.patch#71ad30d32bcdbc50c19cf48675b1246e
  ${:_profile_base_location_}/asyncore_poll_insteadof_select.patch#ab6991c0ee6e25aeb8951e71f280a2f1
url =
  http://www.python.org/ftp/python/${:package_version}/Python-${:package_version}${:package_version_suffix}.tar.xz
configure-options =
  --enable-ipv6
  --enable-unicode=ucs4
  --with-system-expat
  --with-system-ffi
  --with-threads
# Profiled build:
make-binary =
make-targets = make profile-opt && make install
# Mangle shebang to use installed Python. This is not only a convenience:
# when building system packages (e.g. re6st-node using OBS), some OS like
# recent RedHat would otherwise mangle them, either failing ('python' is
# ambiguous and 'python2' is not supported anymore) or replacing with
# something that's really wrong (/usr/bin/python...).
post-install = cd '${:prefix}' &&
  find -executable -type f -print0 |
  xargs -0 grep -I -m 1 '' |
  sed -n 's,:#! */usr/bin/env \+python2\?$,,p' |
  xargs -d '\n' sed -i '1s,.*,#!${:executable},'

# the entry "-Wl,-rpath=${file:location}/lib" below is needed by python-magic,
# which would otherwise load the system libmagic.so with ctypes
environment =
  PATH=${patch:location}/bin:${xz-utils:location}/bin:%(PATH)s
  CPPFLAGS=-I${zlib:location}/include -I${readline:location}/include -I${libexpat:location}/include -I${libffi:location}/include -I${ncurses:location}/include -I${ncurses:location}/include -I${bzip2:location}/include  -I${gdbm:location}/include -I${openssl:location}/include -I${sqlite3:location}/include -I${gettext:location}/include
  LDFLAGS=-L${zlib:location}/lib -L${readline:location}/lib -L${libexpat:location}/lib -L${libffi:location}/lib -L${ncurses:location}/lib -L${bzip2:location}/lib -L${gdbm:location}/lib -L${openssl:location}/lib -L${sqlite3:location}/lib -Wl,-rpath=${zlib:location}/lib -Wl,-rpath=${readline:location}/lib -Wl,-rpath=${libexpat:location}/lib -Wl,-rpath=${libffi:location}/lib -Wl,-rpath=${ncurses:location}/lib -Wl,-rpath=${bzip2:location}/lib -Wl,-rpath=${gdbm:location}/lib -Wl,-rpath=${openssl:location}/lib -Wl,-rpath=${sqlite3:location}/lib -L${gettext:location}/lib -Wl,-rpath=${gettext:location}/lib -Wl,-rpath=${file:location}/lib
