Ticket #38303: IPython_external_qt.py.diff

File IPython_external_qt.py.diff, 1.6 KB (added by eborisch (Eric A. Borisch), 12 years ago)
  • IPython/external/qt.py

    old new  
    77"""
    88
    99import os
     10import distutils.version as DV
     11VER_LT = lambda a,b: DV.LooseVersion(a) < DV.LooseVersion(b)
    1012
    1113# Available APIs.
    1214QT_API_PYQT = 'pyqt'
     
    2527if QT_API is None:
    2628    try:
    2729        import PySide
    28         if PySide.__version__ < '1.0.3':
     30        if VER_LT(PySide.__version__, '1.0.3'):
    2931            # old PySide, fallback on PyQt
    3032            raise ImportError
    3133        from PySide import QtCore, QtGui, QtSvg
     
    3537            prepare_pyqt4()
    3638            import PyQt4
    3739            from PyQt4 import QtCore, QtGui, QtSvg
    38             if QtCore.PYQT_VERSION_STR < '4.7':
     40            if VER_LT(QtCore.PYQT_VERSION_STR, '4.7'):
    3941                # PyQt 4.6 has issues with null strings returning as None
    4042                raise ImportError
    4143            QT_API = QT_API_PYQT
     
    4951# Now peform the imports.
    5052if QT_API == QT_API_PYQT:
    5153    from PyQt4 import QtCore, QtGui, QtSvg
    52     if QtCore.PYQT_VERSION_STR < '4.7':
     54    if VER_LT(QtCore.PYQT_VERSION_STR, '4.7'):
    5355        raise ImportError("IPython requires PyQt4 >= 4.7, found %s"%QtCore.PYQT_VERSION_STR)
    5456
    5557    # Alias PyQt-specific functions for PySide compatibility.
     
    5860
    5961elif QT_API == QT_API_PYSIDE:
    6062    import PySide
    61     if PySide.__version__ < '1.0.3':
     63    if VER_LT(PySide.__version__, '1.0.3'):
    6264        raise ImportError("IPython requires PySide >= 1.0.3, found %s"%PySide.__version__)
    6365    from PySide import QtCore, QtGui, QtSvg
    6466