From 78d5d85aa967ef9c68a5b14d4bc0c44a3338e043 Mon Sep 17 00:00:00 2001 From: Nabil Ghodbane Date: Thu, 20 Jun 2024 10:45:10 +0200 Subject: [PATCH] spns #42158: build Python 2.7.16 with pip support - add a dedicated section for scipy --- products/Python.pyconf | 5 +++ products/compil_scripts/Python-2.7.16.sh | 56 ++++++++++++++++++++++++ products/compil_scripts/scipy-0.18.1.sh | 28 ++++++++++++ products/scipy.pyconf | 9 +++- 4 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 products/compil_scripts/Python-2.7.16.sh create mode 100755 products/compil_scripts/scipy-0.18.1.sh diff --git a/products/Python.pyconf b/products/Python.pyconf index 5dba14d..dda3111 100755 --- a/products/Python.pyconf +++ b/products/Python.pyconf @@ -40,6 +40,11 @@ version_2_7_10 : patches : ['Python-2.7.10-ssl.patch'] } +version_2_7_16_CO9 : +{ + compil_script: 'Python-2.7.16.sh' +} + version_3_6_5 : { patches : [] diff --git a/products/compil_scripts/Python-2.7.16.sh b/products/compil_scripts/Python-2.7.16.sh new file mode 100644 index 0000000..9315db9 --- /dev/null +++ b/products/compil_scripts/Python-2.7.16.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +echo "##########################################################################" +echo "Python" $VERSION +echo "##########################################################################" + +rm -rf $BUILD_DIR +mkdir $BUILD_DIR +cd $BUILD_DIR + +if [ ${#VERSION} -lt 5 ]; then + echo "ERROR : VERSION argument of Python compilation script has not the expected x.y.z format" + exit 1 +fi +PYTHON_VERSION="${VERSION:0:3}" +PYTHON_VERSION_MAJ=${PYTHON_VERSION:0:1} + +# --enable-shared : enable building shared python library +# --with-threads : enable thread support +# --without-pymalloc: disable specialized mallocs +# --with-ensurepip : installation using bundled pip +# --enable-optimizations: recommandé et utilisé par Nijni -> mais trop long! +CONFIGURE_ARGUMENTS="--enable-shared --with-threads --with-ensurepip=install --with-ssl --enable-loadable-sqlite-extensions --enable-unicode=ucs4" +if [ "${SAT_ENABLE_PYTHON_PYMALLOC}" == "1" ]; then + CONFIGURE_ARGUMENTS+=" --with-pymalloc" +else + CONFIGURE_ARGUMENTS+=" --without-pymalloc" +fi + +echo +echo "*** configure --prefix=$PRODUCT_INSTALL $CONFIGURE_ARGUMENTS" +$SOURCE_DIR/configure --prefix=$PRODUCT_INSTALL $CONFIGURE_ARGUMENTS +if [ $? -ne 0 ]; then + echo "ERROR on configure" + exit 1 +fi + +echo +echo "*** make" $MAKE_OPTIONS +make $MAKE_OPTIONS +if [ $? -ne 0 ]; then + echo "ERROR on make" + exit 2 +fi + +echo +echo "*** make install" +make install +if [ $? -ne 0 ]; then + echo "ERROR on make install" + exit 3 +fi + +echo +echo "########## END" + diff --git a/products/compil_scripts/scipy-0.18.1.sh b/products/compil_scripts/scipy-0.18.1.sh new file mode 100755 index 0000000..84f882d --- /dev/null +++ b/products/compil_scripts/scipy-0.18.1.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +echo "##########################################################################" +echo "scipy" $VERSION +echo "##########################################################################" + +LINUX_DISTRIBUTION="$DIST_NAME$DIST_VERSION" + +echo "*** check installation" +mkdir -p ${PRODUCT_INSTALL} +rm -rf $BUILD_DIR +mkdir -p $BUILD_DIR/cache/pip +cd $BUILD_DIR + +export PYTHONPATH=${PRODUCT_INSTALL}/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH +export PATH=${PRODUCT_INSTALL}/bin:$PATH + +WHEELS=('scipy-0.18.1-cp27-cp27m-manylinux1_x86_64.whl') +for WHEEL in "${WHEELS[@]}"; do + ${PYTHONBIN} -m pip install --cache-dir=$BUILD_DIR/cache/pip $SOURCE_DIR/$WHEEL --no-deps --target=$PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages + if [ $? -ne 0 ]; then + echo "ERROR: could not install $WHEEL" + exit 1 + fi +done + +echo +echo "########## END" diff --git a/products/scipy.pyconf b/products/scipy.pyconf index 07c0a0a..38378ac 100755 --- a/products/scipy.pyconf +++ b/products/scipy.pyconf @@ -72,7 +72,14 @@ version_1_3_0_win : version_0_18_1 : { compil_script : "scipy.sh" - depend : ['numpy','lapack'] + depend : ['numpy','lapack', 'setuptools'] +} + +version_0_18_1_x86_64 : +{ + archive_info : {archive_name : "scipy-0.18.1-x86_64.tar.gz"} + compil_script : "scipy-0.18.1.sh" + depend : ['numpy','lapack', 'setuptools'] } version_0_15_1 : -- 2.39.2