[libixion] fix python bindings on i386

David Tardon dtardon at fedoraproject.org
Thu Mar 5 17:09:52 UTC 2015


commit b9a3f5521b7d70a4bde60d85577dc4cb374d5c4c
Author: David Tardon <dtardon at redhat.com>
Date:   Thu Mar 5 16:35:02 2015 +0100

    fix python bindings on i386

 0001-add-missing-includes-for-assert.patch   | 129 +++++++++++++++++++++++++++
 0001-fix-python-test-on-some-platforms.patch |  42 +++++++++
 libixion.spec                                |  13 ++-
 3 files changed, 180 insertions(+), 4 deletions(-)
---
diff --git a/0001-add-missing-includes-for-assert.patch b/0001-add-missing-includes-for-assert.patch
new file mode 100644
index 0000000..b5a74aa
--- /dev/null
+++ b/0001-add-missing-includes-for-assert.patch
@@ -0,0 +1,129 @@
+From 21e8f74df328006a24096f4587e8d668f75ac185 Mon Sep 17 00:00:00 2001
+From: David Tardon <dtardon at redhat.com>
+Date: Thu, 5 Mar 2015 17:47:30 +0100
+Subject: [PATCH] add missing includes for assert()
+
+---
+ src/libixion/cell.cpp                  | 1 +
+ src/libixion/cell_listener_tracker.cpp | 2 ++
+ src/libixion/cell_queue_manager.cpp    | 1 +
+ src/libixion/formula_functions.cpp     | 1 +
+ src/libixion/formula_interpreter.cpp   | 1 +
+ src/libixion/formula_lexer.cpp         | 1 +
+ src/libixion/formula_name_resolver.cpp | 1 +
+ src/libixion/formula_result.cpp        | 1 +
+ src/libixion/function_objects.cpp      | 1 +
+ 9 files changed, 10 insertions(+)
+
+diff --git a/src/libixion/cell.cpp b/src/libixion/cell.cpp
+index e6c9515..efbf1cb 100644
+--- a/src/libixion/cell.cpp
++++ b/src/libixion/cell.cpp
+@@ -18,6 +18,7 @@
+ #include <boost/scoped_ptr.hpp>
+ #include <boost/thread.hpp>
+ 
++#include <cassert>
+ #include <string>
+ #include <sstream>
+ #include <iostream>
+diff --git a/src/libixion/cell_listener_tracker.cpp b/src/libixion/cell_listener_tracker.cpp
+index 50ea5c0..c3ff10b 100644
+--- a/src/libixion/cell_listener_tracker.cpp
++++ b/src/libixion/cell_listener_tracker.cpp
+@@ -16,6 +16,8 @@
+ 
+ #define DEBUG_CELL_LISTENER_TRACKER 0
+ 
++#include <cassert>
++
+ #if DEBUG_CELL_LISTENER_TRACKER
+ #include <iostream>
+ #endif
+diff --git a/src/libixion/cell_queue_manager.cpp b/src/libixion/cell_queue_manager.cpp
+index a78c5d7..127e758 100644
+--- a/src/libixion/cell_queue_manager.cpp
++++ b/src/libixion/cell_queue_manager.cpp
+@@ -15,6 +15,7 @@
+ #include <boost/thread/shared_mutex.hpp>
+ #include <boost/thread/mutex.hpp>
+ 
++#include <cassert>
+ #include <iostream>
+ #include <queue>
+ #include <string>
+diff --git a/src/libixion/formula_functions.cpp b/src/libixion/formula_functions.cpp
+index f204353..96185ec 100644
+--- a/src/libixion/formula_functions.cpp
++++ b/src/libixion/formula_functions.cpp
+@@ -21,6 +21,7 @@
+ 
+ #define DEBUG_FORMULA_FUNCTIONS 0
+ 
++#include <cassert>
+ #include <iostream>
+ #include <sstream>
+ 
+diff --git a/src/libixion/formula_interpreter.cpp b/src/libixion/formula_interpreter.cpp
+index 80181e4..f545155 100644
+--- a/src/libixion/formula_interpreter.cpp
++++ b/src/libixion/formula_interpreter.cpp
+@@ -15,6 +15,7 @@
+ #include "ixion/interface/session_handler.hpp"
+ #include "ixion/interface/table_handler.hpp"
+ 
++#include <cassert>
+ #include <string>
+ #include <iostream>
+ #include <sstream>
+diff --git a/src/libixion/formula_lexer.cpp b/src/libixion/formula_lexer.cpp
+index 59b3f4a..021675d 100644
+--- a/src/libixion/formula_lexer.cpp
++++ b/src/libixion/formula_lexer.cpp
+@@ -8,6 +8,7 @@
+ #include "ixion/formula_lexer.hpp"
+ #include "ixion/global.hpp"
+ 
++#include <cassert>
+ #include <iostream>
+ #include <sstream>
+ 
+diff --git a/src/libixion/formula_name_resolver.cpp b/src/libixion/formula_name_resolver.cpp
+index dfb3973..d2df612 100644
+--- a/src/libixion/formula_name_resolver.cpp
++++ b/src/libixion/formula_name_resolver.cpp
+@@ -12,6 +12,7 @@
+ 
+ #include "formula_functions.hpp"
+ 
++#include <cassert>
+ #include <iostream>
+ #include <sstream>
+ #include <vector>
+diff --git a/src/libixion/formula_result.cpp b/src/libixion/formula_result.cpp
+index c69ac82..e5a49fd 100644
+--- a/src/libixion/formula_result.cpp
++++ b/src/libixion/formula_result.cpp
+@@ -10,6 +10,7 @@
+ #include "ixion/exceptions.hpp"
+ #include "ixion/interface/formula_model_access.hpp"
+ 
++#include <cassert>
+ #include <sstream>
+ 
+ #define DEBUG_FORMULA_RESULT 0
+diff --git a/src/libixion/function_objects.cpp b/src/libixion/function_objects.cpp
+index a26861d..bc60867 100644
+--- a/src/libixion/function_objects.cpp
++++ b/src/libixion/function_objects.cpp
+@@ -15,6 +15,7 @@
+ #include "ixion/interface/formula_model_access.hpp"
+ #include "ixion/formula_name_resolver.hpp"
+ 
++#include <cassert>
+ #include <vector>
+ #include <boost/scoped_ptr.hpp>
+ 
+-- 
+2.1.0
+
diff --git a/0001-fix-python-test-on-some-platforms.patch b/0001-fix-python-test-on-some-platforms.patch
new file mode 100644
index 0000000..33d9f30
--- /dev/null
+++ b/0001-fix-python-test-on-some-platforms.patch
@@ -0,0 +1,42 @@
+From 6acd183e4db7b8dc4c6336750f01b68de3fb4fb1 Mon Sep 17 00:00:00 2001
+From: David Tardon <dtardon at redhat.com>
+Date: Thu, 5 Mar 2015 16:26:37 +0100
+Subject: [PATCH] fix python test on some platforms
+
+Functions with METH_VARAGS flag (of type PyCFunction) do not take
+keywords. Attempt to use a 3rd argument would access some irrelevant
+data on the stack.
+---
+ src/python/document.cpp | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/python/document.cpp b/src/python/document.cpp
+index c734eb7..f6d6769 100644
+--- a/src/python/document.cpp
++++ b/src/python/document.cpp
+@@ -69,7 +69,7 @@ int document_init(document* self, PyObject* /*args*/, PyObject* /*kwargs*/)
+     return 0;
+ }
+ 
+-PyObject* document_append_sheet(document* self, PyObject* args, PyObject* kwargs)
++PyObject* document_append_sheet(document* self, PyObject* args)
+ {
+     char* sheet_name = NULL;
+     if (!PyArg_ParseTuple(args, "s", &sheet_name))
+@@ -84,11 +84,11 @@ PyObject* document_append_sheet(document* self, PyObject* args, PyObject* kwargs
+     if (!sheet_type)
+         return NULL;
+ 
+-    PyObject* obj_sheet = sheet_type->tp_new(sheet_type, args, kwargs);
++    PyObject* obj_sheet = sheet_type->tp_new(sheet_type, args, 0);
+     if (!obj_sheet)
+         return NULL;
+ 
+-    sheet_type->tp_init(obj_sheet, args, kwargs);
++    sheet_type->tp_init(obj_sheet, args, 0);
+ 
+     // Pass model_context to the sheet object.
+     sheet_data* sd = get_sheet_data(obj_sheet);
+-- 
+2.1.0
+
diff --git a/libixion.spec b/libixion.spec
index db46436..25f5d4f 100644
--- a/libixion.spec
+++ b/libixion.spec
@@ -2,7 +2,7 @@
 
 Name: libixion
 Version: 0.9.0
-Release: 1%{?dist}
+Release: 2%{?dist}
 Summary: A general purpose formula parser & interpreter library
 
 License: MPLv2.0
@@ -11,6 +11,8 @@ Source: http://kohei.us/files/ixion/src/%{name}-%{version}.tar.xz
 
 Patch0: 0001-fix-make-distcheck.patch
 Patch1: ixion-python-test.py
+Patch2: 0001-fix-python-test-on-some-platforms.patch
+Patch3: 0001-add-missing-includes-for-assert.patch
 
 BuildRequires: automake
 BuildRequires: boost-devel
@@ -68,12 +70,14 @@ Python 2 bindings for %{name}.
 %prep
 %setup -q
 %patch0 -p1
+%patch2 -p1
+%patch3 -p1
 cp %{PATCH1} test/
 
 %build
 aclocal
 automake
-%configure --disable-silent-rules --disable-static
+%configure --disable-silent-rules --disable-static CXXFLAGS=-DBOOST_DISABLE_ASSERTS
 sed -i \
     -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
     -e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \
@@ -96,9 +100,7 @@ install -m 0644 ixion-parser.1 ixion-sorter.1 %{buildroot}/%{_mandir}/man1
 
 %check
 export LD_LIBRARY_PATH=%{buildroot}%{_libdir}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
-%ifnarch %{?ix86}
 make %{?_smp_mflags} check
-%endif
 
 %files
 %doc AUTHORS COPYING README
@@ -120,6 +122,9 @@ make %{?_smp_mflags} check
 %{python_sitearch}/ixion.so
 
 %changelog
+* Thu Mar 05 2015 David Tardon <dtardon at redhat.com> - 0.9.0-2
+- fix python bindings on i386
+
 * Wed Feb 18 2015 David Tardon <dtardon at redhat.com> - 0.9.0-1
 - new upstream release
 


More information about the scm-commits mailing list