Salome HOME
merge from master
[tools/sat_salome.git] / products / compil_scripts / Python-3.7.sh
1 #!/bin/bash
2
3 echo "##########################################################################"
4 echo "Python" $VERSION
5 echo "##########################################################################"
6
7 PYTHON_VERSION=3.7
8
9 # --enable-shared   : enable building shared python library
10 # --with-threads    : enable thread support
11 # --without-pymalloc: disable specialized mallocs
12 # --with-ensurepip  : installation using bundled pip
13 # --enable-optimizations:  recommandé et utilisé par Nijni -> mais trop long!
14 CONFIGURE_ARGUMENTS="--enable-shared --with-threads --with-ensurepip=install --with-ssl --enable-loadable-sqlite-extensions --with-pymalloc"
15
16 echo
17 echo   "*** configure --prefix=$PRODUCT_INSTALL $CONFIGURE_ARGUMENTS"
18 $SOURCE_DIR/configure --prefix=$PRODUCT_INSTALL $CONFIGURE_ARGUMENTS
19 if [ $? -ne 0 ]
20 then
21     echo "ERROR on configure"
22     exit 1
23 fi
24
25 echo
26 echo "*** make" $MAKE_OPTIONS
27 make $MAKE_OPTIONS
28 if [ $? -ne 0 ]
29 then
30     echo "ERROR on make"
31     exit 2
32 fi
33
34 echo
35 echo "*** make install"
36 make install
37 if [ $? -ne 0 ]
38 then
39     echo "ERROR on make install"
40     exit 3
41 fi
42
43 cd ${PRODUCT_INSTALL}/lib/python${PYTHON_VERSION}/config-${PYTHON_VERSION}*
44
45 if [ ! -e libpython${PYTHON_VERSION}.so ]
46 then
47     echo
48     echo "*** create missing link"
49     ln -sf ../../libpython${PYTHON_VERSION}.so .
50     if [ $? -ne 0 ]
51     then
52         echo "ERROR when creating missing link"
53         # no error here
54     fi
55 fi
56 cd ${PRODUCT_INSTALL}/bin
57 ln -s python3 python
58 ln -s pip3 pip
59 #
60 if [ "${SAT_ENABLE_PYTHON_PYMALLOC}" == "1" ]; then
61     cd ${PRODUCT_INSTALL}/include
62     if [ ! -d python3.7 ]; then
63         ln -s python3.7m python3.7
64     fi
65 fi
66
67 # fix the path... 
68 L="2to3  2to3-3.7 easy_install-3.7 idle3 idle3.7 pip3 pip3.7 pydoc3 pydoc3.7 pyvenv pyvenv-3.7"
69 cd ${PRODUCT_INSTALL}/bin
70 for f in  $L; do
71     awk '$0 = NR==1 ? replace : $0' replace="#!/usr/bin/env python3" $f > $f.t && mv $f.t $f && chmod 755 $f
72 done
73
74 echo
75 echo "########## END"
76