Skip to content

Commit

Permalink
include PySide in qt4agg backend check
Browse files Browse the repository at this point in the history
  • Loading branch information
jbmohler committed Aug 19, 2014
1 parent fb27b4c commit 0863d30
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 23 deletions.
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
setupext.BackendMacOSX(),
setupext.BackendQt5(),
setupext.BackendQt4(),
setupext.BackendPySide(),
setupext.BackendGtk3Agg(),
setupext.BackendGtk3Cairo(),
setupext.BackendGtkAgg(),
Expand Down
53 changes: 31 additions & 22 deletions setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -1958,7 +1958,18 @@ def check_requirements(self):
return msg


def backend_qt4_internal_check(self):
def backend_pyside_internal_check(self):
try:
from PySide import __version__
from PySide import QtCore
except ImportError:
raise CheckFailed("PySide not found")
else:
BackendAgg.force = True
return ("Qt: %s, PySide: %s" %
(QtCore.__version__, __version__))

def backend_pyqt4_internal_check(self):
try:
from PyQt4 import QtCore
except ImportError:
Expand All @@ -1973,6 +1984,25 @@ def backend_qt4_internal_check(self):
BackendAgg.force = True
return ("Qt: %s, PyQt: %s" % (self.convert_qt_version(qt_version), pyqt_version_str))

def backend_qt4_internal_check(self):
try:
result1 = backend_pyside_internal_check(self)
except CheckFailed:
result1 = None

try:
result2 = backend_pyqt4_internal_check(self)
except CheckFailed:
if result1 == None:
raise
result2 = None

if result1 == None:
return result2
if result2 == None:
return result1
return '{}; {}'.format(result1, result2)


class BackendQt4(BackendQtBase):
name = "qt4agg"
Expand Down Expand Up @@ -2006,27 +2036,6 @@ def __init__(self, *args, **kwargs):
self.callback = backend_qt5_internal_check


def backend_pyside_internal_check(self):
try:
from PySide import __version__
from PySide import QtCore
except ImportError:
raise CheckFailed("PySide not found")
else:
BackendAgg.force = True
return ("Qt: %s, PySide: %s" %
(QtCore.__version__, __version__))


class BackendPySide(BackendQtBase):
name = "pyside"

def __init__(self, *args, **kwargs):
BackendQtBase.__init__(self, *args, **kwargs)
self.callback = backend_pyside_internal_check



class BackendCairo(OptionalBackendPackage):
name = "cairo"

Expand Down

0 comments on commit 0863d30

Please sign in to comment.