[Scipy-svn] r6646 - branches/0.8.x/scipy/sparse/sparsetools

scipy-svn at scipy.org scipy-svn at scipy.org
Fri Jul 30 13:33:38 EDT 2010


Author: rgommers
Date: 2010-07-30 12:33:38 -0500 (Fri, 30 Jul 2010)
New Revision: 6646

Modified:
   branches/0.8.x/scipy/sparse/sparsetools/SConscript
   branches/0.8.x/scipy/sparse/sparsetools/setup.py
Log:
BUG: Fix build under Python 2.7. Closes #1180. Thanks to Fabian Pedregosa.

(backport of r6645)
This patch defines a macro to access C99 extensions from C++.

This prevented scipy.sparse.sparsetools to compile correctly under
python2.7, because the wrappers are C++ files but ndarraytypes.h
references some C99 macros in inttypes.h.

Modified: branches/0.8.x/scipy/sparse/sparsetools/SConscript
===================================================================
--- branches/0.8.x/scipy/sparse/sparsetools/SConscript	2010-07-30 17:30:37 UTC (rev 6645)
+++ branches/0.8.x/scipy/sparse/sparsetools/SConscript	2010-07-30 17:33:38 UTC (rev 6646)
@@ -3,6 +3,7 @@
 from numscons import GetNumpyEnvironment
 
 env = GetNumpyEnvironment(ARGUMENTS)
+env.PrependUnique(CPPDEFINES = '__STDC_FORMAT_MACROS')
 
 for fmt in ['csr','csc','coo','bsr','dia']:
     sources = [ fmt + '_wrap.cxx' ]

Modified: branches/0.8.x/scipy/sparse/sparsetools/setup.py
===================================================================
--- branches/0.8.x/scipy/sparse/sparsetools/setup.py	2010-07-30 17:30:37 UTC (rev 6645)
+++ branches/0.8.x/scipy/sparse/sparsetools/setup.py	2010-07-30 17:33:38 UTC (rev 6646)
@@ -9,7 +9,9 @@
     for fmt in ['csr','csc','coo','bsr','dia']:
         sources = [ fmt + '_wrap.cxx' ]
         depends = [ fmt + '.h' ]
-        config.add_extension('_' + fmt, sources=sources, depends=depends)
+        config.add_extension('_' + fmt, sources=sources,
+            define_macros=[('__STDC_FORMAT_MACROS', 1)],
+            depends=depends)
 
     return config
 




More information about the Scipy-svn mailing list