diff --git a/python-transitions.changes b/python-transitions.changes index a3b3577..2b9a31e 100644 --- a/python-transitions.changes +++ b/python-transitions.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Tue Jan 11 21:26:06 UTC 2022 - Ben Greiner + +- Add support for Python 3.10 + * transitions-fixpy310.patch -- gh#pytransitions/transitions#559 +- Make sure the graphviz tests don't error out without an installed + font +- Clean obsolete python36 conditionals + ------------------------------------------------------------------- Sun Oct 24 17:34:22 UTC 2021 - Ben Greiner diff --git a/python-transitions.spec b/python-transitions.spec index b50bcb5..52205d5 100644 --- a/python-transitions.spec +++ b/python-transitions.spec @@ -1,7 +1,7 @@ # # spec file for package python-transitions # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # Copyright (c) 2019-2021, Martin Hauke # # All modifications and additions to the file contributed by third parties @@ -27,6 +27,8 @@ License: MIT Group: Development/Languages/Python URL: https://github.com/pytransitions/transitions Source: https://files.pythonhosted.org/packages/source/t/transitions/transitions-%{version}.tar.gz +# PATCH-FIX-UPSTREAM transitions-fixpy310.patch -- gh#pytransitions/transitions#559 +Patch0: transitions-fixpy310.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -36,17 +38,17 @@ Suggests: python-pytest BuildArch: noarch # SECTION test requirements BuildRequires: %{python_module dill} +BuildRequires: %{python_module graphviz} BuildRequires: %{python_module pycodestyle} +BuildRequires: %{python_module pygraphviz} BuildRequires: %{python_module pytest} BuildRequires: %{python_module six} -# pygraphviz dropped support for Python 3.6 -BuildRequires: %{python_module graphviz if (%python-base without python36-base)} -BuildRequires: %{python_module pygraphviz if (%python-base without python36-base)} %if %{with python2} BuildRequires: python2-mock %endif # png support for graphviz BuildRequires: graphviz-gnome +BuildRequires: noto-sans-fonts # /SECTION %python_subpackages @@ -55,7 +57,7 @@ The transitions package makes it convenient and relatively easy to define and implement FSMs (finite state machines) in python. %prep -%setup -q -n transitions-%{version} +%autosetup -p 1 -n transitions-%{version} find . -type f -exec chmod -x {} \; sed -i 's/\r$//' LICENSE Changelog.md README.md @@ -67,7 +69,7 @@ sed -i 's/\r$//' LICENSE Changelog.md README.md %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -%pytest --ignore tests/test_codestyle.py +%pytest -k "not TestCodeFormat" %files %{python_files} %license LICENSE diff --git a/transitions-fixpy310.patch b/transitions-fixpy310.patch new file mode 100644 index 0000000..630b602 --- /dev/null +++ b/transitions-fixpy310.patch @@ -0,0 +1,48 @@ + +Index: transitions-0.8.10/tests/test_async.py +=================================================================== +--- transitions-0.8.10.orig/tests/test_async.py ++++ transitions-0.8.10/tests/test_async.py +@@ -130,9 +130,6 @@ class TestAsync(TestTransitions): + self.assertTrue(mock.called) + + def test_multiple_models(self): +- loop = asyncio.new_event_loop() +- asyncio.set_event_loop(loop) +- + m1 = self.machine_cls(states=['A', 'B', 'C'], initial='A', name="m1") + m2 = self.machine_cls(states=['A'], initial='A', name='m2') + m1.add_transition(trigger='go', source='A', dest='B', before=self.cancel_soon) +@@ -141,12 +138,13 @@ class TestAsync(TestTransitions): + m1.add_transition(trigger='reset', source='C', dest='A') + m2.add_transition(trigger='go', source='A', dest=None, conditions=m1.is_C, after=m1.reset) + +- loop.run_until_complete(asyncio.gather(m1.go(), # should block before B +- self.call_delayed(m1.fix, 0.05), # should cancel task and go to C +- self.call_delayed(m1.check, 0.07), # should exit before m1.fix +- self.call_delayed(m2.go, 0.1))) # should cancel m1.fix +- assert m1.is_A() +- loop.close() ++ async def run(): ++ _ = asyncio.gather(m1.go(), # should block before B ++ self.call_delayed(m1.fix, 0.05), # should cancel task and go to C ++ self.call_delayed(m1.check, 0.07), # should exit before m1.fix ++ self.call_delayed(m2.go, 0.1)) # should cancel m1.fix ++ assert m1.is_A() ++ asyncio.run(run()) + + def test_async_callback_arguments(self): + +Index: transitions-0.8.10/transitions/extensions/states.py +=================================================================== +--- transitions-0.8.10.orig/transitions/extensions/states.py ++++ transitions-0.8.10/transitions/extensions/states.py +@@ -96,7 +96,7 @@ class Timeout(State): + """ + if self.timeout > 0: + timer = Timer(self.timeout, self._process_timeout, args=(event_data,)) +- timer.setDaemon(True) ++ timer.daemon = True + timer.start() + self.runner[id(event_data.model)] = timer + return super(Timeout, self).enter(event_data)