[elbe-devel] [PATCH 1/6] elbepack: db: avoid warning about passlib importing crypt

Thomas Weißschuh thomas.weissschuh at linutronix.de
Tue Jul 2 09:53:31 CEST 2024


This is the same as the existing commit
ef9c08c74050 ("elbepack: xmlpreprocess: avoid warning about passlib importing crypt").
The logic could be shared but that would be a new file and the code in
db.py will go away soon anyways.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/db.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/elbepack/db.py b/elbepack/db.py
index 3de4b628afcf..ae7a67bb27c1 100644
--- a/elbepack/db.py
+++ b/elbepack/db.py
@@ -7,13 +7,18 @@ import errno
 import glob
 import os
 import re
+import warnings
 from contextlib import contextmanager
 from datetime import datetime
 from shutil import copyfile, copyfileobj, rmtree
 from threading import Thread
 from urllib.parse import quote
 
-from passlib.hash import pbkdf2_sha512
+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 pbkdf2_sha512
 
 from sqlalchemy import (
     Boolean,

-- 
2.45.2



More information about the elbe-devel mailing list