From e3cbb7b02d72b6f4bec6516c2baef01d0f562630c84f63a707a2d40a2c855bdb Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Tue, 20 Aug 2024 04:29:15 +0000 Subject: [PATCH] - Add patch migrate-to-setup-method.patch: * Migrate to using setup_method(). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-librouteros?expand=0&rev=19 --- .gitattributes | 23 ++++++++ .gitignore | 1 + librouteros-3.2.1.tar.gz | 3 + migrate-to-setup-method.patch | 106 ++++++++++++++++++++++++++++++++++ python-librouteros.changes | 85 +++++++++++++++++++++++++++ python-librouteros.spec | 64 ++++++++++++++++++++ 6 files changed, 282 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 librouteros-3.2.1.tar.gz create mode 100644 migrate-to-setup-method.patch create mode 100644 python-librouteros.changes create mode 100644 python-librouteros.spec 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/librouteros-3.2.1.tar.gz b/librouteros-3.2.1.tar.gz new file mode 100644 index 0000000..cfdaa18 --- /dev/null +++ b/librouteros-3.2.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aec31ae8b7c88f5c248a18a5624b74d72c3e1f65e0cbaab0cee9151a9de5d393 +size 34545 diff --git a/migrate-to-setup-method.patch b/migrate-to-setup-method.patch new file mode 100644 index 0000000..478b723 --- /dev/null +++ b/migrate-to-setup-method.patch @@ -0,0 +1,106 @@ +From a9349dfdc1d8e7a915567766e0d18b07544323dc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C5=81ukasz=20Kostka?= +Date: Thu, 22 Jun 2023 14:55:54 +0200 +Subject: [PATCH] Migrate to setup_method + +https://docs.pytest.org/en/stable/deprecations.html#support-for-tests-written-for-nose +--- + tests/unit/test_api.py | 2 +- + tests/unit/test_connections.py | 2 +- + tests/unit/test_path.py | 2 +- + tests/unit/test_protocol.py | 6 +++--- + tests/unit/test_query.py | 4 ++-- + 5 files changed, 8 insertions(+), 8 deletions(-) + +Index: librouteros-3.2.1/tests/unit/test_api.py +=================================================================== +--- librouteros-3.2.1.orig/tests/unit/test_api.py ++++ librouteros-3.2.1/tests/unit/test_api.py +@@ -37,7 +37,7 @@ def test_compose_word(word_pair): + + class Test_Api: + +- def setup(self): ++ def setup_method(self): + self.api = Api(protocol=MagicMock()) + + @patch.object(Api, 'readResponse') +Index: librouteros-3.2.1/tests/unit/test_connections.py +=================================================================== +--- librouteros-3.2.1.orig/tests/unit/test_connections.py ++++ librouteros-3.2.1/tests/unit/test_connections.py +@@ -14,7 +14,7 @@ from librouteros.exceptions import ( + + class Test_SocketTransport: + +- def setup(self): ++ def setup_method(self): + self.transport = SocketTransport(sock=MagicMock(spec=socket)) + + def test_calls_socket_close(self): +Index: librouteros-3.2.1/tests/unit/test_path.py +=================================================================== +--- librouteros-3.2.1.orig/tests/unit/test_path.py ++++ librouteros-3.2.1/tests/unit/test_path.py +@@ -19,7 +19,7 @@ def test_api_path_returns_Path(): + + class Test_Path: + +- def setup(self): ++ def setup_method(self): + self.path = Path( + path='/interface', + api=MagicMock(), +Index: librouteros-3.2.1/tests/unit/test_protocol.py +=================================================================== +--- librouteros-3.2.1.orig/tests/unit/test_protocol.py ++++ librouteros-3.2.1/tests/unit/test_protocol.py +@@ -18,7 +18,7 @@ from librouteros.exceptions import ( + + class Test_Decoder: + +- def setup(self): ++ def setup_method(self): + self.decoder = Decoder() + self.decoder.encoding = 'ASCII' + +@@ -51,7 +51,7 @@ class Test_Decoder: + + class Test_Encoder: + +- def setup(self): ++ def setup_method(self): + self.encoder = Encoder() + self.encoder.encoding = 'ASCII' + +@@ -98,7 +98,7 @@ class Test_Encoder: + + class Test_ApiProtocol: + +- def setup(self): ++ def setup_method(self): + self.protocol = ApiProtocol( + transport=MagicMock(spec=SocketTransport), + encoding='utf-8', +Index: librouteros-3.2.1/tests/unit/test_query.py +=================================================================== +--- librouteros-3.2.1.orig/tests/unit/test_query.py ++++ librouteros-3.2.1/tests/unit/test_query.py +@@ -11,7 +11,7 @@ from librouteros.query import ( + + class Test_Query: + +- def setup(self): ++ def setup_method(self): + self.query = Query( + path=MagicMock(), + api=MagicMock(), +@@ -43,7 +43,7 @@ class Test_Query: + + class Test_Key: + +- def setup(self): ++ def setup_method(self): + self.key = Key(name='key_name', ) + + @pytest.mark.parametrize('param, expected', ( diff --git a/python-librouteros.changes b/python-librouteros.changes new file mode 100644 index 0000000..cce0bdc --- /dev/null +++ b/python-librouteros.changes @@ -0,0 +1,85 @@ +------------------------------------------------------------------- +Tue Aug 20 04:27:52 UTC 2024 - Steve Kowalik + +- Add patch migrate-to-setup-method.patch: + * Migrate to using setup_method(). + +------------------------------------------------------------------- +Tue Jan 23 06:26:04 UTC 2024 - Steve Kowalik + +- Skip a broken test. +- Switch to autosetup and pyproject macros. +- Stop using greedy globs in %files. + +------------------------------------------------------------------- +Thu Sep 29 14:49:07 UTC 2022 - Yogalakshmi Arunachalam + +- Update to version 3.2.1 + * Fix non ASCII API word encoding + +------------------------------------------------------------------- +Wed Mar 23 13:40:02 UTC 2022 - pgajdos@suse.com + +- python-mock is not required for build + +------------------------------------------------------------------- +Mon Feb 7 03:38:10 UTC 2022 - Steve Kowalik + +- Remove BuildRequires on chainmap, it's a builtin now. + +------------------------------------------------------------------- +Thu Nov 18 20:54:31 UTC 2021 - Martin Hauke + +- Update to version 3.2.0 + * Ignore character decoding errors + +------------------------------------------------------------------- +Fri Dec 18 22:31:34 UTC 2020 - Martin Hauke + +- Update to version 3.1.0 + * Add In operator + +------------------------------------------------------------------- +Mon Jul 20 20:44:13 UTC 2020 - Martin Hauke + +- Update to version 3.0.2 + * Fix generator yielding + +------------------------------------------------------------------- +Mon Apr 20 17:58:37 UTC 2020 - Martin Hauke + +- Update to version 3.0.1 + * Add typing annotations + +------------------------------------------------------------------- +Thu Nov 7 19:51:02 UTC 2019 - Martin Hauke + +- Update to version 3.0.0 + * Introduce query support. + * Path object for easy query and common operations. + * yield each item instead of returning tuple of items. Greatly + reduces memory usage. + * Drop pre python 3.6 support. + * Replace pylava with pylint. + * Add yapf formatter. + * Replace py.path with builtin pathlib. + * connect() accepts only one login_method parameter. + * Drop socker exceptions wrapping. + * Remove ConnectionError exception. + * Renamed LibError to LibRouterosError. + * Changed exceptions inheritance. + * Removed joinPath() +- Do not longer build against python2 (upstream dropped support) + +------------------------------------------------------------------- +Sat Oct 12 08:26:33 UTC 2019 - Martin Hauke + +- Update to version 2.4.0 +- Specfile cleanup +- Fix license +- Use tarball from github github + +------------------------------------------------------------------- +Mon Aug 7 10:06:30 UTC 2017 - mardnh@gmx.de + +- Initial package, version 1.0.2 diff --git a/python-librouteros.spec b/python-librouteros.spec new file mode 100644 index 0000000..c09529a --- /dev/null +++ b/python-librouteros.spec @@ -0,0 +1,64 @@ +# +# spec file for package python-librouteros +# +# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2017-2021, Martin Hauke +# +# 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/ +# + + +Name: python-librouteros +Version: 3.2.1 +Release: 0 +Summary: Python implementation of MikroTik RouterOS API +License: GPL-2.0-or-later +URL: https://github.com/luqasz/librouteros +Source: https://github.com/luqasz/librouteros/archive/%{version}.tar.gz#/librouteros-%{version}.tar.gz +# PATCH-FIX-UPSTREAM gh#luqasz/librouteros#a9349dfdc1d8e7a915567766e0d18b07544323dc +Patch0: migrate-to-setup-method.patch +BuildRequires: %{python_module pip} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +BuildArch: noarch +# SECTION test requirements +BuildRequires: %{python_module pytest} +# /SECTION +%python_subpackages + +%description +Python implementation of MikroTik RouterOS API. +http://wiki.mikrotik.com/wiki/API + +%prep +%autosetup -p1 -n librouteros-%{version} + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +# Broken test upstream +%pytest -k 'not test_rawCmd_calls_writeSentence' tests/unit + +%files %{python_files} +%license LICENSE +%doc CHANGELOG.rst README.rst +%{python_sitelib}/librouteros +%{python_sitelib}/librouteros-%{version}.dist-info + +%changelog