Blob Blame History Raw
# HG changeset patch
# User Mads Kiilerich <mads@kiilerich.com>
# Date 1574009200 -3600
#      Sun Nov 17 17:46:40 2019 +0100
# Node ID e2122816b971cbc82e41de319427b51909fd9225
# Parent  09e3a0062b99427e9a933bdefd97f4c2e0b2ce6c
qt4: support PyQt4 v4.12.2 where sip became a sub module

https://www.riverbankcomputing.com/static/Docs/PyQt4/incompatibilities.html#pyqt-v4-12-2 :

In previous versions PyQt4 used the copy of the sip module usually installed in
the site-packages directory and applications accessed it using as follows:

  import sip

This version includes a private copy of the module. Applications should access
it as follows:

  from PyQt4 import sip

diff --git a/hgviewlib/qt4/__init__.py b/hgviewlib/qt4/__init__.py
--- a/hgviewlib/qt4/__init__.py
+++ b/hgviewlib/qt4/__init__.py
@@ -24,7 +24,12 @@ import os.path as osp
 import sys
 import datetime as dt
 
-import sip
+try:
+    from PyQt4 import sip
+    sip.SIP_VERSION_STR
+except ImportError:
+    import sip
+
 sip.setapi('QString', 2)
 sip.setapi('QVariant', 2)
 sip.setapi('QDate', 2)