Skip to content

Commit 388f8fd

Browse files
committed
Merge pull request matplotlib#2325 from matthew-brett/deal-with-broken-qt4
BF: guard against broken PyQt import
1 parent cd51da8 commit 388f8fd

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

setupext.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,14 +1656,16 @@ def check(self):
16561656
from PyQt4 import pyqtconfig
16571657
except ImportError:
16581658
raise CheckFailed("PyQt4 not found")
1659-
else:
1660-
1661-
BackendAgg.force = True
1662-
1663-
return ("Qt: %s, PyQt4: %s" %
1664-
(self.convert_qt_version(
1665-
pyqtconfig.Configuration().qt_version),
1666-
pyqtconfig.Configuration().pyqt_version_str))
1659+
# Import may still be broken for our python
1660+
try:
1661+
qtconfig = pyqtconfig.Configuration()
1662+
except AttributeError:
1663+
raise CheckFailed('PyQt4 not correctly imported')
1664+
BackendAgg.force = True
1665+
return ("Qt: %s, PyQt4: %s" %
1666+
(self.convert_qt_version(
1667+
qtconfig.qt_version),
1668+
qtconfig.pyqt_version_str))
16671669

16681670

16691671
class BackendPySide(OptionalBackendPackage):

0 commit comments

Comments
 (0)