77"""
88
99import os
10- from IPython .utils .version import NumericalVersion as V
10+ from IPython .utils .version import check_version
1111# Available APIs.
1212QT_API_PYQT = 'pyqt'
1313QT_API_PYSIDE = 'pyside'
@@ -26,7 +26,7 @@ def prepare_pyqt4():
2626 pyside_found = False
2727 try :
2828 import PySide
29- if V (PySide .__version__ ) < V ( '1.0.3' ):
29+ if not check_version (PySide .__version__ , '1.0.3' ):
3030 # old PySide, fallback on PyQt
3131 raise ImportError
3232 # we can't import an incomplete pyside and pyqt4
@@ -49,7 +49,7 @@ def prepare_pyqt4():
4949 "present.\n This will likely crash, please install " \
5050 "PySide completely, remove PySide or PyQt4 or set " \
5151 "the QT_API environment variable to pyqt or pyside"
52- if V (QtCore .PYQT_VERSION_STR ) < V ( '4.7' ):
52+ if not check_version (QtCore .PYQT_VERSION_STR , '4.7' ):
5353 # PyQt 4.6 has issues with null strings returning as None
5454 raise ImportError
5555 QT_API = QT_API_PYQT
@@ -63,7 +63,7 @@ def prepare_pyqt4():
6363# Now peform the imports.
6464if QT_API == QT_API_PYQT :
6565 from PyQt4 import QtCore , QtGui , QtSvg
66- if V (QtCore .PYQT_VERSION_STR ) < V ( '4.7' ):
66+ if not check_version (QtCore .PYQT_VERSION_STR , '4.7' ):
6767 raise ImportError ("IPython requires PyQt4 >= 4.7, found %s" % QtCore .PYQT_VERSION_STR )
6868
6969 # Alias PyQt-specific functions for PySide compatibility.
@@ -72,7 +72,7 @@ def prepare_pyqt4():
7272
7373elif QT_API == QT_API_PYSIDE :
7474 import PySide
75- if V (PySide .__version__ ) < V ( '1.0.3' ):
75+ if not check_version (PySide .__version__ , '1.0.3' ):
7676 raise ImportError ("IPython requires PySide >= 1.0.3, found %s" % PySide .__version__ )
7777 from PySide import QtCore , QtGui , QtSvg
7878
0 commit comments