[4suite-checkins] In 4Suite/Ft/Lib/DistExt, files BuildExt.py

Jeremy Kloth jkloth at 4suite.org
Sat Nov 25 16:23:10 MST 2006


Modified Files:
    BuildExt.py

Log Message:
Enable Py_DEBUG flag when appropriate, if not defined by the configuration

ViewCVS diff:
  http://cvs.4suite.org/viewcvs/4Suite/Ft/Lib/DistExt/BuildExt.py.diff?r1=1.21&r2=1.22
ViewCVS view:
  http://cvs.4suite.org/viewcvs/4Suite/Ft/Lib/DistExt/BuildExt.py?rev=1.22&content-type=text/vnd.viewcvs-markup

Index: BuildExt.py
===================================================================
RCS file: /var/local/cvsroot/4Suite/Ft/Lib/DistExt/BuildExt.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -U2 -r1.21 -r1.22
--- BuildExt.py	25 Sep 2006 17:33:07 -0000	1.21
+++ BuildExt.py	25 Nov 2006 23:23:09 -0000	1.22
@@ -41,4 +41,19 @@
         build_ext.build_ext.finalize_options(self)
 
+        # Verify that extensions are built with the proper flags.
+        # For Windows, Py_DEBUG is enabled whenever debugging information
+        # is included. For other platforms, it must be explicited defined.
+        if sys.platform == 'win32':
+            py_debug = self.debug
+        else:
+            # 'getobjects()' is only available in debug builds.
+            py_debug = hasattr(sys, 'getobjects')
+        if py_debug and not Util.GetConfigVars('Py_DEBUG')[0]:
+            macros = [('Py_DEBUG', None)]
+            if not self.define:
+                self.define = macros
+            else:
+                self.define.extend(macros)
+
         # OpenBSD and NetBSD dlsyms have a leading underscore if the object
         # format is not ELF.  (from src/Python/dynload_shlib.c).


More information about the 4suite-checkins mailing list