From c7a9aa2e7b0b1d9d621ac60f73c854fdcc154ab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= Date: Tue, 1 Aug 2023 17:18:37 +0200 Subject: [PATCH] Update to 1.1.7 + rename to python-lark --- .gitignore | 1 + python-lark-parser.spec => python-lark.spec | 111 +++++++++++--------- python3.11.patch | 33 ------ sources | 2 +- 4 files changed, 64 insertions(+), 83 deletions(-) rename python-lark-parser.spec => python-lark.spec (66%) delete mode 100644 python3.11.patch diff --git a/.gitignore b/.gitignore index fbc6136..ce8847e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /lark-parser-0.8.2.tar.gz /lark-parser-0.9.0.tar.gz +/lark-1.1.7.tar.gz diff --git a/python-lark-parser.spec b/python-lark.spec similarity index 66% rename from python-lark-parser.spec rename to python-lark.spec index 734c602..4ebabe4 100644 --- a/python-lark-parser.spec +++ b/python-lark.spec @@ -1,16 +1,14 @@ -%global pypi_name lark-parser - -Name: python-%{pypi_name} -Version: 0.9.0 -Release: 11%{?dist} +Name: python-lark +Version: 1.1.7 +Release: 1%{?dist} 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 -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 +Source: %{pypi_source lark} BuildArch: noarch @@ -43,61 +41,76 @@ Features: - Python 2 & 3 compatible - Unicode fully supported -%package -n python3-%{pypi_name} +%package -n python3-lark Summary: %{summary} BuildRequires: python3-devel -BuildRequires: python3-setuptools -%{?python_provide:%python_provide python3-%{pypi_name}} +%py_provides python3-lark-parser +Obsoletes: python3-lark-parser < 1 -%description -n python3-%{pypi_name} -Lark is a modern general-purpose parsing library for Python. +%description -n python3-lark +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 -two parsing algorithms: - -Earley : Parses all context-free grammars (even ambiguous ones)! -It is the default. - -LALR(1): Only LR grammars. Outperforms PLY and most if not all -other pure-python parsing libraries. - -Both algorithms are written in Python and can be used interchangeably -with the same grammar (aside for algorithmic restrictions). -See "Comparison to other parsers" for more details. - -Lark can auto magically build an AST from your grammar, without any -more code on your part. - -Features: - -- 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 +Main Features: + - Builds a parse-tree (AST) automagically, based on + the structure of the grammar + - Earley parser + - Can parse all context-free grammars + - Full support for ambiguous grammars + - LALR(1) parser + - Fast and light, competitive with PLY + - Can generate a stand-alone parser + - CYK parser, for highly ambiguous grammars + - EBNF grammar + - Unicode fully supported + - Automatic line & column tracking + - Standard library of terminals (strings, numbers, names, etc.) + - Import grammars from Nearley.js + - Extensive test suite + - And much more! Since version 1.0, only Python versions 3.6 and up + are supported. %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 -%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 -%py3_install -rm -rfv %{buildroot}/%{python3_sitelib}/lark-stubs/ +%pyproject_install +%pyproject_save_files lark + +cp -a %{legacy_distinfo} %{buildroot}%{python3_sitelib} %check %{python3} -m tests -%files -n python3-%{pypi_name} -%license LICENSE +%files -n python3-lark -f %{pyproject_files} %doc README.md examples -%{python3_sitelib}/lark_parser-*.egg-info -%{python3_sitelib}/lark/ +%{python3_sitelib}/%{legacy_distinfo}/ + %changelog +* Thu Jul 27 2023 Tomáš Hrnčiar - 1.1.7-1 +- Rename from lark-parser to lark +- Update to 1.1.7 + * Fri Jul 21 2023 Fedora Release Engineering - 0.9.0-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild diff --git a/python3.11.patch b/python3.11.patch deleted file mode 100644 index 59a9aed..0000000 --- a/python3.11.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 7bbb353dd258905510289bda3de87a8354daca3c Mon Sep 17 00:00:00 2001 -From: Florian Bruhin -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 - diff --git a/sources b/sources index 68a7fb9..0ea99f5 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (lark-parser-0.9.0.tar.gz) = e22f35666aa39cc504eaf48950170bd44eb9d9e15ae2f13d47a4950576be31f1bbabf799847b02e5ee22c0f96fb75c5256c8e4a4aa195caa830444f5b91d6852 +SHA512 (lark-1.1.7.tar.gz) = 59e5567ebff173a25caa2ea4db3ff3f284bd580ce68a6a3ca27ceff34158a9b56fc404ebf3016e2bbb074fd19286a0d511ffaadf2f157185f45b10305c3c8474