Blob Blame History Raw
From 56c264844d6336f8b173525554d302f05c66a463 Mon Sep 17 00:00:00 2001
From: Scott Talbert <swt@techie.net>
Date: Mon, 7 Jan 2019 21:10:25 -0500
Subject: [PATCH] Unbundle sip

---
 buildtools/config.py         |  1 -
 etg/dataview.py              |  4 ++--
 etg/grid.py                  |  4 ++--
 etg/sizer.py                 |  4 ++--
 etg/window.py                |  4 ++--
 unittests/test_dc.py         | 10 +++++-----
 wscript                      | 27 +--------------------------
 wx/lib/gizmos/dynamicsash.py |  6 +++---
 8 files changed, 17 insertions(+), 43 deletions(-)

diff --git a/buildtools/config.py b/buildtools/config.py
index 8b872343..11194053 100644
--- a/buildtools/config.py
+++ b/buildtools/config.py
@@ -121,7 +121,6 @@ class Configuration(object):
                          '-w',    # enable warnings
                          '-o',    # turn on auto-docstrings
                          '-g',    # turn on acquire/release of GIL for everything
-                         '-n', 'wx.siplib', # name of the module containing the siplib
                          #'-e',    # turn on exceptions support
                          #'-T',    # turn off writing the timestamp to the generated files
                          #'-r',    # turn on function call tracing
diff --git a/etg/dataview.py b/etg/dataview.py
index 37e40e6b..6a1de4d1 100644
--- a/etg/dataview.py
+++ b/etg/dataview.py
@@ -372,8 +372,8 @@ def run():
             is reference counted so it can be shared with other views.
             """,
         body="""\
-            import wx.siplib
-            wasPyOwned = wx.siplib.ispyowned(model)
+            import sip
+            wasPyOwned = sip.ispyowned(model)
             self._AssociateModel(model)
             # Ownership of the python object has just been transferred to
             # C++, so DecRef the C++ instance associated with this python
diff --git a/etg/grid.py b/etg/grid.py
index e98f331c..dbe77f22 100644
--- a/etg/grid.py
+++ b/etg/grid.py
@@ -446,8 +446,8 @@ def run():
         body="""\
             val = self._SetTable(table, takeOwnership, selmode)
             if takeOwnership:
-                import wx.siplib
-                wx.siplib.transferto(table, self)
+                import sip
+                sip.transferto(table, self)
             return val
         """)
 
diff --git a/etg/sizer.py b/etg/sizer.py
index 2f6d7f4f..8d1a51e3 100644
--- a/etg/sizer.py
+++ b/etg/sizer.py
@@ -148,8 +148,8 @@ def run():
             "    if theSizer:\n"
             "        doSomething()",
         body="""\
-        import wx.siplib
-        return not wx.siplib.isdeleted(self)
+        import sip
+        return not sip.isdeleted(self)
         """)
 
     c.addPyMethod('__iter__', '(self)',
diff --git a/etg/window.py b/etg/window.py
index a6b85e5e..5c8260a2 100644
--- a/etg/window.py
+++ b/etg/window.py
@@ -178,8 +178,8 @@ def run():
             "    if theWindow:\n"
             "        doSomething()",
         body="""\
-        import wx.siplib
-        return not wx.siplib.isdeleted(self)
+        import sip
+        return not sip.isdeleted(self)
         """)
     c.addPyCode('Window.__bool__ = Window.__nonzero__') # For Python 3
 
diff --git a/unittests/test_dc.py b/unittests/test_dc.py
index 525d9694..f70ccba6 100644
--- a/unittests/test_dc.py
+++ b/unittests/test_dc.py
@@ -176,17 +176,17 @@ class dc_Tests(wtc.WidgetTestCase):
 
 
     def test_dcContextManager(self):
-        import wx.siplib
+        import sip
         with wx.ClientDC(self.frame) as dc:
             dc.DrawLine(0,0,100,100)
 
             # check ownership
-            assert wx.siplib.ispyowned(dc)
-            assert not wx.siplib.isdeleted(dc)
+            assert sip.ispyowned(dc)
+            assert not sip.isdeleted(dc)
 
         # check the DC's ownership has changed
-        assert not wx.siplib.ispyowned(dc)
-        assert wx.siplib.isdeleted(dc)
+        assert not sip.ispyowned(dc)
+        assert sip.isdeleted(dc)
 
 
 #---------------------------------------------------------------------------
diff --git a/wscript b/wscript
index a50904d1..4f4ae337 100644
--- a/wscript
+++ b/wscript
@@ -104,7 +104,7 @@ def configure(conf):
     conf.env.msvc_relwithdebug = conf.options.msvc_relwithdebug
 
     # Ensure that the headers in siplib and Phoenix's src dir can be found
-    conf.env.INCLUDES_WXPY = ['sip/siplib', 'wx/include', 'src']
+    conf.env.INCLUDES_WXPY = ['wx/include', 'src']
 
     if isWindows:
         # Windows/MSVC specific stuff
@@ -292,13 +292,6 @@ def configure(conf):
         conf.env.CFLAGS_WXPY.append('-UNDEBUG')
         conf.env.CXXFLAGS_WXPY.append('-UNDEBUG')
 
-        # set the name of our siplib module
-        conf.env.CFLAGS_WXPY.append('-DSIP_MODULE_NAME=wx.siplib')
-        conf.env.CXXFLAGS_WXPY.append('-DSIP_MODULE_NAME=wx.siplib')
-
-        conf.env.CFLAGS_WXPY.append('-DSIP_MODULE_BASENAME=siplib')
-        conf.env.CXXFLAGS_WXPY.append('-DSIP_MODULE_BASENAME=siplib')
-
         # Add basic debug info for all builds
         conf.env.CFLAGS_WXPY.append('-g')
         conf.env.CXXFLAGS_WXPY.append('-g')
@@ -547,24 +540,6 @@ def build(bld):
 
 
     # Create the build tasks for each of our extension modules.
-    addRelwithdebugFlags(bld, 'siplib')
-    siplib = bld(
-        features = 'c cxx cshlib cxxshlib pyext',
-        target   = makeTargetName(bld, 'siplib'),
-        source   = ['sip/siplib/apiversions.c',
-                    'sip/siplib/array.c',
-                    'sip/siplib/bool.cpp',
-                    'sip/siplib/descriptors.c',
-                    'sip/siplib/int_convertors.c',
-                    'sip/siplib/objmap.c',
-                    'sip/siplib/qtlib.c',
-                    'sip/siplib/siplib.c',
-                    'sip/siplib/threads.c',
-                    'sip/siplib/voidptr.c',
-                    ],
-        uselib   = 'siplib WX WXPY',
-    )
-    makeExtCopyRule(bld, 'siplib')
 
     # Add build rules for each of our ETG generated extension modules
     makeETGRule(bld, 'etg/_core.py',       '_core',      'WX')
diff --git a/wx/lib/gizmos/dynamicsash.py b/wx/lib/gizmos/dynamicsash.py
index 2fed6597..18facc4a 100644
--- a/wx/lib/gizmos/dynamicsash.py
+++ b/wx/lib/gizmos/dynamicsash.py
@@ -16,7 +16,7 @@ reunified through the user interface.
 """
 
 import wx
-import wx.siplib
+import sip
 
 #----------------------------------------------------------------------------
 # Styles
@@ -942,7 +942,7 @@ class _DynamicSashWindowLeaf(wx.EvtHandler):
         # we'll just save the object's address instead, and then use that to
         # fetch the real proxy object when it's needed later.
         self.m_child = None
-        self.m_child_ptr = wx.siplib.unwrapinstance(window)
+        self.m_child_ptr = sip.unwrapinstance(window)
 
         # Delay the reparenting until after the AddChild has finished.
         event = _DynamicSashReparentEvent(self)
@@ -951,7 +951,7 @@ class _DynamicSashWindowLeaf(wx.EvtHandler):
 
     def _checkPendingChild(self):
         if hasattr(self, 'm_child_ptr'):
-            self.m_child = wx.siplib.wrapinstance(self.m_child_ptr, wx.Object)
+            self.m_child = sip.wrapinstance(self.m_child_ptr, wx.Object)
             del self.m_child_ptr
 
 
-- 
2.20.1