Don't import deprecated sre_parse and sre_constants modules
Related to https://bugzilla.redhat.com/show_bug.cgi?id=2098971#c6
This commit is contained in:
parent
98634f1215
commit
4f4b32b780
@ -2,11 +2,16 @@
|
||||
|
||||
Name: python-%{pypi_name}
|
||||
Version: 0.9.0
|
||||
Release: 6%{?dist}
|
||||
Release: 7%{?dist}
|
||||
Summary: Lark is a modern general-purpose parsing library for Python
|
||||
License: MIT
|
||||
Url: https://github.com/lark-parser/lark
|
||||
Source: https://files.pythonhosted.org/packages/source/l/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
|
||||
|
||||
# Adjust imports for Python 3.11, merged upstream
|
||||
# https://github.com/lark-parser/lark/pull/1140
|
||||
Patch: python3.11.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
%description
|
||||
@ -74,7 +79,7 @@ Features:
|
||||
- Unicode fully supported
|
||||
|
||||
%prep
|
||||
%autosetup -n %{pypi_name}-%{version}
|
||||
%autosetup -p1 -n %{pypi_name}-%{version}
|
||||
|
||||
%build
|
||||
%py3_build
|
||||
@ -93,6 +98,9 @@ rm -rfv %{buildroot}/%{python3_sitelib}/lark-stubs/
|
||||
%{python3_sitelib}/lark/
|
||||
|
||||
%changelog
|
||||
* Thu Jul 07 2022 Miro Hrončok <mhroncok@redhat.com> - 0.9.0-7
|
||||
- Don't import deprecated sre_parse and sre_constants modules
|
||||
|
||||
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 0.9.0-6
|
||||
- Rebuilt for Python 3.11
|
||||
|
||||
|
33
python3.11.patch
Normal file
33
python3.11.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From 7bbb353dd258905510289bda3de87a8354daca3c Mon Sep 17 00:00:00 2001
|
||||
From: Florian Bruhin <me@the-compiler.org>
|
||||
Date: Tue, 26 Apr 2022 13:37:12 +0200
|
||||
Subject: [PATCH] Adjust imports for Python 3.11
|
||||
|
||||
sre_parse and sre_constants are deprecated in 3.11, see https://github.com/python/cpython/issues/91308
|
||||
---
|
||||
lark/utils.py | 10 ++++++++--
|
||||
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lark/utils.py b/lark/utils.py
|
||||
index 36f50d1..29d998b 100644
|
||||
--- a/lark/utils.py
|
||||
+++ b/lark/utils.py
|
||||
@@ -173,8 +173,13 @@ except ImportError:
|
||||
import sys, re
|
||||
Py36 = (sys.version_info[:2] >= (3, 6))
|
||||
|
||||
-import sre_parse
|
||||
-import sre_constants
|
||||
+if sys.version_info >= (3, 11):
|
||||
+ import re._parser as sre_parse
|
||||
+ import re._constants as sre_constants
|
||||
+else:
|
||||
+ import sre_parse
|
||||
+ import sre_constants
|
||||
+
|
||||
categ_pattern = re.compile(r'\\p{[A-Za-z_]+}')
|
||||
def get_regexp_width(expr):
|
||||
if regex:
|
||||
--
|
||||
2.35.3
|
||||
|
Loading…
Reference in New Issue
Block a user