15
0

- 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.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Parsley?expand=0&rev=18
This commit is contained in:
2024-01-09 03:43:33 +00:00
committed by Git OBS Bridge
parent ac98209286
commit 6cd048ebb9
3 changed files with 128 additions and 6 deletions

View File

@@ -1,3 +1,12 @@
-------------------------------------------------------------------
Tue Jan 9 03:38:03 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- 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 <kastl@b1-systems.de>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-Parsley
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2013 LISA GmbH, Bingen, Germany.
#
# All modifications and additions to the file contributed by third parties
@@ -25,11 +25,15 @@ Version: 1.3
Release: 0
Summary: PEG algorithm based parser generator
License: MIT
URL: https://github.com/washort/parsley
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
@@ -52,17 +56,17 @@ as yacc, bison or PLY.
The binaries are prefixed with parsley-.
%prep
%setup -q -n %{modname}-%{version}
%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
%python_build
%pyproject_wheel
%install
export LANG=en_US.UTF-8
%python_install
%pyproject_install
mkdir %{buildroot}/%{_bindir}
# rename binaries in order to avoid name clashes with other system packages
for f in {generate_parser,stage}; do
@@ -93,6 +97,10 @@ export LANG=en_US.UTF-8
%doc NEWS PKG-INFO README
%python_alternative %{_bindir}/parsley-stage
%python_alternative %{_bindir}/parsley-generate_parser
%{python_sitelib}/*
%{python_sitelib}/parsley.py
%pycache_only %{python_sitelib}/__pycache__/parsley.*.py*
%{python_sitelib}/terml
%{python_sitelib}/ometa
%{python_sitelib}/Parsley-%{version}.dist-info
%changelog

105
support-python312.patch Normal file
View File

@@ -0,0 +1,105 @@
From f0ad2f6c0c7ce15336f6a3adc3708f4a5a9757c6 Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
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)