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

parts =
    python3

[python3]
<= python3.9

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

executable = @@LOCATION@@/bin/${:_buildout_section_name_}

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-build = printf '*disabled*\nnis\n' >> Modules/Setup.local
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=${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 -I${bzip2:location}/include  -I${gdbm:location}/include -I${openssl:location}/include -I${sqlite3:location}/include -I${gettext:location}/include -I${libuuid: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 -L${libuuid: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 -Wl,-rpath=${libuuid:location}/lib

[python3.7]
<= python3-common
version = 3.7
package_version = 3.7.17
md5sum = dd94cab4541b57b88cf3dab32d6336e3

[python3.8]
<= python3-common
version = 3.8
package_version = 3.8.18
md5sum = 5ea6267ea00513fc31d3746feb35842d

[python3.9]
<= python3-common
version = 3.9
package_version = 3.9.18
md5sum = 765576c3af57deb046819ecd57804bbb

[python3.10]
<= python3-common
version = 3.10
package_version = 3.10.13
md5sum = 8847dc6458d1431d0ae0f55942deeb89

[python3.11]
<= python3-common
version = 3.11
package_version = 3.11.5
md5sum = 393856f1b7713aa8bba4b642ab9985d3
