Here's a patch that fixes both issues and more:

1. Fixes setup.py so the unit test data files are copied during the 
installation stage. This makes the unit tests work again.

2. Removes unit tests from python3-collada package. I'm not sure why they were 
included in the first place. Feel free to add them back if this was done on 
purpose. The data files are also excluded, as well as a __pycache__ directory 
that caused dh_missing errors.

3. Replaces deprecated numpy types with appropriate ones. This makes pycollada 
compatible with numpy 2.0. I also reported this upstream: 
https://github.com/pycollada/pycollada/issues/153
diff --git a/debian/not-installed b/debian/not-installed
new file mode 100644
index 0000000..dcca4d9
--- /dev/null
+++ b/debian/not-installed
@@ -0,0 +1,3 @@
+usr/lib/python3*/dist-packages/collada/__pycache__
+usr/lib/python3*/dist-packages/collada/tests/*
+usr/lib/python3*/dist-packages/collada/tests/data/*
diff --git a/debian/patches/01-install-test-data.patch b/debian/patches/01-install-test-data.patch
new file mode 100644
index 0000000..c2f1f22
--- /dev/null
+++ b/debian/patches/01-install-test-data.patch
@@ -0,0 +1,12 @@
+--- a/setup.py
++++ b/setup.py
+@@ -27,5 +27,8 @@
+     url = "http://pycollada.readthedocs.org/";,
+     test_suite = "collada.tests",
+     packages = find_packages(),
+-    package_data={'collada': ['resources/*.xml']}
++    package_data = {
++        'collada': ['resources/*.xml'],
++        'collada.tests': ['data/*']
++    }
+ )
diff --git a/debian/patches/02-numpy-unicode-test.patch b/debian/patches/02-numpy-unicode-test.patch
new file mode 100644
index 0000000..4ef9ed5
--- /dev/null
+++ b/debian/patches/02-numpy-unicode-test.patch
@@ -0,0 +1,58 @@
+--- a/collada/tests/test_source.py
++++ b/collada/tests/test_source.py
+@@ -31,7 +31,7 @@
+ 
+     def test_idref_source_saving(self):
+         idrefsource = collada.source.IDRefSource("myidrefsource",
+-                                numpy.array(['Ref1', 'Ref2'], dtype=numpy.string_),
++                                numpy.array(['Ref1', 'Ref2'], dtype=numpy.str_),
+                                 ('MORPH_TARGET',))
+         self.assertEqual(idrefsource.id, "myidrefsource")
+         self.assertEqual(len(idrefsource), 2)
+@@ -39,7 +39,7 @@
+         self.assertIsNotNone(str(idrefsource))
+         idrefsource.id = "youridrefsource"
+         idrefsource.components = ('JOINT_TARGET', 'WHATEVER_TARGET')
+-        idrefsource.data = numpy.array(['Ref5', 'Ref6', 'Ref7', 'Ref8', 'Ref9', 'Ref10'], dtype=numpy.string_)
++        idrefsource.data = numpy.array(['Ref5', 'Ref6', 'Ref7', 'Ref8', 'Ref9', 'Ref10'], dtype=numpy.str_)
+         idrefsource.save()
+         loaded_idrefsource = collada.source.Source.load(self.dummy, {}, fromstring(tostring(idrefsource.xmlnode)))
+         self.assertTrue(isinstance(loaded_idrefsource, collada.source.IDRefSource))
+@@ -49,7 +49,7 @@
+ 
+     def test_name_source_saving(self):
+         namesource = collada.source.NameSource("mynamesource",
+-                                numpy.array(['Name1', 'Name2'], dtype=numpy.string_),
++                                numpy.array(['Name1', 'Name2'], dtype=numpy.str_),
+                                 ('JOINT',))
+         self.assertEqual(namesource.id, "mynamesource")
+         self.assertEqual(len(namesource), 2)
+@@ -57,7 +57,7 @@
+         self.assertIsNotNone(str(namesource))
+         namesource.id = "yournamesource"
+         namesource.components = ('WEIGHT', 'WHATEVER')
+-        namesource.data = numpy.array(['Name1', 'Name2', 'Name3', 'Name4', 'Name5', 'Name6'], dtype=numpy.string_)
++        namesource.data = numpy.array(['Name1', 'Name2', 'Name3', 'Name4', 'Name5', 'Name6'], dtype=numpy.str_)
+         namesource.save()
+         loaded_namesource = collada.source.Source.load(self.dummy, {}, fromstring(tostring(namesource.xmlnode)))
+         self.assertTrue(isinstance(loaded_namesource, collada.source.NameSource))
+--- a/collada/source.py
++++ b/collada/source.py
+@@ -295,7 +295,7 @@
+         else:
+             try: values = [v for v in arraynode.text.split()]
+             except ValueError: raise DaeMalformedError('Corrupted IDREF array')
+-        data = numpy.array( values, dtype=numpy.unicode_ )
++        data = numpy.array( values, dtype=numpy.str_ )
+         paramnodes = node.findall('%s/%s/%s'%(collada.tag('technique_common'), collada.tag('accessor'), collada.tag('param')))
+         if not paramnodes: raise DaeIncompleteError('No accessor info in source node')
+         components = [ param.get('name') for param in paramnodes ]
+@@ -394,7 +394,7 @@
+         else:
+             try: values = [v for v in arraynode.text.split()]
+             except ValueError: raise DaeMalformedError('Corrupted Name array')
+-        data = numpy.array( values, dtype=numpy.unicode_ )
++        data = numpy.array( values, dtype=numpy.str_ )
+         paramnodes = node.findall('%s/%s/%s'%(tag('technique_common'), tag('accessor'), tag
+                                               ('param')))
+         if not paramnodes: raise DaeIncompleteError('No accessor info in source node')
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..246f654
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,2 @@
+01-install-test-data.patch
+02-numpy-unicode-test.patch
diff --git a/debian/python3-collada.install b/debian/python3-collada.install
index 2558f27..2d63cb2 100644
--- a/debian/python3-collada.install
+++ b/debian/python3-collada.install
@@ -18,17 +18,6 @@ usr/lib/python3*/dist-packages/collada/light.py
 usr/lib/python3*/dist-packages/collada/polylist.py
 usr/lib/python3*/dist-packages/collada/__main__.py
 usr/lib/python3*/dist-packages/collada/geometry.py
-usr/lib/python3*/dist-packages/collada/tests/__init__.py
-usr/lib/python3*/dist-packages/collada/tests/test_asset.py
-usr/lib/python3*/dist-packages/collada/tests/test_geometry.py
-usr/lib/python3*/dist-packages/collada/tests/test_light.py
-usr/lib/python3*/dist-packages/collada/tests/test_source.py
-usr/lib/python3*/dist-packages/collada/tests/test_collada.py
-usr/lib/python3*/dist-packages/collada/tests/test_material.py
-usr/lib/python3*/dist-packages/collada/tests/test_iteration.py
-usr/lib/python3*/dist-packages/collada/tests/test_camera.py
-usr/lib/python3*/dist-packages/collada/tests/test_scene.py
-usr/lib/python3*/dist-packages/collada/tests/test_lineset.py
 usr/lib/python3*/dist-packages/pycollada-*.egg-info/PKG-INFO
 usr/lib/python3*/dist-packages/pycollada-*.egg-info/dependency_links.txt
 usr/lib/python3*/dist-packages/pycollada-*.egg-info/top_level.txt

Reply via email to