~ubuntu-branches/ubuntu/raring/ipython/raring

« back to all changes in this revision

Viewing changes to IPython/external/qt.py

  • Committer: Package Import Robot
  • Author(s): Julian Taylor
  • Date: 2013-02-02 11:14:27 UTC
  • mfrom: (1.2.21) (6.2.3 experimental)
  • Revision ID: package-import@ubuntu.com-20130202111427-nxxl7g1ulix8g9lg
Tags: 0.13.2~rc2-1
* New upstream release candidate (LP: #1161818, #1162112)
* pass -a to xvfb-run
* drop DM-Upload-Allowed, not needed anymore
* don't link documentation of ipython-doc so ipython3 does not depend on
  ipython (Closes: #695554)
  Requires ipython-doc.preinst to not lose copyright on upgrade
* add ipython3 and ipython3-qtconsole desktop files (Closes: #693612)
* fix detection of cython modules for multiarch python (Closes: #697704)
* don't install tests for notebook and qtconsole
* bump standard to 3.9.4, no changes required
* add autopkgtests running testsuite and testing tools, cython magics
  and incomplete install message
* fix crash on tracebacks without line numbers (Closes: #701597)
* add tkinter package to debianize-error-messages.patch (Closes: #701707)
* use canonical vcs fields in control

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
"""
8
8
 
9
9
import os
10
 
 
 
10
from IPython.utils.version import check_version
11
11
# Available APIs.
12
12
QT_API_PYQT = 'pyqt'
13
13
QT_API_PYSIDE = 'pyside'
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
 
        if PySide.__version__ < '1.0.3':
 
29
        if not check_version(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
44
            prepare_pyqt4()
36
45
            import PyQt4
37
46
            from PyQt4 import QtCore, QtGui, QtSvg
38
 
            if QtCore.PYQT_VERSION_STR < '4.7':
 
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"
 
52
            if not check_version(QtCore.PYQT_VERSION_STR, '4.7'):
39
53
                # PyQt 4.6 has issues with null strings returning as None
40
54
                raise ImportError
41
55
            QT_API = QT_API_PYQT
49
63
# Now peform the imports.
50
64
if QT_API == QT_API_PYQT:
51
65
    from PyQt4 import QtCore, QtGui, QtSvg
52
 
    if QtCore.PYQT_VERSION_STR < '4.7':
 
66
    if not check_version(QtCore.PYQT_VERSION_STR, '4.7'):
53
67
        raise ImportError("IPython requires PyQt4 >= 4.7, found %s"%QtCore.PYQT_VERSION_STR)
54
68
 
55
69
    # Alias PyQt-specific functions for PySide compatibility.
58
72
 
59
73
elif QT_API == QT_API_PYSIDE:
60
74
    import PySide
61
 
    if PySide.__version__ < '1.0.3':
 
75
    if not check_version(PySide.__version__, '1.0.3'):
62
76
        raise ImportError("IPython requires PySide >= 1.0.3, found %s"%PySide.__version__)
63
77
    from PySide import QtCore, QtGui, QtSvg
64
78