]> SALOME platform Git repositories - tools/install.git/blob - config_files/PyQt-3.13.sh
Salome HOME
Update for Salome 3.2.6
[tools/install.git] / config_files / PyQt-3.13.sh
1 #!/bin/bash -noprofile
2
3 ####################################################################################
4 #  File      : PyQt-3.13.sh
5 #  Created   : Thu Dec 18 12:01:00 2002
6 #  Author    : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
7 #  Project   : SALOME
8 #  Module    : Installation Wizard
9 #  Copyright : 2002-2007 CEA
10 #
11 #  This script is the part of the SALOME installation procedure.
12 #
13 ####################################################################################
14
15 check_version()
16 {
17 if [ -n "${PYQTDIR}" ] && [ -f ${PYQTDIR}/pyqtconfig.py ] ; then
18     ver=`cd ${PYQTDIR} && python -c "from pyqtconfig import Configuration; c=Configuration();print c.__getattr__('pyqt_version_str')" 2>/dev/null`
19     if [ -n "$ver" ] ; then
20         maj_ver=`echo $ver | awk -F. '{if(NF>0) print $1; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
21         min_ver=`echo $ver | awk -F. '{if(NF>1) print $2; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
22         rel_ver=`echo $ver | awk -F. '{if(NF>2) print $3; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
23         let ver=$maj_ver*10000+$min_ver*100+$rel_ver
24         if [ $ver -eq 031300 ] ; then
25             return 0
26         fi
27     fi
28 fi
29 return 1
30 }
31
32 print_env()
33 {
34 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
35 #$DELIM ${PRODUCT_TYPE} $DELIM
36 export PYQTDIR=\${INSTALL_ROOT}/${PRODUCT}
37 export PYQT_SIPS=\${PYQTDIR}/sip
38 export PATH=\${PYQTDIR}:\$PATH 
39 export PYTHONPATH=\${PYQTDIR}:\${PYTHONPATH}
40 export LD_LIBRARY_PATH=\${PYQTDIR}:\$LD_LIBRARY_PATH 
41 ##
42 EOF
43 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
44 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
45 }
46
47 # looks for the native product and collects it's environment (used by make_env())
48 # we need version 3.13 or newer
49 try_native(){
50 # check pyuic
51 pyqtdir="`find_in_path pyuic ${PATH}:/usr/bin`"
52 if [ -z "${pyqtdir}" ] ; then return 1 ; fi
53 # check sip files
54 pyqt_sips="`find_in_path qtmod.sip ${pyqtdir}/sip/qt:/usr/share/sip/qt:/usr/share/sip/qt/qt`"
55 if [ -z "${pyqt_sips}" ] ; then return 1 ; fi
56 pyqt_sips=`cd $pyqt_sips/.. ; pwd`
57 # check configuration file
58 python_version="`python -c 'import sys; print sys.version[:3]'`"
59 pyqt_cfg="`find_in_path pyqtconfig.py ${pyqtdir}:/usr/lib/python${python_version}/site-packages`"
60 if [ -z "${pyqt_cfg}" ] ; then return 1 ; fi
61 # check library
62 pyqt_lib="`find_in_path qt.so ${pyqtdir}:/usr/lib/python${python_version}/site-packages`"
63 if [ -z "${pyqt_lib}" ] ; then return 1 ; fi
64 # check version
65 ver=`cd ${pyqt_cfg} && python -c "from pyqtconfig import Configuration; c=Configuration();print c.__getattr__('pyqt_version_str')" 2>/dev/null`
66 if [ -n "$ver" ] ; then
67     maj_ver=`echo $ver | awk -F. '{if(NF>0) print $1; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
68     min_ver=`echo $ver | awk -F. '{if(NF>1) print $2; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
69     rel_ver=`echo $ver | awk -F. '{if(NF>2) print $3; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
70     let ver=$maj_ver*10000+$min_ver*100+$rel_ver
71     # version number should be at least 3.13
72     if [ $ver -ge 031300 ] ; then
73         tmp="${pyqtdir} ${pyqtdir} \${PATH} ${PATH}";  
74         path=`sort_path ${tmp}`
75         tmp="${pyqt_lib} ${pyqt_lib} \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
76         ld_library_path=`sort_path ${tmp}`
77         tmp="${pyqt_cfg} ${pyqt_cfg} \${PYTHONPATH} ${PYTHONPATH}";  
78         pythonpath=`sort_path ${tmp}`
79         cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
80 #$DELIM ${PRODUCT_TYPE} $DELIM
81 export PYQT_SIPS=${pyqt_sips}
82 export PATH=${path}
83 export PYTHONPATH=${pythonpath}
84 export LD_LIBRARY_PATH=${ld_library_path}
85 ##
86 EOF
87         make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
88         return 0
89     fi
90 fi
91 return 1;
92 }
93
94 try_preinstalled(){
95 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
96 return $?
97 }
98
99 install_source()
100 {
101 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
102 source ${INSTALL_WORK}/$SHRC
103
104 makedir ${PRODUCT_DIR}
105
106 check_jb tar xfz ${SOURCE_DIR}/PyQt-3.13.tar.gz -C ${INSTALL_WORK}
107 cd ${PRODUCT_WORK}
108
109 sed -e 's%check_license()$%#check_license()%g' configure.py > configure.py.new
110 mv -f configure.py.new configure.py
111
112 check_job ${PRODUCT_DIR}/CONFIGURE.LOG \
113     python configure.py -b ${PRODUCT_DIR} -d ${PRODUCT_DIR} -v ${PRODUCT_DIR}/sip
114 GCC=`which gcc`
115 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
116 used gcc=$GCC
117 EOF
118 check_job ${PRODUCT_DIR}/MAKE.LOG make
119 check_job ${PRODUCT_DIR}/INSTALL.LOG make install
120
121 #du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
122 cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
123 print_env
124 }
125
126 install_binary()
127 {
128 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
129 source ${INSTALL_WORK}/$SHRC
130
131 check_jb tar xfz ${SOURCE_DIR}/PyQt-3.13.tar.gz -C ${INSTALL_ROOT}
132
133 # modify pyqtconfig.py file
134 cd ${PRODUCT_DIR}
135 sed -e "s%\('pyqt_bin_dir':[[:space:]]*\).*%\1'${PRODUCT_DIR}',%g"     pyqtconfig.py > pyqtconfig.py.1
136 sed -e "s%\('pyqt_mod_dir':[[:space:]]*\).*%\1'${PRODUCT_DIR}',%g"     pyqtconfig.py.1 > pyqtconfig.py
137 sed -e "s%\('pyqt_sip_dir':[[:space:]]*\).*%\1'${PRODUCT_DIR}/sip',%g" pyqtconfig.py > pyqtconfig.py.1
138 mv pyqtconfig.py.1 pyqtconfig.py
139
140 print_env
141 }
142
143 export PROCEDURE=$1;
144 export INSTALL_WORK=$2;
145 export SOURCE_DIR=$3;
146 export INSTALL_ROOT=$4;
147 export PRODUCT_SEQUENCE=$5;
148 if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="pyqt" ; fi
149 export PRODUCT="PyQt-3.13"
150 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
151 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
152 source ./common.sh
153 $PROCEDURE