[buildout]
extends =
  ../bzip2/buildout.cfg
  ../file/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
  ../gcc/buildout.cfg
  ../xz-utils/buildout.cfg
  ../zlib/buildout.cfg

parts =
    python3.5

[python3-common]
recipe = slapos.recipe.cmmi
package_version_suffix =

# 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 = ${buildout:parts-directory}/${:_buildout_section_name_}
executable = ${:prefix}/bin/${:_buildout_section_name_}

patch-options = -p1
patches =
  ${:_profile_base_location_}/default_encoding.patch#4ad9664e622d5556b4c32b1d9cb587ff
url =
  https://www.python.org/ftp/python/${:package_version}/Python-${:package_version}${:package_version_suffix}.tar.xz
configure-options =
  --enable-ipv6
  --without-ensurepip
  --with-system-expat
  --with-system-ffi
  --with-threads
  --with-openssl=${openssl:location}
# Profiled build:
  --enable-optimizations
pre-install = mkdir profile-opt

# 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${xz-utils:location}/include -I${readline:location}/include -I${libexpat:location}/include -I${libffi:location}/include -I${ncurses:location}/include -I${ncurses:location}/include/ncursesw -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${xz-utils: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=${xz-utils: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

[python3.5]
<= python3-common
package_version = 3.5.3
md5sum = 57d1f8bfbabf4f2500273fb0706e6f21

[python3.6.6]
<= python3-common
package_version = 3.6.6
md5sum = c3f30a0aff425dda77d19e02f420d6ba
executable = @@LOCATION@@/bin/python3.6

# Python 3.7 have to use gcc 8(actually, gcc 4+)
# See https://bugs.python.org/issue34112
# I think gcc 5 may meet the requirement, use gcc 8 all in one step
[python3.7]
<= python3-common
package_version = 3.7.2
md5sum = df6ec36011808205beda239c72f947cb
patch-options =
patches =
executable = @@LOCATION@@/bin/python3.7
environment =
  PATH=${gcc-8.2:location}/bin::${xz-utils:location}/bin:%(PATH)s
  CPPFLAGS=-I${zlib:location}/include -I${xz-utils:location}/include -I${readline:location}/include -I${libexpat:location}/include -I${libffi:location}/include -I${ncurses:location}/include -I${ncurses:location}/include/ncursesw -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${xz-utils: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=${xz-utils: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
  LD_LIBRARY_PATH=${libpng:location}/lib:${gcc-8.2:location}/lib:${gcc-8.2:location}/lib64