5 if [ -z "$PYTHONHOME" ]; then
8 isPython=`which python 2>/dev/null`
9 if [ -n isPython ]; then
10 # version number is calculated as: <major>*10000+<minor>*100+<release>
11 # e.g. for Python 2.3.4 it is equal to 20304
13 ver=`echo $ver | awk '{print $2}' | awk -F. '{v1=0;v2=0;v3=0;if(NF>0)v1=$1;if(NF>1)v2=$2;if(NF>2)v3=$3;print v1*10000+v2*100+v3}'`
14 if [ $ver -eq 20304 ] ; then
23 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
24 #$DELIM ${PRODUCT_TYPE} $DELIM
25 export PYTHONHOME=\${INSTALL_ROOT}/${PRODUCT}
26 export PATH=\${PYTHONHOME}/bin:\${PATH}
27 export PYTHON_VERSION=\`python -c "import sys; print sys.version[:3]"\`
28 export PYTHON_INCLUDE=\${PYTHONHOME}/include/python\${PYTHON_VERSION}
29 export PYTHONPATH=\${PYTHONHOME}/lib/python\${PYTHON_VERSION}:\${PYTHONPATH}
32 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
33 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
36 # looks for the native product and collects it's environment (used by make_env())
38 pythonhome="`find_in_path python ${PATH}`"
39 if [ -z "${pythonhome}" ] ; then
40 pythonhome="`find_in_path python /usr/bin`"
42 if [ -n "${pythonhome}" ] ; then
43 pythonhome=`cd ${pythonhome}/..; pwd`
44 # get version number: <major>, <minor> and <release>
45 # <major> and <minor> numbers are checked strickly, but <release> number can be larger than required one
46 # version number is calculated as: <major>*10000+<minor>*100+<release>
47 # e.g. for Python 2.3.4 it is equal to 20304
49 maj_ver=`echo $ver | awk '{print $2}' | awk -F. '{if(NF>0) print $1; else print 0}'`
50 min_ver=`echo $ver | awk '{print $2}' | awk -F. '{if(NF>1) print $2; else print 0}'`
51 rel_ver=`echo $ver | awk '{print $2}' | awk -F. '{if(NF>2) print $3; else print 0}'`
52 let ver=$maj_ver*10000+$min_ver*100+$rel_ver
53 if [ $ver -ge 20304 ] ; then
54 tmp="\${PYTHONHOME}/bin ${pythonhome}/bin \${PATH} ${PATH}";
55 path=`sort_path ${tmp}`
56 tmp="\${PYTHONHOME}/lib/python\${PYTHON_VERSION} ${pythonhome}/lib/python${maj_ver}.${min_ver} \${PYTHONPATH} ${PYTHONPATH}";
57 pythonpath=`sort_path ${tmp}`
58 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
59 #$DELIM ${PRODUCT_TYPE} $DELIM
60 export PYTHONHOME=${pythonhome}
62 export PYTHON_VERSION=\`python -c "import sys; print sys.version[:3]"\`
63 export PYTHON_INCLUDE=\${PYTHONHOME}/include/python\${PYTHON_VERSION}
64 export PYTHONPATH=${pythonpath}
67 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
68 ####### THIS COULD BE USED FOR STRICT COMPARISON ##############################
69 # if [ $maj_ver -eq 2 ] && [ $min_ver -eq 3 ] && [ $rel_ver -eq 4 ] ; then
70 ######################################################################################
71 if [ $maj_ver -eq 2 ] && [ $min_ver -eq 3 ] && [ $rel_ver -ge 4 ] ; then
82 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
88 echo "The installation of Python 2.3.4 from sources is not provided! Use native Python."
94 echo "The installation of Python 2.3.4 from binaries is not provided! Use native gcc."
99 export INSTALL_WORK=$2;
100 export SOURCE_DIR=$3;
101 export INSTALL_ROOT=$4;
102 export PRODUCT_SEQUENCE=$5;
103 if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="python" ; fi
104 export PRODUCT="Python-2.3.4"
105 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
106 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}