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