]> SALOME platform Git repositories - tools/install.git/blob - config_files/HappyDoc-r2_1.sh
Salome HOME
Update for version 3.0.0
[tools/install.git] / config_files / HappyDoc-r2_1.sh
1 #!/bin/sh
2
3 check_version(){
4 check_lib_version happydoc $PATH
5 if [ "$?" -ne "0" ]; then
6    return 1
7 fi
8 ver=`happydoc | grep "HappyDoc version 2.1"`  
9 if [ -n "$ver" ]; then
10    #echo "The product ${PRODUCT} has been already installed on yours system"
11    return 0
12 fi
13 return 1
14 }
15
16 print_env(){
17 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
18 #$DELIM ${PRODUCT_TYPE} $DELIM
19 export PATH=\${INSTALL_ROOT}/${PRODUCT}/bin:\${PATH}
20 export PYTHONPATH=\${INSTALL_ROOT}/${PRODUCT}/lib/python\${PYTHON_VERSION}/site-packages:\${PYTHONPATH}
21 ##
22 EOF
23 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
24 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
25 }
26
27 # looks for the native product and collects it's environment (used by make_env())
28 try_native(){
29 happydoc="`find_in_path happydoc ${PATH}`"
30 if [ -n "${happydoc}" ] ; then
31     cat > ${INSTALL_WORK}/try_native.py <<EOF 
32 import sys
33 try :
34     import happydoclib
35     sys.exit(0)    
36 except ImportError, r :
37     sys.exit(1)
38 EOF
39     python ${INSTALL_WORK}/try_native.py
40     if [ $? -eq 0 ] ; then
41         tmp="${happydoc} ${happydoc} \${PATH} ${PATH}";  
42         path=`sort_path ${tmp}`
43         pythonpath="`find_in_path happydocset ${PYTHONPATH}`"
44         tmp="${pythonpath} ${pythonpath} \${PYTHONPATH} ${PYTHONPATH}";  
45         pythonpath=`sort_path ${tmp}`
46         cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
47 #$DELIM ${PRODUCT_TYPE} $DELIM
48 export PATH=${path}
49 export PYTHONPATH=${pythonpath}
50 ##
51 EOF
52         make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
53         rm -f ${INSTALL_WORK}/try_native.py
54         return 0
55     fi
56 fi
57 rm -f ${INSTALL_WORK}/try_native.py
58 return 1
59 }
60
61 try_preinstalled(){
62 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
63 return $?
64 }
65
66 install_source()
67 {
68 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
69 source ${INSTALL_WORK}/$SHRC
70
71 check_jb tar xfz ${SOURCE_DIR}/HappyDoc_r2_1.tar.gz -C ${INSTALL_WORK}
72
73 cd ${PRODUCT_WORK}
74 makedir ${PRODUCT_DIR}
75 check_job ${PRODUCT_DIR}/INSTALL.LOG python setup.py install --prefix=${PRODUCT_DIR}
76 #file_pth=${PRODUCT_DIR}/lib/python\${PYTHON_VERSION}/site-packages/happydoclib.pth
77 #if [ ! -f ${file_pth} ] ; then
78 #    touch ${file_pth}
79 #    cat > ${file_pth} <<EOF 
80 #happydoclib
81 #EOF
82 #fi
83
84 #du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
85 rm -fr ${PRODUCT_WORK}
86 print_env
87 }
88
89 install_binary()
90 {
91 check_jb tar xfz ${SOURCE_DIR}/HappyDoc-r2_1.tar.gz -C ${INSTALL_ROOT}
92
93 print_env
94 }
95
96 export PROCEDURE=$1;
97 export INSTALL_WORK=$2;
98 export SOURCE_DIR=$3;
99 export INSTALL_ROOT=$4;
100 export PRODUCT_SEQUENCE=$5;
101 if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="happydoc" ; fi
102 export PRODUCT="HappyDoc-r2_1"
103 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
104 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
105 source ./common.sh
106 $PROCEDURE