Fix Python 3.13 compatibility (close RHBZ#2252070)
This commit is contained in:
parent
b8ae1227db
commit
ec90fcdc8f
36
24.patch
Normal file
36
24.patch
Normal file
@ -0,0 +1,36 @@
|
||||
From 822a00d2001fa4de06ca854c3047b8687d6c1a32 Mon Sep 17 00:00:00 2001
|
||||
From: "Benjamin A. Beasley" <code@musicinmybrain.net>
|
||||
Date: Wed, 29 Nov 2023 08:14:32 -0500
|
||||
Subject: [PATCH] Handle importlib.resources.path removal in Python 3.13
|
||||
|
||||
---
|
||||
src/cffsubr/__init__.py | 15 ++++++++++++---
|
||||
1 file changed, 12 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/cffsubr/__init__.py b/src/cffsubr/__init__.py
|
||||
index 4428dcd..1d4eef2 100644
|
||||
--- a/src/cffsubr/__init__.py
|
||||
+++ b/src/cffsubr/__init__.py
|
||||
@@ -8,10 +8,19 @@
|
||||
import sys
|
||||
|
||||
try:
|
||||
- from importlib.resources import path
|
||||
+ # Python >= 3.9
|
||||
+ from importlib.resources import as_file, files
|
||||
except ImportError:
|
||||
- # use backport for python < 3.7
|
||||
- from importlib_resources import path
|
||||
+ try:
|
||||
+ # python >= 3.7, deprecated in python 3.11, removed in 3.13
|
||||
+ from importlib.resources import path
|
||||
+ except ImportError:
|
||||
+ # use backport for python < 3.7
|
||||
+ from importlib_resources import path
|
||||
+else:
|
||||
+ # https://docs.python.org/3.11/library/importlib.resources.html#importlib.resources.as_file
|
||||
+ def path(package, resource):
|
||||
+ return as_file(files(package).joinpath(resource))
|
||||
|
||||
from fontTools import ttLib
|
||||
|
@ -17,6 +17,10 @@ Source0: %{pypi_source %{srcname}}
|
||||
# Written for Fedora in groff_man(7) format based on the output of “cffsubr --help”
|
||||
Source1: %{srcname}.1
|
||||
|
||||
# Handle importlib.resources.path removal in Python 3.13
|
||||
# https://github.com/adobe-type-tools/cffsubr/pull/24
|
||||
Patch: https://github.com/adobe-type-tools/cffsubr/pull/24.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
BuildRequires: python3-devel
|
||||
@ -43,7 +47,7 @@ Requires: %{txbin}
|
||||
Standalone CFF subroutinizer based on the AFDKO tx tool.
|
||||
|
||||
%prep
|
||||
%autosetup -n %{srcname}-%{version}
|
||||
%autosetup -n %{srcname}-%{version} -p1
|
||||
|
||||
# Patch out setuptools-git-ls-files dependency
|
||||
sed -r -i '/setuptools-git-ls-files/d' setup.py pyproject.toml
|
||||
|
Loading…
Reference in New Issue
Block a user