Doug Bell wrote:
With both Qt2 and Qt3 installed, is there an easy
way to swap which
one PyQt references? I suppose that I could keep two compiled
versions of PyQt around and do make uninstall and make install.
Or
should I make a script to symlink the appropriate files? Or is
there
another method?
Any hints would be appreciated.
Doug.
___
PyKDE mailing list [EMAIL PROTECTED]
http://mats.gmd.de/mailman/listinfo/pykde
You can extend sys.path dependent on the QTDIR environment variable.
The attached sitecustomize.py gives the ideas.
Ulli.
Perform arbitrary additional site-specific customizations.
* This module is automatically imported during initialization. *
import sys, os
#
# Append the path where PyQt is installed to sys.path
# depending on the last part of the directory defined
# in the QTDIR environment variable
#
# e.g. if QTDIR points to /opt/qt-3.0.1 you should
# install (or move) PyQt into
#prefix/lib/python2.2/site-packages/qt-3.0.1
# or prefix\lib\site-packages\qt-3.0.1
# on windows
# and if QTDIR points to /opt/qt-2.3.1 you should
# install (or move) PyQt into
#prefix/lib/python2.2/site-packages/qt-2.3.1
# or prefix\lib\site-packages\qt-2.3.1
# on windows
#
# If QTDIR is not set, or is empty, or the resulting
# directory does not exist, nothing happens.
#
if os.environ.has_key('QTDIR'):
qtdir = os.path.basename(os.environ['QTDIR'])
if qtdir:
prefixes = [sys.prefix]
if sys.exec_prefix != sys.prefix:
prefixes.append(sys.exec_prefix)
for prefix in prefixes:
if prefix:
if os.sep == '/':
sitedirs = [os.path.join(prefix,
lib,
python + sys.version[:3],
site-packages,
qtdir),
os.path.join(prefix, lib, site-python, qtdir)]
else:
sitedirs = [os.path.join(prefix, qtdir),
os.path.join(prefix, lib, site-packages, qtdir)]
for sitedir in sitedirs:
if os.path.isdir(sitedir):
sys.path.append(sitedir)