[pyode] Initial import for pyode. #927611

Ankur Sinha ankursinha at fedoraproject.org
Mon Apr 29 01:51:28 UTC 2013


commit bcf8278b3031e91a53d7dd0013e909700c332478
Author: Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur at gmail.com>
Date:   Mon Apr 29 11:51:19 2013 +1000

    Initial import for pyode. #927611

 .gitignore                                         |    1 +
 0001-pyode-2010-03-22-fix-test-segfault.patch      |   24 ++++
 ...-pyode-2010-03-22-use-almost-equal-assert.patch |   91 ++++++++++++++
 pyode.spec                                         |  129 ++++++++++++++++++++
 sources                                            |    1 +
 5 files changed, 246 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..60bc63f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/PyODE-snapshot-2010-03-22.tar.gz
diff --git a/0001-pyode-2010-03-22-fix-test-segfault.patch b/0001-pyode-2010-03-22-fix-test-segfault.patch
new file mode 100644
index 0000000..ec2eb2a
--- /dev/null
+++ b/0001-pyode-2010-03-22-fix-test-segfault.patch
@@ -0,0 +1,24 @@
+diff -ur ../PyODE-snapshot-2010-03-22.orig/src/body.pyx ./src/body.pyx
+--- ../PyODE-snapshot-2010-03-22.orig/src/body.pyx	2013-04-25 22:19:59.582137101 +1000
++++ ./src/body.pyx	2013-04-25 22:20:30.387025990 +1000
+@@ -56,7 +56,7 @@
+         self.userattribs = {}
+ 
+     def __dealloc__(self):
+-        if self.bid!=NULL:
++        if self.bid!=NULL and self.world:
+             dBodyDestroy(self.bid)
+ 
+     def __getattr__(self, name):
+diff -ur ../PyODE-snapshot-2010-03-22.orig/src/joints.pyx ./src/joints.pyx
+--- ../PyODE-snapshot-2010-03-22.orig/src/joints.pyx	2013-04-25 22:19:59.583137098 +1000
++++ ./src/joints.pyx	2013-04-25 22:20:38.613993565 +1000
+@@ -121,7 +121,7 @@
+ 
+     def __dealloc__(self):
+         self.setFeedback(False)
+-        if self.jid!=NULL:
++        if self.jid!=NULL and self.world:
+             dJointDestroy(self.jid)
+ 
+     def __getattr__(self, name):
diff --git a/0002-pyode-2010-03-22-use-almost-equal-assert.patch b/0002-pyode-2010-03-22-use-almost-equal-assert.patch
new file mode 100644
index 0000000..8d9a231
--- /dev/null
+++ b/0002-pyode-2010-03-22-use-almost-equal-assert.patch
@@ -0,0 +1,91 @@
+--- ../PyODE-snapshot-2010-03-22.orig/tests/test_xode.py	2013-04-25 22:19:59.586137088 +1000
++++ tests/test_xode.py	2013-04-26 13:09:52.935507096 +1000
+@@ -290,6 +290,28 @@
+ class Class2:
+     pass
+ 
++def assertFloatListsAlmostEqual(self, item1, item2, msg=None):
++    """
++    Test lists or tuples of floats with assertAlmostEqual
++    """
++
++    # be sure we're comparing apples to apples
++    if type(item1) is not type(item2):
++        raise self.failureException(
++            "detected differing types")
++
++    # test floats
++    if isinstance(item1,float):
++        self.assertAlmostEqual(item1, item2, msg=msg, places=5)
++    elif isinstance(item1,list) or isinstance(item1,tuple):
++        # recurse over list
++        for i in range(0,len(item1)):
++            self.assertFloatListsAlmostEqual(item1[i], item2[i], msg=msg)
++    else:
++        # default, probably unnecessary
++        self.assertEqual(item1, item2, msg=msg)
++
++
+ class TestTreeNode(unittest.TestCase):
+ 
+     def setUp(self):
+@@ -504,6 +526,8 @@
+         self.joint9 = self.root.namedChild('joint9').getODEObject()
+         self.joint10 = self.root.namedChild('joint10').getODEObject()
+ 
++    assertFloatListsAlmostEqual = assertFloatListsAlmostEqual
++
+     def testBallInstance(self):
+         self.assert_(isinstance(self.joint1, ode.BallJoint))
+ 
+@@ -531,13 +555,13 @@
+         self.assert_(isinstance(self.joint5, ode.HingeJoint))
+ 
+     def testHingeAxis(self):
+-        self.assertEqual(self.joint5.getAxis(), (1.0, 0.0, 0.0))
++        self.assertFloatListsAlmostEqual(self.joint5.getAxis(), (1.0, 0.0, 0.0))
+ 
+     def testSliderInstance(self):
+         self.assert_(isinstance(self.joint6, ode.SliderJoint))
+ 
+     def testSliderAxis(self):
+-        self.assertEqual(self.joint6.getAxis(), (0.0, 1.0, 0.0))
++        self.assertFloatListsAlmostEqual(self.joint6.getAxis(), (0.0, 1.0, 0.0))
+ 
+     def testUniversalInstance(self):
+         self.assert_(isinstance(self.joint7, ode.UniversalJoint))
+@@ -585,13 +609,13 @@
+     def testAMotorAxes1(self):
+         ref = (0.0, 1.0, 0.0)
+         axis1 = self.joint9.getAxis(0)
+-        self.assertEqual(ref, axis1)
++        self.assertFloatListsAlmostEqual(ref, axis1)
+ 
+     def testAMotorAxes3(self):
+         ref = [(1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, 1.0)]
+         axes = [self.joint10.getAxis(0), self.joint10.getAxis(1),
+                 self.joint10.getAxis(2)]
+-        self.assertEqual(ref, axes)
++        self.assertFloatListsAlmostEqual(ref, axes)
+ 
+     def testAxisParamLoStop(self):
+         self.assertEqualf(self.joint6.getParam(ode.paramLoStop), 1.0)
+@@ -643,6 +667,8 @@
+         self.body1 = self.root.namedChild('body1').getODEObject()
+         self.space1 = self.root.namedChild('space1').getODEObject()
+ 
++    assertFloatListsAlmostEqual = assertFloatListsAlmostEqual
++
+     def testSpaceAncestor(self):
+         self.assertEqual(self.geom1.getSpace(), self.space1)
+ 
+@@ -671,7 +697,8 @@
+         self.assert_(isinstance(self.geom4, ode.GeomPlane))
+ 
+     def testPlaneParams(self):
+-        self.assertEqual(self.geom4.getParams(), ((0.0, 1.0, 0.0), 17.0))
++        self.assertFloatListsAlmostEqual(self.geom4.getParams(),((0.0, 1.0,
++                                                                  0.0), 17.0))
+ 
+     def testRayInstance(self):
+         self.assert_(isinstance(self.geom3, ode.GeomRay))
diff --git a/pyode.spec b/pyode.spec
new file mode 100644
index 0000000..821eb25
--- /dev/null
+++ b/pyode.spec
@@ -0,0 +1,129 @@
+%global with_python3 0
+%global snapdate 2010-03-22
+%global tarname PyODE-snapshot-%{snapdate}
+
+Name:           pyode
+Version:        1.2.0
+Release:        4%{?dist}
+Summary:        Open-source Python bindings for The Open Dynamics Engine
+Group:          Development/Libraries
+
+License:        BSD or LGPLv2+
+URL:            http://pyode.sourceforge.net/
+
+# https://downloads.sourceforge.net/project/pyode/pyode/snapshot-2010-03-22/PyODE-snapshot-2010-03-22.tar.gz
+Source0:        http://downloads.sourceforge.net/%{name}/%{name}/snapshot-%{snapdate}/%{tarname}.tar.gz 
+
+# http://comments.gmane.org/gmane.comp.python.pyode.user/174
+Patch0:         0001-pyode-%{snapdate}-fix-test-segfault.patch
+
+# Fix rounding-error test failures on Fedora 17-20 (but not el6!)
+Patch1:         0002-pyode-%{snapdate}-use-almost-equal-assert.patch
+
+BuildRequires:  python2-devel python-setuptools
+BuildRequires:  ode-devel
+BuildRequires:  Pyrex
+
+Requires:       ode
+
+%if 0%{?with_python3}
+BuildRequires:  python3-devel
+BuildRequires:  python3-setuptools
+%endif # if with_python3
+
+%{?filter_setup:
+%filter_provides_in %{python_sitearch}/.*\.so$ 
+%filter_setup
+}
+
+%description
+A set of open-source Python bindings for The Open Dynamics Engine, an
+open-source physics engine. PyODE also includes an XODE parser.
+
+%if 0%{?with_python3}
+%package -n python3-pyode
+Group:          Applications/System
+Summary:        Open-source Python bindings for The Open Dynamics Engine
+
+%description -n python3-pyode
+A set of open-source Python bindings for The Open Dynamics Engine, an
+open-source physics engine. PyODE also includes an XODE parser.
+
+%endif # with_python3
+
+%prep
+%setup -q -n %{tarname}
+
+# Fix wrong end of line file encoding error
+sed -i 's/\r//' examples/tutorial3.py 
+
+%patch0 -p1 -b-gc-patch
+%patch1 -p0 -b-assert-amlost-equal-patch
+
+%if 0%{?with_python3}
+rm -rf %{py3dir}
+cp -a . %{py3dir}
+find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
+%endif # with_python3
+
+%build
+%{__python} setup.py build
+
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py build
+popd
+%endif # with_python3
+
+%install
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
+popd
+%endif # with_python3
+
+%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
+
+chmod 0755 $RPM_BUILD_ROOT/%{python_sitearch}/ode.so
+
+%check
+export PYTHONPATH=build/lib.linux-%{_target_cpu}-%{python_version}
+%{__python} tests/test_xode.py
+
+
+%files
+%doc AUTHORS ChangeLog LICENSE LICENSE-BSD README examples
+%{python_sitearch}/PyODE-%{version}-py?.?.egg-info
+%{python_sitearch}/xode/
+%{python_sitearch}/ode.so
+
+
+%if 0%{?with_python3}
+%files -n python3-pyode
+%doc AUTHORS ChangeLog LICENSE LICENSE-BSD README examples
+%{python3_sitelib}/%{name}/
+%endif # with_python3
+
+%changelog
+* Fri Apr 26 2013 Ankur Sinha <ankursinha AT fedoraproject DOT org> 1.2.0-4
+- Add another patch to use almost equal assertion
+- Fix wrong end of line file encoding rpmlint error
+- Remove pyrex from requires
+
+* Thu Apr 25 2013 Ankur Sinha <ankursinha AT fedoraproject DOT org> 1.2.0-3
+- Update as per reviewer comments: 
+- https://bugzilla.redhat.com/show_bug.cgi?id=927611
+- Add patch to fix tests
+- Add group tag for epel
+- add documentation
+
+* Mon Apr 15 2013 Ankur Sinha <ankursinha AT fedoraproject DOT org> 1.2.0-2
+- Update as per comments in rhbz
+- https://bugzilla.redhat.com/show_bug.cgi?id=927611
+- Changed URL
+- Added phony check section for readability
+- Few more cosmetic changes
+
+* Tue Mar 26 2013 Ankur Sinha <ankursinha AT fedoraproject DOT org> 1.2.0-1
+- Initial rpmbuild
+
diff --git a/sources b/sources
index e69de29..a762bb7 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+0e1d6dd8a8476a0a46db19748b975ca6  PyODE-snapshot-2010-03-22.tar.gz


More information about the scm-commits mailing list