bh: thuban setup.py,1.49,1.50 ChangeLog,1.798,1.799

cvs@intevation.de cvs at intevation.de
Tue Apr 5 19:27:00 CEST 2005


Author: bh

Update of /thubanrepository/thuban
In directory doto:/tmp/cvs-serv24411

Modified Files:
	setup.py ChangeLog 
Log Message:
Use wxPython.h by default but provide a workaround when it isn't
available.

* setup.py (wxproj_extension): New variable.  Assign the Extension
instance for Lib.wxproj to this variable instead of putting it
directly into the listso that it can be accessed by other code
later.
(thuban_build_ext.user_options): Added boolean option
--use-wx-python-swig-hack.
(thuban_build_ext.initialize_options): Initialize the new option
to False.
(thuban_build_ext.finalize_options): If the new option was given,
define the preprocesser macro USE_WX_PYTHON_SWIG_HACK.
(thuban_build_ext): Update the doc-string

* libraries/thuban/wxproj.cpp: Normally we use
wx/wxPython/wxPython.h now.  Only if USE_WX_PYTHON_SWIG_HACK is
defined, use swigPtrConvertHack.h instead.

* libraries/thuban/swigPtrConvertHack.h: Remove the code that was
copied over from wxPython.h.
(decode_pointer_new): New.  Equivalent of decode_pointer for
wxPython 2.5.
(wxPyConvertSwigPtr): Modified to cope with wxPython 2.5 as well.


Index: setup.py
===================================================================
RCS file: /thubanrepository/thuban/setup.py,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- setup.py	18 Feb 2005 14:56:42 -0000	1.49
+++ setup.py	5 Apr 2005 17:26:58 -0000	1.50
@@ -1,4 +1,4 @@
-# Copyright (c) 2001, 2002, 2003, 2004 by Intevation GmbH
+# Copyright (c) 2001, 2002, 2003, 2004, 2005 by Intevation GmbH
 # Authors:
 # Bernhard Herzog <bh at intevation.de>
 #
@@ -252,15 +252,16 @@
 # Thuban specific modules
 #
 
-extensions.append(Extension("Lib.wxproj",
-                            [ext_dir + "/thuban/wxproj.cpp"],
-                            include_dirs = ([shp_dir, proj4_incdir,
-                                             ext_dir + "/pyshapelib/"]
-                                            + wx_cs_params[CS_INCDIRS]),
-                            define_macros = wx_cs_params[CS_DEFS],
-                            library_dirs = [proj4_libdir] + 
-                                           wx_cs_params[CS_LIBDIRS],
-                            libraries = [proj4_lib] + wx_cs_params[CS_LIBS]))
+wxproj_extension = Extension("Lib.wxproj",
+                             [ext_dir + "/thuban/wxproj.cpp"],
+                             include_dirs = ([shp_dir, proj4_incdir,
+                                              ext_dir + "/pyshapelib/"]
+                                             + wx_cs_params[CS_INCDIRS]),
+                             define_macros = wx_cs_params[CS_DEFS],
+                             library_dirs = [proj4_libdir] + 
+                             wx_cs_params[CS_LIBDIRS],
+                             libraries = [proj4_lib] + wx_cs_params[CS_LIBS])
+extensions.append(wxproj_extension)
 
 
 #
@@ -1072,22 +1073,42 @@
 
 class thuban_build_ext(build_ext):
 
-    """Extend the build_ext command to optionally include the
-    GDAL extension.
+    """Extend the build_ext command with some Thuban specific options
+
+    --with-gdal, --without-gdal
+
+        Switch the optional GDAL support on/off.  Default is On.
+
+    --use-wx-python-swig-hack
+
+        For performance reasons, Thuban access wxPython objects at the
+        C++ level so that it can directly call wxWidgets code from C++.
+        The normal and preferred way to do that is to use the API
+        defined in wxPython.h.  Unfortunately, this header file is not
+        distributed with binary packages of wxPython on some platforms.
+        By using the --use-wx-python-swig-hack option you can activate a
+        way to access the C++ objects without wxPython.h.  This relies
+        on internals of SWIG, so it might change with future wxPython
+        versions.  Therefore, only use this option if the normal way
+        doesn't work for you.
     """
 
     user_options = build_ext.user_options[:]
     user_options.extend([("with-gdal", None, "Include GDAL support."),
-                         ("without-gdal", None, "Don't include GDAL support.")])
+                         ("without-gdal", None, "Don't include GDAL support."),
+                         ("use-wx-python-swig-hack", None,
+                 "Use a hack to access wxPython objects at the C++ level"
+                 "(use only when you absolutely can't use wxPython.h)")])
 
-    boolean_options = ["with-gdal"]
+    boolean_options = ["with-gdal", "use-wx-python-swig-hack"]
     negative_opt = {'without-gdal' : 'with-gdal'}
 
     def initialize_options(self):
         self.with_gdal = True
+        self.use_wx_python_swig_hack = False
         build_ext.initialize_options(self)
 
-    def finalize_options(self): 
+    def finalize_options(self):
         build_ext.finalize_options(self)
         if self.with_gdal and include_gdal:
             self.extensions.append(Extension("Lib.gdalwarp",
@@ -1097,6 +1118,9 @@
                                 define_macros = gdal_cs_params[CS_DEFS],
                                 library_dirs = gdal_cs_params[CS_LIBDIRS],
                                 libraries = gdal_cs_params[CS_LIBS]))
+        if self.use_wx_python_swig_hack:
+            wxproj_extension.define_macros.append(("USE_WX_PYTHON_SWIG_HACK",
+                                                   None))
 
     def run(self, install_options = None):
         build_ext.run(self)

Index: ChangeLog
===================================================================
RCS file: /thubanrepository/thuban/ChangeLog,v
retrieving revision 1.798
retrieving revision 1.799
diff -u -d -r1.798 -r1.799
--- ChangeLog	29 Mar 2005 18:36:53 -0000	1.798
+++ ChangeLog	5 Apr 2005 17:26:58 -0000	1.799
@@ -1,3 +1,33 @@
+2005-04-05  Bernhard Herzog  <bh at intevation.de>
+
+	Use wxPython.h by default but provide a workaround when it isn't
+	available.
+
+	* setup.py (wxproj_extension): New variable.  Assign the Extension
+	instance for Lib.wxproj to this variable instead of putting it
+	directly into the listso that it can be accessed by other code
+	later.
+	(thuban_build_ext.user_options): Added boolean option
+	--use-wx-python-swig-hack.
+	(thuban_build_ext.initialize_options): Initialize the new option
+	to False.
+	(thuban_build_ext.finalize_options): If the new option was given,
+	define the preprocesser macro USE_WX_PYTHON_SWIG_HACK.
+	(thuban_build_ext): Update the doc-string
+
+	* libraries/thuban/wxproj.cpp: Normally we use
+	wx/wxPython/wxPython.h now.  Only if USE_WX_PYTHON_SWIG_HACK is
+	defined, use swigPtrConvertHack.h instead.
+
+	* libraries/thuban/swigPtrConvertHack.h: Remove the code that was
+	copied over from wxPython.h.
+	(decode_pointer_new): New.  Equivalent of decode_pointer for
+	wxPython 2.5.
+	(wxPyConvertSwigPtr): Modified to cope with wxPython 2.5 as well.
+
+	* README: Add section on potential build problems which explains
+	how the work-around for a missing wxPython.h is activated.
+
 2005-03-29  Bernhard Herzog  <bh at intevation.de>
 
 	* test/postgissupport.py (find_postgis_sql): Added yet another





More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)