##// END OF EJS Templates
Backport PR #2757: check for complete pyside presence before trying to import...
MinRK -
Show More
@@ -23,11 +23,20 b' def prepare_pyqt4():'
23 23 # Select Qt binding, using the QT_API environment variable if available.
24 24 QT_API = os.environ.get('QT_API')
25 25 if QT_API is None:
26 pyside_found = False
26 27 try:
27 28 import PySide
28 29 if PySide.__version__ < '1.0.3':
29 30 # old PySide, fallback on PyQt
30 31 raise ImportError
32 # we can't import an incomplete pyside and pyqt4
33 # this will cause a crash in sip (#1431)
34 # check for complete presence before importing
35 import imp
36 imp.find_module("QtCore", PySide.__path__)
37 imp.find_module("QtGui", PySide.__path__)
38 imp.find_module("QtSvg", PySide.__path__)
39 pyside_found = True
31 40 from PySide import QtCore, QtGui, QtSvg
32 41 QT_API = QT_API_PYSIDE
33 42 except ImportError:
@@ -35,6 +44,11 b' if QT_API is None:'
35 44 prepare_pyqt4()
36 45 import PyQt4
37 46 from PyQt4 import QtCore, QtGui, QtSvg
47 if pyside_found:
48 print "WARNING: PySide installation incomplete and PyQt4 " \
49 "present.\nThis will likely crash, please install " \
50 "PySide completely, remove PySide or PyQt4 or set " \
51 "the QT_API environment variable to pyqt or pyside"
38 52 if QtCore.PYQT_VERSION_STR < '4.7':
39 53 # PyQt 4.6 has issues with null strings returning as None
40 54 raise ImportError
General Comments 0
You need to be logged in to leave comments. Login now