15
0
Files
python-netutils/use-legacycrypt-if-required.patch
Steve Kowalik 73a293bf4b - 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
2024-12-03 03:46:40 +00:00

95 lines
4.7 KiB
Diff

From 3517bfc545e529869d72e1ed0977674d42da7148 Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
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"]