user [email protected] usertags 1147907 python3.15 tags 1147907 patch thanks
Hi! While rebuilding the python related packages against the Python 3.15rc2 version I ran into this FTBFS [1]. To solve the issue, I applied an upstream patch to migrate away from pkg_resources, commit 87745be [2] tests: use importlib in place of pkg_resources I've applied these fixes in the sandbox [3] to verify that it builds successfully, these should be applied in Debian to get the package back to a healthy state. Happy hacking, [1]: https://debusine.debian.net/debian/r-python-python3.15/artifact/4690237/ [2]: https://github.com/ArduPilot/pymavlink/commit/87745be09b1a82703a35848b34e71aeffe7dcb84 [3]: https://debusine.debian.net/debian/r-python-python3.15/ -- "Can you imagine what I would do if I could do all I can?" -- Sun Tzu Saludos /\/\ /\ >< `/
From: Peter Barker <[email protected]> Date: Sat, 21 Feb 2026 08:59:53 +1100 Subject: tests: use importlib in place of pkg_resources Origin: https://github.com/ArduPilot/pymavlink/commit/87745be09b1a82703a35848b34e71aeffe7dcb84 --- tests/test_mavlogdump.py | 12 +++++++----- tests/test_mavxml.py | 12 +++++++----- tests/test_trim.py | 1 - tests/test_wp.py | 16 +++++++++------- 4 files changed, 23 insertions(+), 18 deletions(-) --- a/tests/test_mavlogdump.py +++ b/tests/test_mavlogdump.py @@ -6,7 +6,11 @@ regression tests for mavlogdump.py """ import unittest import os -import pkg_resources +try: + from importlib.resources import files as importlib_files +except ImportError: + # importlib.resources.files() requires Python 3.9+; use backport for older versions + from importlib_resources import files as importlib_files import sys class MAVLogDumpTest(unittest.TestCase): @@ -22,8 +26,7 @@ class MAVLogDumpTest(unittest.TestCase): def test_dump_same(self): """Test dump of file is what we expect""" test_filename = "test.BIN" - test_filepath = pkg_resources.resource_filename(__name__, - test_filename) + test_filepath = importlib_files(__spec__.parent).joinpath(test_filename) dump_filename = "tmp.dump" os.system("mavlogdump.py %s >%s" % (test_filepath, dump_filename)) with open(dump_filename) as f: @@ -33,8 +36,7 @@ class MAVLogDumpTest(unittest.TestCase): "test.BIN.dumped"] success = False for expected in possibles: - expected_filepath = pkg_resources.resource_filename(__name__, - expected) + expected_filepath = importlib_files(__spec__.parent).joinpath(expected) with open(expected_filepath) as e: expected = e.read() --- a/tests/test_mavxml.py +++ b/tests/test_mavxml.py @@ -4,7 +4,11 @@ Module to test MAVXML """ import unittest -import pkg_resources +try: + from importlib.resources import files as importlib_files +except ImportError: + # importlib.resources.files() requires Python 3.9+; use backport for older versions + from importlib_resources import files as importlib_files from pymavlink.generator.mavparse import MAVXML from pymavlink.generator.mavparse import MAVParseError @@ -17,15 +21,13 @@ class MAVXMLTest(unittest.TestCase): def test_fields_number(self): """Test that a message can have at most 64 fields""" test_filename = "64-fields.xml" - test_filepath = pkg_resources.resource_filename(__name__, - test_filename) + test_filepath = importlib_files(__spec__.parent).joinpath(test_filename) xml = MAVXML(test_filepath) count = len(xml.message[0].fields) self.assertEqual(count, 64) test_filename = "65-fields.xml" - test_filepath = pkg_resources.resource_filename(__name__, - test_filename) + test_filepath = importlib_files(__spec__.parent).joinpath(test_filename) with self.assertRaises(MAVParseError): _ = MAVXML(test_filepath) --- a/tests/test_trim.py +++ b/tests/test_trim.py @@ -7,7 +7,6 @@ test for trimming under Python 3 import unittest import os -import pkg_resources import sys from pymavlink import mavutil --- a/tests/test_wp.py +++ b/tests/test_wp.py @@ -6,7 +6,11 @@ regression tests for mavwp.py import unittest import os -import pkg_resources +try: + from importlib.resources import files as importlib_files +except ImportError: + # importlib.resources.files() requires Python 3.9+; use backport for older versions + from importlib_resources import files as importlib_files import sys os.environ["MAVLINK20"] = "1" @@ -213,13 +217,13 @@ class RallyTest(unittest.TestCase): self.assertTrue(loader.is_location_command(mavutil.mavlink.MAV_CMD_NAV_RALLY_POINT)) # test loading a QGC WPL 110 file: - rally_filepath = pkg_resources.resource_filename(__name__, "rally-110.txt") + rally_filepath = importlib_files(__spec__.parent).joinpath("rally-110.txt") loader.load(rally_filepath) self.assertEqual(loader.count(), 2) self.assertEqual(loader.wp(0).command, mavutil.mavlink.MAV_CMD_NAV_RALLY_POINT) # test loading tradition "RALLY" style format: - rally_filepath = pkg_resources.resource_filename(__name__, "rally.txt") + rally_filepath = importlib_files(__spec__.parent).joinpath("rally.txt") loader.load(rally_filepath) self.assertEqual(loader.count(), 2) self.assertEqual(loader.wp(0).command, mavutil.mavlink.MAV_CMD_NAV_RALLY_POINT) @@ -233,15 +237,13 @@ class FenceTest(unittest.TestCase): self.assertTrue(loader.is_location_command(mavutil.mavlink.MAV_CMD_NAV_FENCE_POLYGON_VERTEX_EXCLUSION)) # test loading a QGC WPL 110 file: - fence_filepath = pkg_resources.resource_filename(__name__, - "fence-110.txt") + fence_filepath = importlib_files(__spec__.parent).joinpath("fence-110.txt") loader.load(fence_filepath) self.assertEqual(loader.count(), 10) self.assertEqual(loader.wp(3).command, mavutil.mavlink.MAV_CMD_NAV_FENCE_POLYGON_VERTEX_INCLUSION) # test loading tradition lat/lng-pair style format: - fence_filepath = pkg_resources.resource_filename(__name__, - "fence.txt") + fence_filepath = importlib_files(__spec__.parent).joinpath("fence.txt") loader.load(fence_filepath) # there are 6 lines in the file - one return point, four fence # points and a "fence closing point". We don't store the

