#11 Backport a fix for Python 3.13 compatibility (fix RHBZ#2256753)
Merged 5 months ago by mrunge. Opened 5 months ago by music.
rpms/ music/python-pint py313  into  rawhide

@@ -0,0 +1,30 @@ 

+ From 3cce96928581d5888f4f0b8a7b4ed07e49bcb2e7 Mon Sep 17 00:00:00 2001

+ From: "Benjamin A. Beasley" <code@musicinmybrain.net>

+ Date: Thu, 4 Jan 2024 08:32:17 -0500

+ Subject: [PATCH] Downstream-only: Backport fix for importlib.resources.path

+  removal

+ 

+ Imitate current versions of flexparser, which was split out as a

+ separate library in later releases of pint.

+ ---

+  pint/parser.py | 4 +++-

+  1 file changed, 3 insertions(+), 1 deletion(-)

+ 

+ diff --git a/pint/parser.py b/pint/parser.py

+ index e73e578..e1127a2 100644

+ --- a/pint/parser.py

+ +++ b/pint/parser.py

+ @@ -261,7 +261,9 @@ class Parser:

+          it will use python importlib.resources.read_binary

+          """

+  

+ -        with resources.path(__package__, resource_name) as p:

+ +        with resources.as_file(

+ +            resources.files(__package__).joinpath(resource_name)

+ +        )as p:

+              filepath = p.resolve()

+  

+          if filepath.exists():

+ -- 

+ 2.43.0

+ 

file modified
+15
@@ -28,6 +28,21 @@ 

  # Cherry-picked to 0.19.

  Patch:          0001-add-min-and-max-to-the-array-function-overrides.patch

  

+ # Downstream-only: Backport fix for importlib.resources.path removal

+ #

+ # Imitate current versions of flexparser, which was split out as a

+ # separate library in later releases of pint.

+ #

+ # This is resolved in current upstream releases of pint; see

+ # https://src.fedoraproject.org/rpms/python-pint/pull-request/10.

+ #

+ # Fixes:

+ #

+ # python-pint fails to build with Python 3.13: AttributeError: module

+ # 'importlib.resources' has no attribute 'path'

+ # https://bugzilla.redhat.com/show_bug.cgi?id=2256746

+ Patch:          0001-Downstream-only-Backport-fix-for-importlib.resources.patch

+ 

  BuildArch:      noarch

  

  %global _description %{expand:

Upgrading python-pint to the latest version, https://src.fedoraproject.org/rpms/python-pint/pull-request/10, is the better fix; however, this patch will do nicely while that PR waits on tmt upstream support.

Build succeeded.
https://fedora.softwarefactory-project.io/zuul/buildset/cda4de2c33a8442eb4abbbcf127c14d0

Pull-Request has been merged by mrunge

5 months ago