From 2ebd3d080771e3547e96d36127f3dd70e4aa726157a72a8ea4bf32e58b58be6a Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Tue, 25 Mar 2025 04:23:09 +0000 Subject: [PATCH 1/2] - Lowercase metadata directory name. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Parsley?expand=0&rev=20 --- .gitattributes | 23 +++++++++ .gitignore | 1 + Parsley-1.3.tar.gz | 3 ++ python-Parsley.changes | 84 +++++++++++++++++++++++++++++++ python-Parsley.spec | 106 ++++++++++++++++++++++++++++++++++++++++ support-python312.patch | 105 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 322 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 Parsley-1.3.tar.gz create mode 100644 python-Parsley.changes create mode 100644 python-Parsley.spec create mode 100644 support-python312.patch diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/Parsley-1.3.tar.gz b/Parsley-1.3.tar.gz new file mode 100644 index 0000000..49b7c13 --- /dev/null +++ b/Parsley-1.3.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9444278d47161d5f2be76a767809a3cbe6db4db822f46a4fd7481d4057208d41 +size 99616 diff --git a/python-Parsley.changes b/python-Parsley.changes new file mode 100644 index 0000000..7d03a2d --- /dev/null +++ b/python-Parsley.changes @@ -0,0 +1,84 @@ +------------------------------------------------------------------- +Tue Mar 25 04:22:49 UTC 2025 - Steve Kowalik + +- Lowercase metadata directory name. + +------------------------------------------------------------------- +Tue Jan 9 03:38:03 UTC 2024 - Steve Kowalik + +- Add patch support-python312.patch: + * Support Python 3.12 by using non-removed assertion functions. +- Switch to autosetup and pyproject macros. +- Correct URL. +- Stop using greedy globs in %files. + +------------------------------------------------------------------- +Fri May 5 12:13:25 UTC 2023 - Johannes Kastl + +- add sle15_python_module_pythons + +------------------------------------------------------------------- +Wed Aug 12 22:50:41 UTC 2020 - Matej Cepl + +- Replace pypi.python.org Source URL with the canonical files.pythonhosted.org + +------------------------------------------------------------------- +Wed May 20 07:26:05 UTC 2020 - Petr Gajdos + +- %python3_only -> %python_alternative + +------------------------------------------------------------------- +Thu Nov 7 15:02:03 UTC 2019 - Matej Cepl + +- Run through spec-cleaner + +------------------------------------------------------------------- +Sat Aug 25 18:05:32 UTC 2018 - jengelh@inai.de + +- Use noun phrase in summary. Strip storytelling from description. + +------------------------------------------------------------------- +Thu Aug 23 11:17:06 UTC 2018 - tchvatal@suse.com + +- Version update to 1.3: + * support py3 + * tests redone in pytest +- Run all tests +- Switch to singlespec +- Do not generate the docu and obsolete the doc subpkg + +------------------------------------------------------------------- +Sun Jun 7 17:32:45 UTC 2015 - nemysis@gmx.ch + +- Use %{oname} instead of Parsley +- Use check for openSUSE %if 0%{?suse_version} +- Correct what fdupes not have found (docs) +- Use right files name instead of %{_bindir}/* and %{python_sitelib}/* + +------------------------------------------------------------------- +Tue Sep 24 08:21:59 UTC 2013 - hpj@urpla.net + +- version 1.2 + - Added 'makeProtocol' for parsing stream protocols using Parsley + grammars and Twisted, with examples, docs, and a tutorial. + - Added 'stack' as support for 'makeProtocol'. + - Sped up parsing; started compiling python expressons only once. + (thanks to eevee!) + - Allowed tuple unpacking in assignment in rules. For example, + `rule1 = rule2:(a, b) -> a + b`. (thanks to introom!) + - Added a trace hook and an example of a trace visualizer using it. + - Fixed an example in the README. (thanks to ilmarga!) + - Added support for custom labels in grammars. For example, + `rule1 = rule2 ^(foo)` will make Parsley consider 'foo' the name for + 'rule2' in error messages. (thanks to miebster!) + +------------------------------------------------------------------- +Thu Aug 1 10:47:07 UTC 2013 - hpj@urpla.net + +- spec file clean up and prefix binaries with parsley- + +------------------------------------------------------------------- +Fri Mar 29 00:28:43 UTC 2013 - hpj@urpla.net + +- python-Parsley version 1.1 (initial package) + diff --git a/python-Parsley.spec b/python-Parsley.spec new file mode 100644 index 0000000..63feac3 --- /dev/null +++ b/python-Parsley.spec @@ -0,0 +1,106 @@ +# +# spec file for package python-Parsley +# +# Copyright (c) 2025 SUSE LLC +# Copyright (c) 2013 LISA GmbH, Bingen, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%{?sle15_python_module_pythons} +%define modname Parsley +%define oldpython python +Name: python-Parsley +Version: 1.3 +Release: 0 +Summary: PEG algorithm based parser generator +License: MIT +URL: https://github.com/pyga/parsley +Source: https://files.pythonhosted.org/packages/source/P/%{modname}/%{modname}-%{version}.tar.gz +# PATCH-FIX-UPSTREAM gh#pyga/parsley#82 +Patch0: support-python312.patch +BuildRequires: %{python_module Twisted} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires(post): update-alternatives +Requires(postun): update-alternatives +Provides: python-parsley +Obsoletes: %{oldpython}-Parsley-doc +Obsoletes: python-Parsley-doc +BuildArch: noarch +%python_subpackages + +%description +Parsley is a parsing library. Most parser generators like ANTLR and +Bison are based on LL or LR parsing algorithms that compile to big +state machine tables, whereas Parsley, like pyparsing and +ZestyParser, uses the PEG algorithm, so each expression in the +grammar rules works like a Python expression. In particular, +alternatives are evaluated in order, unlike table-driven parsers such +as yacc, bison or PLY. + +The binaries are prefixed with parsley-. + +%prep +%autosetup -p1 -n %{modname}-%{version} +# Remove with bump, missing fixtures +rm -f ometa/test/test_vm_builder.py + +%build +export LANG=en_US.UTF-8 +%pyproject_wheel + +%install +export LANG=en_US.UTF-8 +%pyproject_install +mkdir %{buildroot}/%{_bindir} +# rename binaries in order to avoid name clashes with other system packages +for f in {generate_parser,stage}; do + sed -i \ + -e "s|^#!%{_bindir}/env python$|#!%{_bindir}/python3|" \ + bin/$f + cp -v bin/$f %{buildroot}/%{_bindir}/parsley-$f + %python_clone -a %{buildroot}%{_bindir}/parsley-$f +done + +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +export LANG=en_US.UTF-8 +%pytest ometa/test +%pytest terml/test + +%post +%python_install_alternative parsley-stage +%python_install_alternative parsley-generate_parser + +%postun +%python_uninstall_alternative parsley-stage +%python_uninstall_alternative parsley-generate_parser + +%files %{python_files} +%license LICENSE +%doc NEWS PKG-INFO README +%python_alternative %{_bindir}/parsley-stage +%python_alternative %{_bindir}/parsley-generate_parser +%{python_sitelib}/parsley.py +%pycache_only %{python_sitelib}/__pycache__/parsley.*.py* +%{python_sitelib}/terml +%{python_sitelib}/ometa +%{python_sitelib}/parsley-%{version}.dist-info + +%changelog diff --git a/support-python312.patch b/support-python312.patch new file mode 100644 index 0000000..dfa2035 --- /dev/null +++ b/support-python312.patch @@ -0,0 +1,105 @@ +From f0ad2f6c0c7ce15336f6a3adc3708f4a5a9757c6 Mon Sep 17 00:00:00 2001 +From: Steve Kowalik +Date: Tue, 9 Jan 2024 14:27:30 +1100 +Subject: [PATCH] Fix deprecated assertions + +Python 3.1 and Python 3.2 deprecated a large amount of assertions, and +have finally been removed in Python 3.12. Move to the "new" function +names. + +Fixes #80 +--- + ometa/test/test_builder.py | 2 +- + ometa/test/test_protocol.py | 12 ++++++------ + ometa/test/test_pymeta.py | 4 ++-- + ometa/test/test_runtime.py | 4 ++-- + 4 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/ometa/test/test_builder.py b/ometa/test/test_builder.py +index b02656e..5cfbe72 100644 +--- a/ometa/test/test_builder.py ++++ b/ometa/test/test_builder.py +@@ -325,7 +325,7 @@ def test_markAsTree(self): + x = t.Rule("foo", t.List( + t.Exactly("x"))) + g = t.Grammar("TestGrammar", True, [x]) +- self.assert_("\n tree = True\n" in writePython(g, "")) ++ self.assertIn("\n tree = True\n", writePython(g, "")) + + + def test_rule(self): +diff --git a/ometa/test/test_protocol.py b/ometa/test/test_protocol.py +index a052da4..67001f8 100644 +--- a/ometa/test/test_protocol.py ++++ b/ometa/test/test_protocol.py +@@ -90,7 +90,7 @@ def test_parserPassed(self): + def test_connectionEstablishes(self): + """prepareParsing is called on the receiver after connection establishment.""" + self.protocol.makeConnection(None) +- self.assert_(self.protocol.receiver.connected) ++ self.assertTrue(self.protocol.receiver.connected) + + def test_basicParsing(self): + """Rules can be parsed multiple times for the same effect.""" +@@ -161,10 +161,10 @@ def test_parseFailure(self): + transport = FakeTransport() + self.protocol.makeConnection(transport) + self.protocol.dataReceived('b') +- self.failIfEqual(self.protocol.receiver.lossReason, None) ++ self.assertIsNotNone(self.protocol.receiver.lossReason) + self.assertTrue( + isinstance(self.protocol.receiver.lossReason.value, ParseError)) +- self.assert_(transport.aborted) ++ self.assertTrue(transport.aborted) + + def test_exceptionsRaisedFromReceiver(self): + """ +@@ -174,10 +174,10 @@ def test_exceptionsRaisedFromReceiver(self): + transport = FakeTransport() + self.protocol.makeConnection(transport) + self.protocol.dataReceived('e') +- self.failIfEqual(self.protocol.receiver.lossReason, None) ++ self.assertIsNotNone(self.protocol.receiver.lossReason) + self.assertTrue( + isinstance(self.protocol.receiver.lossReason.value, SomeException)) +- self.assert_(transport.aborted) ++ self.assertTrue(transport.aborted) + + def test_dataIgnoredAfterDisconnection(self): + """After connectionLost is called, all incoming data is ignored.""" +@@ -187,4 +187,4 @@ def test_dataIgnoredAfterDisconnection(self): + self.protocol.connectionLost(reason) + self.protocol.dataReceived('d') + self.assertEqual(self.protocol.receiver.lossReason, reason) +- self.assert_(not transport.aborted) ++ self.assertFalse(transport.aborted) +diff --git a/ometa/test/test_pymeta.py b/ometa/test/test_pymeta.py +index ed7e57f..e8a6b91 100644 +--- a/ometa/test/test_pymeta.py ++++ b/ometa/test/test_pymeta.py +@@ -1138,8 +1138,8 @@ def test_brokenGrammar(self): + """ + e = self.assertRaises(ParseError, OMeta.makeGrammar, grammar, + "Foo") +- self.assertEquals(e.position, 57) +- self.assertEquals(e.error, [("message", "end of input")]) ++ self.assertEqual(e.position, 57) ++ self.assertEqual(e.error, [("message", "end of input")]) + + + def test_subclassing(self): +diff --git a/ometa/test/test_runtime.py b/ometa/test/test_runtime.py +index 957f3bc..ecbbacb 100644 +--- a/ometa/test/test_runtime.py ++++ b/ometa/test/test_runtime.py +@@ -54,8 +54,8 @@ def test_exactlyFail(self): + data = "foo" + o = OMetaBase(data) + exc = self.assertRaises(ParseError, o.rule_exactly, "g") +- self.assertEquals(exc.args[1], expected(None, "g")) +- self.assertEquals(exc.args[0], 0) ++ self.assertEqual(exc.args[1], expected(None, "g")) ++ self.assertEqual(exc.args[0], 0) + + + From 1399b8c65146c82bb854281760c78688a632ddf30072def0dad4be07ed3529e2 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Mon, 14 Apr 2025 06:09:49 +0000 Subject: [PATCH 2/2] - Support both lowercased and unnormalized metadata directory names. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Parsley?expand=0&rev=21 --- python-Parsley.changes | 5 +++++ python-Parsley.spec | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/python-Parsley.changes b/python-Parsley.changes index 7d03a2d..dd6801a 100644 --- a/python-Parsley.changes +++ b/python-Parsley.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Apr 14 06:09:38 UTC 2025 - Steve Kowalik + +- Support both lowercased and unnormalized metadata directory names. + ------------------------------------------------------------------- Tue Mar 25 04:22:49 UTC 2025 - Steve Kowalik diff --git a/python-Parsley.spec b/python-Parsley.spec index 63feac3..97ce976 100644 --- a/python-Parsley.spec +++ b/python-Parsley.spec @@ -101,6 +101,6 @@ export LANG=en_US.UTF-8 %pycache_only %{python_sitelib}/__pycache__/parsley.*.py* %{python_sitelib}/terml %{python_sitelib}/ometa -%{python_sitelib}/parsley-%{version}.dist-info +%{python_sitelib}/[Pp]arsley-%{version}.dist-info %changelog