[packages/python3-autocommand] - new; async patch to adjust for python3.7+ with async being keyword

qboosh qboosh at pld-linux.org
Sun Mar 20 19:25:46 CET 2022


commit 69965b22b75dd5a30e06900ed05b20889dc90124
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun Mar 20 19:27:50 2022 +0100

    - new; async patch to adjust for python3.7+ with async being keyword

 python3-autocommand-async.patch | 44 +++++++++++++++++++++++++++++
 python3-autocommand.spec        | 62 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 106 insertions(+)
---
diff --git a/python3-autocommand.spec b/python3-autocommand.spec
new file mode 100644
index 0000000..067eabb
--- /dev/null
+++ b/python3-autocommand.spec
@@ -0,0 +1,62 @@
+#
+# Conditional build:
+%bcond_without	tests	# unit tests
+
+%define		module	template
+Summary:	Library to create a command-line program from a function
+Summary(pl.UTF-8):	Biblioteka do tworzenia programów linii poleceń z funkcji
+Name:		python3-autocommand
+Version:	2.2.1
+Release:	1
+License:	LGPL v3
+Group:		Libraries/Python
+#Source0Download: https://pypi.org/simple/autocommand/
+Source0:	https://files.pythonhosted.org/packages/source/a/autocommand/autocommand-%{version}.tar.gz
+# Source0-md5:	0695be9e3b7de1e589ee4cbf3734ad3d
+Patch0:		%{name}-async.patch
+URL:		https://pypi.org/project/autocommand/
+BuildRequires:	python3-modules >= 1:3.3
+BuildRequires:	python3-setuptools
+%if %{with tests}
+BuildRequires:	python3-pytest
+%endif
+BuildRequires:	rpm-pythonprov
+BuildRequires:	rpmbuild(macros) >= 1.714
+Requires:	python3-modules >= 1:3.3
+BuildArch:	noarch
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+A library to automatically generate and run simple argparse parsers
+from function signatures.
+
+%description -l pl.UTF-8
+Biblioteka do automatycznego generowania i uruchamiania prostych
+parserów argparse z sygnatur funkcji.
+
+%prep
+%setup -q -n autocommand-%{version}
+%patch0 -p1
+
+%build
+%py3_build
+
+%if %{with tests}
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+PYTHONPATH=$(pwd)/src \
+%{__python3} -m pytest test
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%py3_install
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc README.rst
+%{py3_sitescriptdir}/autocommand
+%{py3_sitescriptdir}/autocommand-%{version}-py*.egg-info
diff --git a/python3-autocommand-async.patch b/python3-autocommand-async.patch
new file mode 100644
index 0000000..45a563c
--- /dev/null
+++ b/python3-autocommand-async.patch
@@ -0,0 +1,44 @@
+--- autocommand-2.2.1/test/test_autoasync.py.orig	2017-08-15 20:59:41.000000000 +0200
++++ autocommand-2.2.1/test/test_autoasync.py	2022-03-20 19:25:33.588865758 +0100
+@@ -81,8 +81,8 @@ def test_basic_autoasync(context_loop):
+ 
+     @autoasync
+     def async_main():
+-        task1 = asyncio.async(coro_1())
+-        task2 = asyncio.async(coro_2())
++        task1 = asyncio.ensure_future(coro_1())
++        task2 = asyncio.ensure_future(coro_2())
+ 
+         result1 = yield from task1
+         result2 = yield from task2
+@@ -105,7 +105,7 @@ def test_custom_loop(context_loop, new_l
+         did_bad_coro_run = True
+         yield
+ 
+-    asyncio.async(bad_coro())
++    asyncio.ensure_future(bad_coro())
+ 
+     @autoasync(loop=new_loop)
+     @asyncio.coroutine
+@@ -173,8 +173,8 @@ def test_run_forever(context_loop):
+     @autoasync(forever=True)
+     @asyncio.coroutine
+     def async_main():
+-        asyncio.async(set_value_after(0.1))
+-        asyncio.async(stop_loop_after(0.2))
++        asyncio.ensure_future(set_value_after(0.1))
++        asyncio.ensure_future(stop_loop_after(0.2))
+         yield
+ 
+     async_main()
+@@ -197,8 +197,8 @@ def test_run_forever_func(context_loop):
+ 
+     @autoasync(forever=True)
+     def main_func():
+-        asyncio.async(set_value_after(0.1))
+-        asyncio.async(stop_loop_after(0.2))
++        asyncio.ensure_future(set_value_after(0.1))
++        asyncio.ensure_future(stop_loop_after(0.2))
+ 
+     main_func()
+     assert retrieved_value
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python3-autocommand.git/commitdiff/69965b22b75dd5a30e06900ed05b20889dc90124



More information about the pld-cvs-commit mailing list