summaryrefslogtreecommitdiff
path: root/community/python-scipy/0001-FIX-define-macro-to-access-C99-extensions-from-C.patch
blob: c58a943b5f83a29abb2eac253ac29e379d0a18ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From 8ed781828b1d8e1692105c0c0c130858d47a28ce Mon Sep 17 00:00:00 2001
From: Fabian Pedregosa <fabian.pedregosa@inria.fr>
Date: Sun, 25 Jul 2010 14:35:35 +0200
Subject: [PATCH] FIX: define 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.
---
 scipy/sparse/sparsetools/SConscript |    1 +
 scipy/sparse/sparsetools/setup.py   |    4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/scipy/sparse/sparsetools/SConscript b/scipy/sparse/sparsetools/SConscript
index 1aa5557..85d9e05 100644
--- a/scipy/sparse/sparsetools/SConscript
+++ b/scipy/sparse/sparsetools/SConscript
@@ -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' ]
diff --git a/scipy/sparse/sparsetools/setup.py b/scipy/sparse/sparsetools/setup.py
index f4027a7..c4c4636 100755
--- a/scipy/sparse/sparsetools/setup.py
+++ b/scipy/sparse/sparsetools/setup.py
@@ -9,7 +9,9 @@ def configuration(parent_package='',top_path=None):
     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
 
-- 
1.7.1.1