[elbe-devel] [PATCH 4/9] elbepack: xmlpreprocess: avoid warning about passlib importing crypt
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Fri Jun 21 14:22:47 CEST 2024
passlib imports the crypt module which is deprecated.
But passlib also works fine without crypt available for our usecase.
Silence the warning.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/xmlpreprocess.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/elbepack/xmlpreprocess.py b/elbepack/xmlpreprocess.py
index f1c4c52d12bb..ea9868b11af3 100644
--- a/elbepack/xmlpreprocess.py
+++ b/elbepack/xmlpreprocess.py
@@ -10,6 +10,7 @@ import subprocess
import sys
import tempfile
import time
+import warnings
from optparse import OptionGroup
from urllib.error import HTTPError, URLError
from urllib.request import urlopen
@@ -17,7 +18,11 @@ from urllib.request import urlopen
from lxml import etree
from lxml.etree import Element, SubElement, XMLParser
-from passlib.hash import sha512_crypt
+with warnings.catch_warnings():
+ # passlib has code to handle absence of the crypt module and will work just
+ # fine for our usecase without it.
+ warnings.filterwarnings('ignore', "'crypt' is deprecated", DeprecationWarning)
+ from passlib.hash import sha512_crypt
from elbepack.archivedir import ArchivedirError, combinearchivedir
from elbepack.config import cfg
--
2.45.2
More information about the elbe-devel
mailing list