#!/bin/sh
check_version(){
-if [ -d "${PYTHONHOME}/lib/python2.2/site-packages/Numeric" ]; then
- check_lib_version _numpy.so ${PYTHONHOME}/lib/python2.2/site-packages/Numeric
- if [ "$?" -eq "0" ]; then
- #echo "The product ${PRODUCT} has been already installed on yours system"
- return 0
- fi
+ver=`python -c 'import Numeric; print Numeric.__version__' 2>/dev/null`
+if [ "$ver" == "22.0" ]; then
+ return 0
fi
return 1
}
print_env(){
cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
#$DELIM ${PRODUCT_TYPE} $DELIM
-export PYTHONPATH=\${INSTALL_ROOT}/${PRODUCT}/lib/python2.2/site-packages/Numeric:\${PYTHONPATH}
+export PYTHONPATH=\${INSTALL_ROOT}/${PRODUCT}/lib/python\${PYTHON_VERSION}/site-packages/Numeric:\${PYTHONPATH}
##
EOF
(test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
# looks for the native product and collects it's environment (used by make_env())
try_native(){
-cat > ${INSTALL_WORK}/try_native.py <<EOF
-import sys
-try :
- import Numeric
- sys.exit(0)
-except ImportError, r :
- sys.exit(1)
-EOF
-python ${INSTALL_WORK}/try_native.py
+check_version
if [ $? -eq 0 ] ; then
- pythonpath="`find_in_path _numpy.so ${PYTHONPATH}`"
+ pythonpath="`find_in_path Numeric.py ${PYTHONPATH}`"
tmp="${pythonpath} ${pythonpath} \${PYTHONPATH} ${PYTHONPATH}";
pythonpath=`sort_path ${tmp}`
cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
##
EOF
make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
- rm -f ${INSTALL_WORK}/try_native.py
return 0
fi
-rm -f ${INSTALL_WORK}/try_native.py
return 1
}