From d4b469ec2ede78ffb0d2506752ad317d26d27b54 Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 24 May 2006 08:58:49 +0000 Subject: [PATCH] Modify pyqtconfig.py script after installation from binaries --- config_files/PyQt-3.13.sh | 80 +++++++++++++++++++++++++++------------ 1 file changed, 55 insertions(+), 25 deletions(-) diff --git a/config_files/PyQt-3.13.sh b/config_files/PyQt-3.13.sh index 3d87870..8dae88d 100755 --- a/config_files/PyQt-3.13.sh +++ b/config_files/PyQt-3.13.sh @@ -2,10 +2,16 @@ check_version() { -if [ -n "${PYQTDIR}" ]; then - check_lib_version qt.so $PYQTDIR - if [ "$?" -eq "0" ]; then - return 0 +if [ -n "${PYQTDIR}" ] && [ -f ${PYQTDIR}/pyqtconfig.py ] ; then + ver=`cd ${PYQTDIR} && python -c "from pyqtconfig import Configuration; c=Configuration();print c.__getattr__('pyqt_version_str')" 2>/dev/null` + if [ -n "$ver" ] ; then + maj_ver=`echo $ver | awk -F. '{if(NF>0) print $1; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'` + min_ver=`echo $ver | awk -F. '{if(NF>1) print $2; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'` + rel_ver=`echo $ver | awk -F. '{if(NF>2) print $3; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'` + let ver=$maj_ver*10000+$min_ver*100+$rel_ver + if [ $ver -eq 031300 ] ; then + return 0 + fi fi fi return 1 @@ -27,30 +33,36 @@ make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" } # looks for the native product and collects it's environment (used by make_env()) +# we need version 3.13 or newer try_native(){ -pyqtdir="`find_in_path pyuic ${PATH}`" -if [ -z "${pyqtdir}" ] ; then - pyqtdir="`find_in_path pyuic /usr/bin`" -fi -if [ -n "${pyqtdir}" ] ; then - pyqt_sips=${pyqtdir}/sip - if [ ! -d "${pyqt_sips}" ] ; then - pyqt_sips="/usr/share/sip/qt" - if [ ! -d "${pyqt_sips}" ] ; then - return 1 - fi - fi - python_version="`python -c 'import sys; print sys.version[:3]'`" - pythonpath="`find_in_path qt.so ${PYTHONPATH}`" - if [ -z "${pythonpath}" ] ; then - pythonpath="`find_in_path qt.so /usr/lib/python${python_version}/site-packages`" - fi - if [ -n "${pythonpath}" ] ; then +# check pyuic +pyqtdir="`find_in_path pyuic ${PATH}:/usr/bin`" +if [ -z "${pyqtdir}" ] ; then return 1 ; fi +# check sip files +pyqt_sips="`find_in_path qtmod.sip ${pyqtdir}/sip/qt:/usr/share/sip/qt:/usr/share/sip/qt/qt`" +if [ -z "${pyqt_sips}" ] ; then return 1 ; fi +pyqt_sips=`cd $pyqt_sips/.. ; pwd` +# check configuration file +python_version="`python -c 'import sys; print sys.version[:3]'`" +pyqt_cfg="`find_in_path pyqtconfig.py ${pyqtdir}:/usr/lib/python${python_version}/site-packages`" +if [ -z "${pyqt_cfg}" ] ; then return 1 ; fi +# check library +pyqt_lib="`find_in_path qt.so ${pyqtdir}:/usr/lib/python${python_version}/site-packages`" +if [ -z "${pyqt_lib}" ] ; then return 1 ; fi +# check version +ver=`cd ${pyqt_cfg} && python -c "from pyqtconfig import Configuration; c=Configuration();print c.__getattr__('pyqt_version_str')" 2>/dev/null` +if [ -n "$ver" ] ; then + maj_ver=`echo $ver | awk -F. '{if(NF>0) print $1; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'` + min_ver=`echo $ver | awk -F. '{if(NF>1) print $2; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'` + rel_ver=`echo $ver | awk -F. '{if(NF>2) print $3; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'` + let ver=$maj_ver*10000+$min_ver*100+$rel_ver + # version number should be at least 3.13 + if [ $ver -ge 031300 ] ; then tmp="${pyqtdir} ${pyqtdir} \${PATH} ${PATH}"; path=`sort_path ${tmp}` - tmp="${pythonpath} ${pythonpath} \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}"; + tmp="${pyqt_lib} ${pyqt_lib} \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}"; ld_library_path=`sort_path ${tmp}` - tmp="${pythonpath} ${pythonpath} \${PYTHONPATH} ${PYTHONPATH}"; + tmp="${pyqt_cfg} ${pyqt_cfg} \${PYTHONPATH} ${PYTHONPATH}"; pythonpath=`sort_path ${tmp}` cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh < pyqtconfig.py.1 +sed -e "s%\('pyqt_mod_dir':[[:space:]]*\).*%\1'${PRODUCT_DIR}',%g" pyqtconfig.py.1 > pyqtconfig.py +sed -e "s%\('pyqt_sip_dir':[[:space:]]*\).*%\1'${PRODUCT_DIR}/sip',%g" pyqtconfig.py > pyqtconfig.py.1 +mv pyqtconfig.py.1 pyqtconfig.py print_env } -- 2.39.2