[libixion] new upstream release 0.9.0

David Tardon dtardon at fedoraproject.org
Wed Feb 18 08:54:11 UTC 2015


commit d138b1905cc5312a6d20d08383588235494c82a9
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Feb 18 09:16:32 2015 +0100

    new upstream release 0.9.0

 .gitignore                             |    1 +
 0001-fix-make-distcheck.patch          |   61 +++
 0001-multiple-build-system-fixes.patch |   25 -
 0001-update-boost.m4.patch             |  839 --------------------------------
 ixion-python-test.py                   |  222 +++++++++
 libixion.spec                          |   38 +-
 sources                                |    2 +-
 7 files changed, 311 insertions(+), 877 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index d76f0f1..ff8a587 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 /libixion-0.7.0.tar.bz2
+/libixion-0.9.0.tar.xz
diff --git a/0001-fix-make-distcheck.patch b/0001-fix-make-distcheck.patch
new file mode 100644
index 0000000..60759a1
--- /dev/null
+++ b/0001-fix-make-distcheck.patch
@@ -0,0 +1,61 @@
+From a32dad8961413056a10f61881843fa4a895c89c9 Mon Sep 17 00:00:00 2001
+From: David Tardon <dtardon at redhat.com>
+Date: Wed, 18 Feb 2015 08:42:02 +0100
+Subject: [PATCH] fix make distcheck
+
+---
+ src/Makefile.am           | 2 ++
+ src/libixion/Makefile.am  | 2 +-
+ src/python/Makefile.am    | 1 +
+ test/ixion-parser-test.sh | 3 +--
+ test/ixion-python-test.py | 4 ----
+ 5 files changed, 5 insertions(+), 7 deletions(-)
+
+diff --git a/src/Makefile.am b/src/Makefile.am
+index ca5b71e..6e138a4 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -24,4 +24,6 @@ ixion_sorter_SOURCES = \
+ ixion_sorter_LDADD = libixion/libixion- at IXION_API_VERSION@.la \
+ 					 $(BOOST_THREAD_LIBS) $(BOOST_PROGRAM_OPTIONS_LIBS)
+ 
++AM_TESTS_ENVIRONMENT = PATH=.libs$${PATH:+:$${PATH}}; epxort PATH; \
++	LD_LIBRARY_PATH=libixion/.libs$${LD_LIBRARY_PATH:+:$${LD_LIBRARY_PATH}}; export LD_LIBRARY_PATH;
+ TESTS = ../test/ixion-parser-test.sh
+diff --git a/src/libixion/Makefile.am b/src/libixion/Makefile.am
+index fafb401..4a3aa84 100644
+--- a/src/libixion/Makefile.am
++++ b/src/libixion/Makefile.am
+@@ -1,6 +1,6 @@
+ AM_CPPFLAGS = -I$(top_srcdir)/include -DIXION_BUILD $(MDDS_CFLAGS)
+ 
+-EXTRA_PROGRAMS = ixion-test
++check_PROGRAMS = ixion-test
+ 
+ lib_LTLIBRARIES = libixion- at IXION_API_VERSION@.la
+ libixion_ at IXION_API_VERSION@_la_SOURCES = \
+diff --git a/src/python/Makefile.am b/src/python/Makefile.am
+index 7804aac..c01a376 100644
+--- a/src/python/Makefile.am
++++ b/src/python/Makefile.am
+@@ -16,4 +16,5 @@ ixion_la_LIBADD = \
+ 	../libixion/libixion- at IXION_API_VERSION@.la \
+ 	$(PYTHON_LIBS)
+ 
++AM_TESTS_ENVIRONMENT = PYTHONPATH=.libs$${PYTHONPATH:+:$${PYTHONPATH}}; export PYTHONPATH;
+ TESTS = ../../test/ixion-python-test.py
+diff --git a/test/ixion-parser-test.sh b/test/ixion-parser-test.sh
+index 2e1aa22..73c6aca 100755
+--- a/test/ixion-parser-test.sh
++++ b/test/ixion-parser-test.sh
+@@ -1,6 +1,5 @@
+ #!/usr/bin/env bash
+ 
+ PROGDIR=`dirname $0`
+-PARSER=$PROGDIR/../bin/ixion-parser.sh
+-$PARSER $PROGDIR/*.txt
++ixion-parser $PROGDIR/*.txt
+ 
+-- 
+2.1.0
+
diff --git a/ixion-python-test.py b/ixion-python-test.py
new file mode 100755
index 0000000..9986435
--- /dev/null
+++ b/ixion-python-test.py
@@ -0,0 +1,222 @@
+#!/usr/bin/env python
+
+import unittest
+import itertools
+
+import ixion
+
+class Test(unittest.TestCase):
+
+    def setUp(self):
+        self.doc = ixion.Document()
+
+    def test_append_sheets(self):
+        tests = (
+            "Normal",      # normal name
+            "First Sheet", # white space
+            "Laura's",     # single quote
+            '"Quoted"'     # double quote
+        )
+
+        sheets = []
+        for test in tests:
+            sh = self.doc.append_sheet(test)
+            sheets.append(sh)
+
+        for test, sheet in itertools.izip(tests, sheets):
+            self.assertEqual(test, sheet.name)
+
+        self.assertEqual(tests, self.doc.get_sheet_names())
+
+        for i, test in enumerate(tests):
+            # get sheet by index.
+            sh = self.doc.get_sheet(i)
+            self.assertEqual(test, sh.name)
+
+        for test in tests:
+            # get sheet by name.
+            sh = self.doc.get_sheet(test)
+            self.assertEqual(test, sh.name)
+
+        try:
+            sheets[0].name = "Try to change sheet name"
+            self.assertTrue(False, "sheet name attribute should not be writable.")
+        except TypeError:
+            pass # TypeError is expected when attempting to overwrite sheet name attribute.
+        except:
+            self.assertTrue(False, "Wrong exception has been raised")
+
+        # Trying to insert a new sheet with an existing name should fail.
+        try:
+            sh = self.doc.append_sheet(tests[0])
+            self.assertTrue(False, "Trying to insert a new sheet with an existing sheet name should fail")
+        except ixion.DocumentError:
+            # This is expected.
+            pass
+
+    def test_numeric_cell_input(self):
+        sh1 = self.doc.append_sheet("Data")
+
+        # Empty cell should yield a value of 0.0.
+        check_val = sh1.get_numeric_value(0, 0)
+        self.assertEqual(0.0, check_val)
+
+        tests = (
+            # row, column, value
+            (3, 1, 11.2),
+            (4, 1, 12.0),
+            (6, 2, -12.0),
+            (6, 3, 0.0)
+        )
+
+        for test in tests:
+            sh1.set_numeric_cell(test[0], test[1], test[2]) # row, column, value
+            check_val = sh1.get_numeric_value(column=test[1], row=test[0]) # swap row and column
+            self.assertEqual(test[2], check_val)
+
+    def test_string_cell_input(self):
+        sh1 = self.doc.append_sheet("Data")
+
+        # Empty cell should yield an empty string.
+        check_val = sh1.get_string_value(0, 0)
+        self.assertEqual("", check_val)
+
+        tests = (
+            # row, column, value
+            (0, 0, "normal string"),  # normal string
+            (1, 0, "A1+B1"),          # string that looks like a formula expression
+            (2, 0, "'single quote'"), # single quote
+            (3, 0, "80's music"),     # single quote
+            (4, 0, '"The" Music in the 80\'s'), # single and double quotes mixed
+        )
+
+        for test in tests:
+            sh1.set_string_cell(test[0], test[1], test[2]) # row, column, value
+            check_val = sh1.get_string_value(column=test[1], row=test[0]) # swap row and column
+            self.assertEqual(test[2], check_val)
+
+    def test_formula_cell_input(self):
+        sh1 = self.doc.append_sheet("Data")
+        sh1.set_formula_cell(0, 0, "12*3")
+        try:
+            val = sh1.get_numeric_value(0, 0)
+            self.assertTrue(False, "TypeError should have been raised")
+        except TypeError:
+            # TypeError is expected when trying to fetch numeric value from
+            # formula cell before it is calculated.
+            pass
+
+        self.doc.calculate()
+        val = sh1.get_numeric_value(0, 0)
+        self.assertEqual(12*3, val)
+
+    def test_formula_cell_recalc(self):
+        sh1 = self.doc.append_sheet("Data")
+        sh1.set_numeric_cell(0, 0, 1.0)
+        sh1.set_numeric_cell(1, 0, 2.0)
+        sh1.set_numeric_cell(2, 0, 4.0)
+        sh1.set_formula_cell(3, 0, "SUM(A1:A3)")
+
+        # initial calculation
+        self.doc.calculate()
+        val = sh1.get_numeric_value(3, 0)
+        self.assertEqual(7.0, val)
+
+        # recalculation
+        sh1.set_numeric_cell(1, 0, 8.0)
+        self.doc.calculate()
+        val = sh1.get_numeric_value(3, 0)
+        self.assertEqual(13.0, val)
+
+        # add another formula cell and recalc.
+        sh1.set_formula_cell(0, 1, "A1+15")
+        sh1.set_numeric_cell(0, 0, 0.0)
+        self.doc.calculate()
+        val = sh1.get_numeric_value(0, 1)
+        self.assertEqual(15.0, val)
+        val = sh1.get_numeric_value(3, 0)
+        self.assertEqual(12.0, val)
+
+    def test_formula_cell_recalc2(self):
+        sh1 = self.doc.append_sheet("Data")
+        sh1.set_numeric_cell(4, 1, 12.0) # B5
+        sh1.set_formula_cell(5, 1, "B5*2")
+        sh1.set_formula_cell(6, 1, "B6+10")
+
+        self.doc.calculate()
+        val = sh1.get_numeric_value(4, 1)
+        self.assertEqual(12.0, val)
+        val = sh1.get_numeric_value(5, 1)
+        self.assertEqual(24.0, val)
+        val = sh1.get_numeric_value(6, 1)
+        self.assertEqual(34.0, val)
+
+        # Delete B5 and check.
+        sh1.erase_cell(4, 1)
+        self.doc.calculate()
+        val = sh1.get_numeric_value(4, 1)
+        self.assertEqual(0.0, val)
+        val = sh1.get_numeric_value(5, 1)
+        self.assertEqual(0.0, val)
+        val = sh1.get_numeric_value(6, 1)
+        self.assertEqual(10.0, val)
+
+    def test_formula_cell_string(self):
+        sh1 = self.doc.append_sheet("MyData")
+        sh1.set_string_cell(1, 1, "My precious string")  # B2
+        sh1.set_formula_cell(1, 2, "B2")  # C2
+        sh1.set_formula_cell(2, 2, "concatenate(B2, \" is here\")")  # C3
+        self.doc.calculate()
+        self.assertEqual("My precious string", sh1.get_string_value(1, 1))
+        self.assertEqual("My precious string", sh1.get_string_value(1, 2))
+        self.assertEqual("My precious string is here", sh1.get_string_value(2, 2))
+
+    def test_detached_sheet(self):
+        # You can't set values to a detached sheet that doesn't belong to a
+        # Document object.
+        sh = ixion.Sheet()
+        try:
+            sh.set_numeric_cell(1, 1, 12)
+            self.assertTrue(False, "failed to raise a SheetError.")
+        except ixion.SheetError:
+            pass # expected
+
+        try:
+            sh.set_string_cell(2, 2, "String")
+            self.assertTrue(False, "failed to raise a SheetError.")
+        except ixion.SheetError:
+            pass # expected
+
+        try:
+            sh.set_formula_cell(2, 2, "A1")
+            self.assertTrue(False, "failed to raise a SheetError.")
+        except ixion.SheetError:
+            pass # expected
+
+        try:
+            sh.erase_cell(2, 1)
+            self.assertTrue(False, "failed to raise a SheetError.")
+        except ixion.SheetError:
+            pass # expected
+
+        try:
+            val = sh.get_numeric_value(2, 1)
+            self.assertTrue(False, "failed to raise a SheetError.")
+        except ixion.SheetError:
+            pass # expected
+
+        try:
+            s = sh.get_string_value(2, 1)
+            self.assertTrue(False, "failed to raise a SheetError.")
+        except ixion.SheetError:
+            pass # expected
+
+        try:
+            expr = sh.get_formula_expression(2, 1)
+            self.assertTrue(False, "failed to raise a SheetError.")
+        except ixion.SheetError:
+            pass # expected
+
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/libixion.spec b/libixion.spec
index bbafdd9..242f312 100644
--- a/libixion.spec
+++ b/libixion.spec
@@ -1,23 +1,22 @@
-%global apiversion 0.8
+%global apiversion 0.10
 
 Name: libixion
-Version: 0.7.0
-Release: 4%{?dist}
+Version: 0.9.0
+Release: 1%{?dist}
 Summary: A general purpose formula parser & interpreter library
 
 License: MPLv2.0
 URL: https://gitorious.org/ixion/pages/Home
-Source: http://kohei.us/files/ixion/src/%{name}-%{version}.tar.bz2
+Source: http://kohei.us/files/ixion/src/%{name}-%{version}.tar.xz
+
+Patch0: 0001-fix-make-distcheck.patch
+Patch1: ixion-python-test.py
 
-BuildRequires: autoconf
 BuildRequires: automake
-BuildRequires: libtool
 BuildRequires: boost-devel
 BuildRequires: help2man
 BuildRequires: pkgconfig(mdds)
-
-Patch0: 0001-update-boost.m4.patch
-Patch1: 0001-multiple-build-system-fixes.patch
+BuildRequires: pkgconfig(python2)
 
 %description
 Ixion is a general purpose formula parser & interpreter that can calculate
@@ -59,11 +58,20 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
 %description tools
 Testing tools for %{name}.
 
+%package python
+Summary: Python 2 bindings for libixion
+Requires: %{name}%{?_isa} = %{version}-%{release}
+
+%description python
+Python 2 bindings for %{name}.
+
 %prep
-%autosetup -p1
+%setup -q
+%patch0 -p1
+cp %{PATCH1} test/
 
 %build
-autoreconf -i
+automake
 %configure --disable-silent-rules --disable-static --disable-werror
 sed -i \
     -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
@@ -77,7 +85,7 @@ help2man -N -n 'sorter' -o ixion-sorter.1 ./src/ixion-sorter
 
 %install
 make install DESTDIR=%{buildroot}
-rm -f %{buildroot}/%{_libdir}/*.la
+rm -f %{buildroot}%{_libdir}/*.la %{buildroot}%{python_sitearch}/*.la
 
 install -m 0755 -d %{buildroot}/%{_mandir}/man1
 install -m 0644 ixion-parser.1 ixion-sorter.1 %{buildroot}/%{_mandir}/man1
@@ -105,7 +113,13 @@ make %{?_smp_mflags} check
 %{_mandir}/man1/ixion-parser.1*
 %{_mandir}/man1/ixion-sorter.1*
 
+%files python
+%{python_sitearch}/ixion.so
+
 %changelog
+* Wed Feb 18 2015 David Tardon <dtardon at redhat.com> - 0.9.0-1
+- new upstream release
+
 * Tue Jan 27 2015 Petr Machata <pmachata at redhat.com> - 0.7.0-4
 - Rebuild for boost 1.57.0
 
diff --git a/sources b/sources
index 3f933b0..3c15244 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-000157117801f9507f34b26ba998c4d1  libixion-0.7.0.tar.bz2
+26f293e708513dea5e6e25e9232a7400  libixion-0.9.0.tar.xz


More information about the scm-commits mailing list