As a follow-up, I've implemented the patch for CXX and also patches for
the other files which do not include Python.h first here:
http://github.com/jasongrout/matplotlib/commit/a961c299f5d589dae87e06caf54975eb657ebf3b
I've also attached the patch.
This patch gets rid of the warnings about redefining things on OSX
10.6.4 (see my last message on this thread).
Thanks,
Jason
diff --git a/CXX/WrapPython.h b/CXX/WrapPython.h
index ef97cf1..f62d5b4 100644
--- a/CXX/WrapPython.h
+++ b/CXX/WrapPython.h
@@ -38,26 +38,12 @@
#ifndef __PyCXX_wrap_python_hxx__
#define __PyCXX_wrap_python_hxx__
+/* Python API mandates Python.h is included *first* */
+#include "Python.h"
+
// On some platforms we have to include time.h to get select defined
#if !defined(__WIN32__) && !defined(WIN32) && !defined(_WIN32) &&
!defined(_WIN64)
#include <sys/time.h>
#endif
-// Prevent multiple conflicting definitions of swab from stdlib.h and unistd.h
-#if defined(__sun) || defined(sun)
-#if defined(_XPG4)
-#undef _XPG4
-#endif
-#if defined(_XPG3)
-#undef _XPG3
-#endif
-#endif
-
-// Python.h will redefine these and generate warning in the process
-#undef _XOPEN_SOURCE
-#undef _POSIX_C_SOURCE
-
-// pull in python definitions
-#include <Python.h>
-
#endif
diff --git a/src/_backend_agg.cpp b/src/_backend_agg.cpp
index 1bf4d97..90f065b 100644
--- a/src/_backend_agg.cpp
+++ b/src/_backend_agg.cpp
@@ -1,11 +1,9 @@
/* A rewrite of _backend_agg using PyCXX to handle ref counting, etc..
*/
-#include <png.h>
-// To remove a gcc warning
-#ifdef _POSIX_C_SOURCE
-#undef _POSIX_C_SOURCE
-#endif
+/* Python API mandates Python.h is included *first* */
+#include "Python.h"
+#include <png.h>
#include "ft2font.h"
#include "_image.h"
diff --git a/src/_image.cpp b/src/_image.cpp
index b20373f..cd7650a 100644
--- a/src/_image.cpp
+++ b/src/_image.cpp
@@ -1,8 +1,4 @@
-// To remove a gcc warning
-#ifdef _POSIX_C_SOURCE
-#undef _POSIX_C_SOURCE
-#endif
-
+/* Python API mandates Python.h is included *first* */
#include "Python.h"
#include <string>
diff --git a/src/_png.cpp b/src/_png.cpp
index 0e71105..57c1862 100644
--- a/src/_png.cpp
+++ b/src/_png.cpp
@@ -1,9 +1,7 @@
-#include <png.h>
+/* Python API mandates Python.h is included *first* */
+#include "Python.h"
-// To remove a gcc warning
-#ifdef _POSIX_C_SOURCE
-#undef _POSIX_C_SOURCE
-#endif
+#include <png.h>
// TODO: Un CXX-ify this module
#include "CXX/Extensions.hxx"
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel