Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7d40606

Browse files
committed
Merge pull request #2325 from matthew-brett/deal-with-broken-qt4
BF: guard against broken PyQt import
2 parents 8eb36dc + 0ba0668 commit 7d40606

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
@@ -1657,14 +1657,16 @@ def check(self):
16571657
from PyQt4 import pyqtconfig
16581658
except ImportError:
16591659
raise CheckFailed("PyQt4 not found")
1660-
else:
1661-
1662-
BackendAgg.force = True
1663-
1664-
return ("Qt: %s, PyQt4: %s" %
1665-
(self.convert_qt_version(
1666-
pyqtconfig.Configuration().qt_version),
1667-
pyqtconfig.Configuration().pyqt_version_str))
1660+
# Import may still be broken for our python
1661+
try:
1662+
qtconfig = pyqtconfig.Configuration()
1663+
except AttributeError:
1664+
raise CheckFailed('PyQt4 not correctly imported')
1665+
BackendAgg.force = True
1666+
return ("Qt: %s, PyQt4: %s" %
1667+
(self.convert_qt_version(
1668+
qtconfig.qt_version),
1669+
qtconfig.pyqt_version_str))
16681670

16691671

16701672
class BackendPySide(OptionalBackendPackage):

0 commit comments

Comments
 (0)