From 73a293bf4bfdbbaba582cdd86d2207f768d7b2e515f531020cf5e0b886d3dbd0 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Tue, 3 Dec 2024 03:46:40 +0000 Subject: [PATCH] - Update to 1.10.0: * Added Functionality to ip_network filter to support method calls with kwargs. * Fix configuration parsers to allow newlines, no longer auto strip all newlines. * Added NIST URL creation and platform mapper. * Added DNA Center platform mappings. * Improved error message when duplicate line is parsed. - Add patch use-legacycrypt-if-required.patch: * Use the legacycrypt module where we need to. - Switch to autosetup macros. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-netutils?expand=0&rev=14 --- netutils-1.10.0.tar.gz | 3 + netutils-1.8.1.tar.gz | 3 - python-netutils.changes | 15 +++++ python-netutils.spec | 11 +++- use-legacycrypt-if-required.patch | 94 +++++++++++++++++++++++++++++++ 5 files changed, 121 insertions(+), 5 deletions(-) create mode 100644 netutils-1.10.0.tar.gz delete mode 100644 netutils-1.8.1.tar.gz create mode 100644 use-legacycrypt-if-required.patch diff --git a/netutils-1.10.0.tar.gz b/netutils-1.10.0.tar.gz new file mode 100644 index 0000000..af26ff9 --- /dev/null +++ b/netutils-1.10.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b7abccd3bf20fa70aeba656e311d620964d692eb1bfb5988b1dac116f07edd87 +size 1464585 diff --git a/netutils-1.8.1.tar.gz b/netutils-1.8.1.tar.gz deleted file mode 100644 index 80c30f2..0000000 --- a/netutils-1.8.1.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:47b2590dd799f1a369a6a51ab872d1ef0fdd326592950775a98e3573bc925cf0 -size 1449061 diff --git a/python-netutils.changes b/python-netutils.changes index 9ffae23..530f537 100644 --- a/python-netutils.changes +++ b/python-netutils.changes @@ -1,3 +1,18 @@ +------------------------------------------------------------------- +Tue Dec 3 03:45:37 UTC 2024 - Steve Kowalik + +- Update to 1.10.0: + * Added Functionality to ip_network filter to support method calls + with kwargs. + * Fix configuration parsers to allow newlines, no longer auto strip + all newlines. + * Added NIST URL creation and platform mapper. + * Added DNA Center platform mappings. + * Improved error message when duplicate line is parsed. +- Add patch use-legacycrypt-if-required.patch: + * Use the legacycrypt module where we need to. +- Switch to autosetup macros. + ------------------------------------------------------------------- Tue May 7 13:18:40 UTC 2024 - Dirk Müller diff --git a/python-netutils.spec b/python-netutils.spec index 21d42fa..5f7dd31 100644 --- a/python-netutils.spec +++ b/python-netutils.spec @@ -17,20 +17,26 @@ Name: python-netutils -Version: 1.8.1 +Version: 1.10.0 Release: 0 Summary: Common helper functions useful in network automation License: Apache-2.0 URL: https://netutils.readthedocs.io Source: https://github.com/networktocode/netutils/archive/refs/tags/v%{version}.tar.gz#/netutils-%{version}.tar.gz +# PATCH-FIX-UPSTREAM gh#networktocode/netutils#601 +Patch0: use-legacycrypt-if-required.patch BuildRequires: %{python_module base >= 3.7} BuildRequires: %{python_module jinja2} +BuildRequires: %{python_module legacycrypt if %python-base >= 3.13} BuildRequires: %{python_module pip} BuildRequires: %{python_module poetry-core >= 1} BuildRequires: %{python_module pytest} BuildRequires: %{python_module toml} BuildRequires: fdupes BuildRequires: python-rpm-macros +%if 0%{?python_version_nodots} >= 313 +Requires: python-legacycrypt +%endif Recommends: python-napalm BuildArch: noarch %python_subpackages @@ -39,7 +45,8 @@ BuildArch: noarch A Python library that is a collection of objects for common network automation tasks. %prep -%setup -q -n netutils-%{version} +%autosetup -p1 -n netutils-%{version} +chmod -x netutils/lib_helpers.py %build %pyproject_wheel diff --git a/use-legacycrypt-if-required.patch b/use-legacycrypt-if-required.patch new file mode 100644 index 0000000..5f29e17 --- /dev/null +++ b/use-legacycrypt-if-required.patch @@ -0,0 +1,94 @@ +From 3517bfc545e529869d72e1ed0977674d42da7148 Mon Sep 17 00:00:00 2001 +From: Steve Kowalik +Date: Tue, 3 Dec 2024 14:42:06 +1100 +Subject: [PATCH] Use legacycrypt where crypt isn't available + +Since Python 3.13 has removed the crypt module, add legacycrypt to the +requirements if we're using that version of Python, importing it if the +crypt module isn't found. + +Fixes #594 +--- + netutils/password.py | 6 ++++-- + poetry.lock | 17 ++++++++++++++--- + pyproject.toml | 1 + + 3 files changed, 19 insertions(+), 5 deletions(-) + +diff --git a/netutils/password.py b/netutils/password.py +index 5a9026a7..02062e8d 100644 +--- a/netutils/password.py ++++ b/netutils/password.py +@@ -1,7 +1,9 @@ + """Functions for working with Passwords.""" + +-# TODO: Swap out crypt prior to py3.13 +-import crypt # pylint: disable=deprecated-module ++try: ++ import crypt # pylint: disable=deprecated-module ++except ModuleNotFoundError: ++ import legacycrypt as crypt + import random + import secrets + import string +diff --git a/poetry.lock b/poetry.lock +index 15109fb5..b75099e6 100644 +--- a/poetry.lock ++++ b/poetry.lock +@@ -1,4 +1,4 @@ +-# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. ++# This file is automatically @generated by Poetry 1.8.4 and should not be changed by hand. + + [[package]] + name = "astroid" +@@ -774,6 +774,17 @@ six = "*" + transitions = "*" + yamlordereddictloader = "*" + ++[[package]] ++name = "legacycrypt" ++version = "0.3" ++description = "Wrapper to the POSIX crypt library call and associated functionality." ++optional = false ++python-versions = ">=3.5" ++files = [ ++ {file = "legacycrypt-0.3-py3-none-any.whl", hash = "sha256:b5e373506ccb442f8d715e29fa75f53a11bbec3ca0d7b63445f4dbb656555218"}, ++ {file = "legacycrypt-0.3.tar.gz", hash = "sha256:e76e7fd25666a451428b20d5afbbecf3654565b2e11511b53226be955c4d2292"}, ++] ++ + [[package]] + name = "lxml" + version = "5.2.1" +@@ -873,7 +884,6 @@ files = [ + {file = "lxml-5.2.1-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:9e2addd2d1866fe112bc6f80117bcc6bc25191c5ed1bfbcf9f1386a884252ae8"}, + {file = "lxml-5.2.1-cp37-cp37m-win32.whl", hash = "sha256:f51969bac61441fd31f028d7b3b45962f3ecebf691a510495e5d2cd8c8092dbd"}, + {file = "lxml-5.2.1-cp37-cp37m-win_amd64.whl", hash = "sha256:b0b58fbfa1bf7367dde8a557994e3b1637294be6cf2169810375caf8571a085c"}, +- {file = "lxml-5.2.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:3e183c6e3298a2ed5af9d7a356ea823bccaab4ec2349dc9ed83999fd289d14d5"}, + {file = "lxml-5.2.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:804f74efe22b6a227306dd890eecc4f8c59ff25ca35f1f14e7482bbce96ef10b"}, + {file = "lxml-5.2.1-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:08802f0c56ed150cc6885ae0788a321b73505d2263ee56dad84d200cab11c07a"}, + {file = "lxml-5.2.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0f8c09ed18ecb4ebf23e02b8e7a22a05d6411911e6fabef3a36e4f371f4f2585"}, +@@ -1789,6 +1799,7 @@ files = [ + {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, + {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, + {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, ++ {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, + {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, + {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, + {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, +@@ -2428,4 +2439,4 @@ optionals = ["jsonschema", "napalm"] + [metadata] + lock-version = "2.0" + python-versions = "^3.8" +-content-hash = "450d6722c6146d1680a5c710f1085d19f064d7392dc7a10f0b77fbda0b1dacc1" ++content-hash = "e87422d1f609f9d4fb697c6d5165c33269071e89d3780c003ee98689405871a2" +diff --git a/pyproject.toml b/pyproject.toml +index be2b2746..8daea416 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -29,6 +29,7 @@ include = [ + python = "^3.8" + napalm = {version = "^4.0.0", optional = true} + jsonschema = {version = "^4.17.3", optional = true} ++legacycrypt = {markers = "python_version >= \"3.13\"", version = "^0.3"} + + [tool.poetry.extras] + optionals = ["jsonschema", "napalm"]