From c22febb860d6b68dc1805dac553ab0885a0185d9432f7f343f0f6e6343c01361 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 19 Apr 2024 22:15:19 +0000 Subject: [PATCH] Accepting request 1168537 from home:mcalabkova:branches:devel:languages:python - Update to 2.7.1 * Added customer juniper paramiko module as a dependency which supported aes128 and aes257 cipher #1299 - Create no-six.patch to get rid of six dependency. OBS-URL: https://build.opensuse.org/request/show/1168537 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-junos-eznc?expand=0&rev=30 --- no-six.patch | 597 +++++++++++++++++++++++++++++++++ python-junos-eznc-2.7.0.tar.gz | 3 - python-junos-eznc-2.7.1.tar.gz | 3 + python-junos-eznc.changes | 8 + python-junos-eznc.spec | 6 +- 5 files changed, 611 insertions(+), 6 deletions(-) create mode 100644 no-six.patch delete mode 100644 python-junos-eznc-2.7.0.tar.gz create mode 100644 python-junos-eznc-2.7.1.tar.gz diff --git a/no-six.patch b/no-six.patch new file mode 100644 index 0000000..d5b7ed2 --- /dev/null +++ b/no-six.patch @@ -0,0 +1,597 @@ +Index: py-junos-eznc-2.7.1/lib/jnpr/junos/jxml.py +=================================================================== +--- py-junos-eznc-2.7.1.orig/lib/jnpr/junos/jxml.py ++++ py-junos-eznc-2.7.1/lib/jnpr/junos/jxml.py +@@ -1,7 +1,6 @@ + from ncclient import manager + from ncclient.xml_ import NCElement + from lxml import etree +-import six + + """ + These are Junos XML 'helper' definitions use for generic XML processing +@@ -226,8 +225,7 @@ def cscript_conf(reply): + + + # xslt to remove prefix like junos:ns +-strip_namespaces_prefix = six.b( +- """ ++strip_namespaces_prefix = b""" + + + +@@ -249,4 +247,3 @@ strip_namespaces_prefix = six.b( + + + """ +-) +Index: py-junos-eznc-2.7.1/lib/jnpr/junos/transport/tty_netconf.py +=================================================================== +--- py-junos-eznc-2.7.1.orig/lib/jnpr/junos/transport/tty_netconf.py ++++ py-junos-eznc-2.7.1/lib/jnpr/junos/transport/tty_netconf.py +@@ -11,23 +11,22 @@ from lxml.etree import XMLSyntaxError + from datetime import datetime, timedelta + from ncclient.operations.rpc import RPCReply, RPCError + from ncclient.xml_ import to_ele +-import six + from ncclient.transport.session import HelloHandler + + + class PY6: +- NEW_LINE = six.b("\n") +- EMPTY_STR = six.b("") +- NETCONF_EOM = six.b("]]>]]>") +- STARTS_WITH = six.b("" +- ), +- six.b(""), +- six.b( +- """ ++ b"", ++ b"", ++ b""" + + + urn:ietf:params:netconf:base:1.0 +@@ -114,9 +110,8 @@ class TestSerialWin(unittest.TestCase): + + 7478 + +-]]>]]>""" +- ), +- six.b(""), ++]]>]]>""", ++ b"", + ] + self.dev.open() + +@@ -144,7 +139,7 @@ class TestSerialWin(unittest.TestCase): + self.dev._tty.read = MagicMock() + self.dev._tty.rawwrite = MagicMock() + self.dev._tty.read.side_effect = [ +- six.b( ++ bytes( + '' + '0.120.080." + "06]]>]]>" ++ "ormation>]]>]]>", ++ 'utf-8' + ) + ] + res = self.dev.rpc.get_route_engine_information() +Index: py-junos-eznc-2.7.1/tests/unit/transport/test_tty_netconf.py +=================================================================== +--- py-junos-eznc-2.7.1.orig/tests/unit/transport/test_tty_netconf.py ++++ py-junos-eznc-2.7.1/tests/unit/transport/test_tty_netconf.py +@@ -7,7 +7,6 @@ from unittest.mock import MagicMock, pat + + from jnpr.junos.transport.tty_netconf import tty_netconf + +-import six + import os + import select + import socket +@@ -43,7 +42,7 @@ class TestTTYNetconf(unittest.TestCase): + @patch("jnpr.junos.transport.tty_netconf.timedelta") + def test_open_RuntimeError(self, mock_delta, mock_rcv): + mock_rcv.return_value = "]]>]]>" +- self.tty_net._tty.read.return_value = six.b("testing") ++ self.tty_net._tty.read.return_value = b"testing" + from datetime import timedelta + + mock_delta.return_value = timedelta(seconds=0.5) +@@ -56,7 +55,7 @@ class TestTTYNetconf(unittest.TestCase): + mock_rcv.return_value = "]]>]]>" + self.tty_net.rpc("get-interface-information") + self.tty_net._tty.rawwrite.assert_called_with( +- six.b("") ++ b"" + ) + + @patch("jnpr.junos.transport.tty_netconf.tty_netconf._receive") +@@ -103,7 +102,7 @@ class TestTTYNetconf(unittest.TestCase): + @patch("jnpr.junos.transport.tty_netconf.select.select") + def test_tty_netconf_receive_empty_line(self, mock_select): + rx = MagicMock() +- rx.read_until.side_effect = iter([six.b(""), six.b("]]>]]>")]) ++ rx.read_until.side_effect = iter([b"", b"]]>]]>"]) + mock_select.return_value = ([rx], [], []) + self.assertEqual(self.tty_net._receive().tag, "error-in-receive") + +@@ -117,7 +116,7 @@ class TestTTYNetconf(unittest.TestCase): + @patch("jnpr.junos.transport.tty_netconf.select.select") + def test_tty_netconf_receive_splited_eom(self, mock_select): + rx = MagicMock() +- rx.read_until.side_effect = iter([six.b(i) for i in ["testing]", "]>", "]]>"]]) ++ rx.read_until.side_effect = iter([i.encode('utf-8') for i in ["testing]", "]>", "]]>"]]) + mock_select.return_value = ([rx], [], []) + self.assertEqual(self.tty_net._receive().tag, "error-in-receive") + +@@ -126,30 +125,30 @@ class TestTTYNetconf(unittest.TestCase): + rx = MagicMock() + + rx.read_until.side_effect = iter( +- [six.b("ok"), six.b("\n]]>]]>")] ++ [b"ok", b"\n]]>]]>"] + ) + mock_select.return_value = ([rx], [], []) + self.assertEqual( +- self.tty_net._receive(), six.b("ok") ++ self.tty_net._receive(), b"ok" + ) + + @patch("jnpr.junos.transport.tty_netconf.select.select") + def test_tty_netconf_receive_XMLSyntaxError_eom_in_center(self, mock_select): + rx = MagicMock() + rx.read_until.side_effect = iter( +- [six.b("ok"), six.b("]]>]]>\ndummy")] ++ [b"ok", b"]]>]]>\ndummy"] + ) + mock_select.return_value = ([rx], [], []) +- self.assertEqual(self.tty_net._receive(), six.b("ok")) ++ self.assertEqual(self.tty_net._receive(), b"ok") + + @patch("jnpr.junos.transport.tty_netconf.select.select") + def test_tty_netconf_receive_xmn_error(self, mock_select): + rx = MagicMock() + rx.read_until.side_effect = iter( + [ +- six.b("ok"), +- six.b("\n\n"), +- six.b("]]>]]>\ndummy"), ++ b"ok", ++ b"\n\n", ++ b"]]>]]>\ndummy", + ] + ) + mock_select.return_value = ([rx], [], []) +Index: py-junos-eznc-2.7.1/tests/unit/transport/test_tty_telnet.py +=================================================================== +--- py-junos-eznc-2.7.1.orig/tests/unit/transport/test_tty_telnet.py ++++ py-junos-eznc-2.7.1/tests/unit/transport/test_tty_telnet.py +@@ -7,7 +7,6 @@ except ImportError: + import nose2 + from unittest.mock import MagicMock, patch + from jnpr.junos.transport.tty_telnet import Telnet +-import six + + + class TestTTYTelnet(unittest.TestCase): +@@ -62,7 +61,7 @@ class TestTTYTelnet(unittest.TestCase): + self.tel_conn._tn.expect.return_value = ( + None, + None, +- six.b("port already in use"), ++ b"port already in use", + ) + self.assertRaises(RuntimeError, self.tel_conn._login_state_machine) + +Index: py-junos-eznc-2.7.1/lib/jnpr/junos/device.py +=================================================================== +--- py-junos-eznc-2.7.1.orig/lib/jnpr/junos/device.py ++++ py-junos-eznc-2.7.1/lib/jnpr/junos/device.py +@@ -1,6 +1,5 @@ + # stdlib + import os +-import six + import types + import platform + import warnings +@@ -665,7 +664,7 @@ class _Connection(object): + command = command.strip() + # Get the equivalent RPC + rpc = self.display_xml_rpc(command) +- if isinstance(rpc, six.string_types): ++ if isinstance(rpc, str): + # No RPC is available. + return None + rpc_string = "rpc.%s(" % (rpc.tag.replace("-", "_")) +Index: py-junos-eznc-2.7.1/lib/jnpr/junos/utils/start_shell.py +=================================================================== +--- py-junos-eznc-2.7.1.orig/lib/jnpr/junos/utils/start_shell.py ++++ py-junos-eznc-2.7.1/lib/jnpr/junos/utils/start_shell.py +@@ -3,7 +3,6 @@ import re + import datetime + from jnpr.junos.utils.ssh_client import open_ssh_client + import subprocess +-import six + from threading import Thread + import time + +Index: py-junos-eznc-2.7.1/requirements.txt +=================================================================== +--- py-junos-eznc-2.7.1.orig/requirements.txt ++++ py-junos-eznc-2.7.1/requirements.txt +@@ -4,7 +4,6 @@ ncclient>=0.6.15 + scp>=0.7.0 + jinja2>=2.7.1 + PyYAML>=5.1 +-six + pyserial + yamlordereddictloader + pyparsing +Index: py-junos-eznc-2.7.1/tests/unit/facts/test_swver.py +=================================================================== +--- py-junos-eznc-2.7.1.orig/tests/unit/facts/test_swver.py ++++ py-junos-eznc-2.7.1/tests/unit/facts/test_swver.py +@@ -1,8 +1,6 @@ + __author__ = "Stacy Smith" + __credits__ = "Jeremy Schulman, Nitin Kumar" + +-import six +- + try: + import unittest2 as unittest + except: +@@ -13,9 +11,6 @@ from jnpr.junos.facts.swver import versi + + + class TestVersionInfo(unittest.TestCase): +- if six.PY2: +- assertCountEqual = unittest.TestCase.assertItemsEqual +- + def test_version_info_after_type_len_else(self): + self.assertEqual(version_info("12.1X46-D10").build, None) + +Index: py-junos-eznc-2.7.1/tests/unit/utils/test_scp.py +=================================================================== +--- py-junos-eznc-2.7.1.orig/tests/unit/utils/test_scp.py ++++ py-junos-eznc-2.7.1/tests/unit/utils/test_scp.py +@@ -1,5 +1,5 @@ + import sys +-from six import StringIO ++from io import StringIO + from contextlib import contextmanager + + import unittest +Index: py-junos-eznc-2.7.1/tests/unit/utils/test_sw.py +=================================================================== +--- py-junos-eznc-2.7.1.orig/tests/unit/utils/test_sw.py ++++ py-junos-eznc-2.7.1/tests/unit/utils/test_sw.py +@@ -1,7 +1,7 @@ + from __future__ import print_function + import os + import sys +-from six import StringIO ++from io import StringIO + + try: + import unittest2 as unittest diff --git a/python-junos-eznc-2.7.0.tar.gz b/python-junos-eznc-2.7.0.tar.gz deleted file mode 100644 index 5ac8b6d..0000000 --- a/python-junos-eznc-2.7.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fcf5a1d26476591be92275acd7a92fc1cff340c0a9c70da55eebfd9d4c07be5c -size 589369 diff --git a/python-junos-eznc-2.7.1.tar.gz b/python-junos-eznc-2.7.1.tar.gz new file mode 100644 index 0000000..a54a0ad --- /dev/null +++ b/python-junos-eznc-2.7.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c584ffe63b1c4e7d2f9313291a92cce3110997f51eb5c056e12ab7dcf9b497e5 +size 589560 diff --git a/python-junos-eznc.changes b/python-junos-eznc.changes index a8c5e0e..cc91466 100644 --- a/python-junos-eznc.changes +++ b/python-junos-eznc.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed Apr 17 12:37:53 UTC 2024 - Markéta Machová + +- Update to 2.7.1 + * Added customer juniper paramiko module as a dependency which + supported aes128 and aes257 cipher #1299 +- Create no-six.patch to get rid of six dependency. + ------------------------------------------------------------------- Mon Feb 12 11:01:26 UTC 2024 - Daniel Garcia diff --git a/python-junos-eznc.spec b/python-junos-eznc.spec index 0b61757..6d57f66 100644 --- a/python-junos-eznc.spec +++ b/python-junos-eznc.spec @@ -19,7 +19,7 @@ %define skip_python2 1 Name: python-junos-eznc -Version: 2.7.0 +Version: 2.7.1 Release: 0 Summary: Junos 'EZ' automation for non-programmers License: Apache-2.0 @@ -32,6 +32,8 @@ Patch1: python-junos-eznc-remove-yamlordereddictloader.patch Patch3: python-junos-eznc-no-mock.patch # PATCH-FIX-OPENSUSE python-311.patch gh#Juniper/py-junos-eznc#1236 Patch4: python-311.patch +# PATCH-FIX-UPSTREAM gh#Juniper/py-junos-eznc#1307 Don't require six +Patch5: no-six.patch BuildRequires: %{python_module Jinja2 >= 2.7.1} BuildRequires: %{python_module PyYAML >= 5.1} BuildRequires: %{python_module lxml >= 3.2.4} @@ -45,7 +47,6 @@ BuildRequires: %{python_module pytest-forked} BuildRequires: %{python_module pytest} BuildRequires: %{python_module scp >= 0.7.0} BuildRequires: %{python_module setuptools} -BuildRequires: %{python_module six} BuildRequires: %{python_module transitions} BuildRequires: %{python_module yamlloader} BuildRequires: fdupes @@ -58,7 +59,6 @@ Requires: python-paramiko >= 1.15.2 Requires: python-pyparsing Requires: python-pyserial Requires: python-scp >= 0.7.0 -Requires: python-six Requires: python-transitions BuildArch: noarch %python_subpackages