Update to 1.1.7 + rename to python-lark

This commit is contained in:
Tomáš Hrnčiar 2023-08-01 17:18:37 +02:00
parent 3cc9d13d90
commit c7a9aa2e7b
4 changed files with 64 additions and 83 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
/lark-parser-0.8.2.tar.gz /lark-parser-0.8.2.tar.gz
/lark-parser-0.9.0.tar.gz /lark-parser-0.9.0.tar.gz
/lark-1.1.7.tar.gz

View File

@ -1,16 +1,14 @@
%global pypi_name lark-parser Name: python-lark
Version: 1.1.7
Name: python-%{pypi_name} Release: 1%{?dist}
Version: 0.9.0
Release: 11%{?dist}
Summary: Lark is a modern general-purpose parsing library for Python Summary: Lark is a modern general-purpose parsing library for Python
License: MIT # License breakdown:
# lark/tools/standalone.py - MPL-2.0
# lark/__pyinstaller/hook-lark.py - GPL-2.0-or-later
# the rest is MIT
License: MIT AND MPL-2.0 AND GPL-2.0-or-later
Url: https://github.com/lark-parser/lark Url: https://github.com/lark-parser/lark
Source: https://files.pythonhosted.org/packages/source/l/%{pypi_name}/%{pypi_name}-%{version}.tar.gz Source: %{pypi_source lark}
# Adjust imports for Python 3.11, merged upstream
# https://github.com/lark-parser/lark/pull/1140
Patch: python3.11.patch
BuildArch: noarch BuildArch: noarch
@ -43,61 +41,76 @@ Features:
- Python 2 & 3 compatible - Python 2 & 3 compatible
- Unicode fully supported - Unicode fully supported
%package -n python3-%{pypi_name} %package -n python3-lark
Summary: %{summary} Summary: %{summary}
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: python3-setuptools %py_provides python3-lark-parser
%{?python_provide:%python_provide python3-%{pypi_name}} Obsoletes: python3-lark-parser < 1
%description -n python3-%{pypi_name} %description -n python3-lark
Lark is a modern general-purpose parsing library for Python. Lark is a modern general-purpose parsing library for Python. With Lark, you can
parse any context-free grammar, efficiently, with very little code.
Lark focuses on simplicity and power. It lets you choose between Main Features:
two parsing algorithms: - Builds a parse-tree (AST) automagically, based on
the structure of the grammar
Earley : Parses all context-free grammars (even ambiguous ones)! - Earley parser
It is the default. - Can parse all context-free grammars
- Full support for ambiguous grammars
LALR(1): Only LR grammars. Outperforms PLY and most if not all - LALR(1) parser
other pure-python parsing libraries. - Fast and light, competitive with PLY
- Can generate a stand-alone parser
Both algorithms are written in Python and can be used interchangeably - CYK parser, for highly ambiguous grammars
with the same grammar (aside for algorithmic restrictions). - EBNF grammar
See "Comparison to other parsers" for more details. - Unicode fully supported
- Automatic line & column tracking
Lark can auto magically build an AST from your grammar, without any - Standard library of terminals (strings, numbers, names, etc.)
more code on your part. - Import grammars from Nearley.js
- Extensive test suite
Features: - And much more! Since version 1.0, only Python versions 3.6 and up
are supported.
- EBNF grammar with a little extra
- Earley & LALR(1)
- Builds an AST auto magically based on the grammar
- Automatic line & column tracking
- Automatic token collision resolution (unless both tokens are regexps)
- Python 2 & 3 compatible
- Unicode fully supported
%prep %prep
%autosetup -p1 -n %{pypi_name}-%{version} %autosetup -p1 -n lark-%{version}
# Fix wrong-file-end-of-line-encoding.
sed -i 's/\r$//' README.md examples/*.py
%generate_buildrequires
%pyproject_buildrequires
%build %build
%py3_build %pyproject_wheel
# This package was renamed from python-lark-parser and we want to provide the old distinfo
# for packages that still need it.
%global legacy_distinfo lark_parser-%{version}.dist-info
mkdir %{legacy_distinfo}
cat > %{legacy_distinfo}/METADATA << EOF
Metadata-Version: 2.1
Name: lark-parser
Version: %{version}
EOF
echo rpm > %{legacy_distinfo}/INSTALLER
%install %install
%py3_install %pyproject_install
rm -rfv %{buildroot}/%{python3_sitelib}/lark-stubs/ %pyproject_save_files lark
cp -a %{legacy_distinfo} %{buildroot}%{python3_sitelib}
%check %check
%{python3} -m tests %{python3} -m tests
%files -n python3-%{pypi_name} %files -n python3-lark -f %{pyproject_files}
%license LICENSE
%doc README.md examples %doc README.md examples
%{python3_sitelib}/lark_parser-*.egg-info %{python3_sitelib}/%{legacy_distinfo}/
%{python3_sitelib}/lark/
%changelog %changelog
* Thu Jul 27 2023 Tomáš Hrnčiar <thrnciar@redhat.com> - 1.1.7-1
- Rename from lark-parser to lark
- Update to 1.1.7
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.0-11 * Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.0-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

View File

@ -1,33 +0,0 @@
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

View File

@ -1 +1 @@
SHA512 (lark-parser-0.9.0.tar.gz) = e22f35666aa39cc504eaf48950170bd44eb9d9e15ae2f13d47a4950576be31f1bbabf799847b02e5ee22c0f96fb75c5256c8e4a4aa195caa830444f5b91d6852 SHA512 (lark-1.1.7.tar.gz) = 59e5567ebff173a25caa2ea4db3ff3f284bd580ce68a6a3ca27ceff34158a9b56fc404ebf3016e2bbb074fd19286a0d511ffaadf2f157185f45b10305c3c8474