--- trunk/include/pypi.sminc 2017/08/29 12:33:04 29665 +++ trunk/include/pypi.sminc 2017/10/11 09:52:54 29776 @@ -1,6 +1,9 @@ # $Id$ # Pypi functions +# default to build modules for multiple python versions (atm python2 and python3) +: ${PYPI_MULTIPLE_PYTHON_VERSIONS=1} + # needs python sminclude python @@ -19,8 +22,28 @@ : ${SRCDIR="${BUILDDIR}/${PYPI_MODULE}-${PVER}"} -DEPEND="${DEPEND} - >= dev-lang/python-2.7" + +if [[ ${PYPI_MULTIPLE_PYTHON_VERSIONS} = 1 ]] +then + sminclude python2 python3 + SPLIT_PACKAGES="python2-${PNAME} python3-${PNAME}" + + eval "split_info_python2-${PNAME}() + { + DEPEND=\"\${DEPEND} + >= dev-lang/python2-2.7\" + }" + + eval "split_info_python3-${PNAME}() + { + DEPEND=\"\${DEPEND} + >= dev-lang/python3-3.6\" + }" + +else + DEPEND="${DEPEND} + >= dev-lang/python-2.7" +fi SRC_URI=( ${SRC_URI[*]} @@ -33,24 +56,57 @@ pypi_src_prepare() { - python_src_prepare || die + if [[ ${PYPI_MULTIPLE_PYTHON_VERSIONS} = 1 ]] + then + python2_src_prepare || die + python3_src_prepare || die + else + python_src_prepare || die + fi } pypi_src_compile() { local configure_opts="$@" - python_src_compile ${configure_opts} || die + + if [[ ${PYPI_MULTIPLE_PYTHON_VERSIONS} = 1 ]] + then + python2_src_compile ${configure_opts} || die + python3_src_compile ${configure_opts} || die + else + python_src_compile ${configure_opts} || die + fi } pypi_src_install() { - python_src_install || die + if [[ ${PYPI_MULTIPLE_PYTHON_VERSIONS} = 1 ]] + then + python2_src_install || die + python3_src_install || die + else + python_src_install || die + fi } pypi_multilib_src_compile() { local configure_opts="$@" python_multilib_src_compile ${configure_opts} || die + +} + +pypi_multilib_python2_src_compile() +{ + local configure_opts="$@" + + if [[ ${PYPI_MULTIPLE_PYTHON_VERSIONS} = 1 ]] + then + python2_multilib_src_compile ${configure_opts} || die + python3_multilib_src_compile ${configure_opts} || die + else + python_multilib_src_compile ${configure_opts} || die + fi } pypi_multilib_src_install() @@ -58,10 +114,25 @@ python_multilib_src_install || die } +eval "pypi_multilib_src_compile-python2-${PNAME}() +{ + python2_multilib_src_install || die +}" + +eval "pypi_multilib_src_compile-python3-${PNAME}() +{ + python3_multilib_src_install || die +}" + export_inherits pypi src_prepare if [[ ${MULTILIB_BUILD} = true ]] then - export_inherits pypi_multilib src_compile src_install + if [[ ${PYPI_MULTIPLE_PYTHON_VERSIONS} = 1 ]] + then + export_inherits pypi_multilib src_compile src_install_python2-${PNAME} src_install_python3-${PNAME} + else + export_inherits pypi_multilib src_compile src_install + fi else export_inherits pypi src_compile src_install fi