From cc61d1e2d5f6f7b2f82ea5ba92bc56781caeb6fcbb4c5067f0051faa625d1db9 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Mon, 19 Feb 2024 06:07:51 +0000 Subject: [PATCH] - Switch to autosetup macro. - Add patch no-more-imp.patch: * Use importlib, rather than imp. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pyeapi?expand=0&rev=13 --- no-more-imp.patch | 33 +++++++++++++++++++++++++++++++++ python-pyeapi.changes | 7 +++++++ python-pyeapi.spec | 6 ++++-- 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 no-more-imp.patch diff --git a/no-more-imp.patch b/no-more-imp.patch new file mode 100644 index 0000000..4b63b71 --- /dev/null +++ b/no-more-imp.patch @@ -0,0 +1,33 @@ +From d6fe3ef701e25ebb599bbfeec9d30649e37c9940 Mon Sep 17 00:00:00 2001 +From: Steve Kowalik +Date: Mon, 19 Feb 2024 16:50:47 +1100 +Subject: [PATCH] Switch to importlib for realoading + +Since 3.7, importlib has supported a reload method, and since 3.12 has +removed the imp module entirely, we should switch to using importlib. +--- + test/unit/test_client.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/test/unit/test_client.py b/test/unit/test_client.py +index 3472951..0136add 100644 +--- a/test/unit/test_client.py ++++ b/test/unit/test_client.py +@@ -32,7 +32,7 @@ + import sys + import os + import unittest +-import imp ++import importlib + + sys.path.append(os.path.join(os.path.dirname(__file__), '../lib')) + +@@ -227,7 +227,7 @@ class TestClient(unittest.TestCase): + def setUp(self): + if 'EAPI_CONF' in os.environ: + del os.environ['EAPI_CONF'] +- imp.reload(pyeapi.client) ++ importlib.reload(pyeapi.client) + + def test_load_config_for_connection_with_filename(self): + conf = get_fixture('eapi.conf') diff --git a/python-pyeapi.changes b/python-pyeapi.changes index 28410b3..156d834 100644 --- a/python-pyeapi.changes +++ b/python-pyeapi.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Feb 19 06:06:04 UTC 2024 - Steve Kowalik + +- Switch to autosetup macro. +- Add patch no-more-imp.patch: + * Use importlib, rather than imp. + ------------------------------------------------------------------- Mon Jan 1 20:15:51 UTC 2024 - Dirk Müller diff --git a/python-pyeapi.spec b/python-pyeapi.spec index 1bb2c00..009c43d 100644 --- a/python-pyeapi.spec +++ b/python-pyeapi.spec @@ -23,9 +23,11 @@ Version: 1.0.2 Release: 0 Summary: Python Client for eAPI License: BSD-3-Clause -Group: Development/Languages/Python URL: https://github.com/arista-eosplus/pyeapi Source: https://files.pythonhosted.org/packages/source/p/pyeapi/pyeapi-%{version}.tar.gz +# PATCH-FIX-UPSTREAM gh#arista-eosplus/pyeapi#292 +Patch0: no-more-imp.patch +BuildRequires: %{python_module base >= 3.7} BuildRequires: %{python_module netaddr} BuildRequires: %{python_module pip} BuildRequires: %{python_module pytest} @@ -51,7 +53,7 @@ implementation for working with the EOS configuration and is extensible for developing custom implementations. %prep -%setup -q -n pyeapi-%{version} +%autosetup -p1 -n pyeapi-%{version} %build %pyproject_wheel