[elbe-devel] [PATCH] db: Ignore 2.0 warning

Bastian Germann bage at linutronix.de
Sat Apr 1 16:55:43 CEST 2023


sqlalchemy has published v2.0 and introduced warnings in v1.4.x about its
new API. This makes python3-elbe-buildenv fail on installation.

Ignore the warning and make sure that a sqlalchemy version < 2.0 is
installed.

Signed-off-by: Bastian Germann <bage at linutronix.de>
---
 debian/control | 2 +-
 elbepack/db.py | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/debian/control b/debian/control
index 47bb65280f..bdbb5d986c 100644
--- a/debian/control
+++ b/debian/control
@@ -120,7 +120,7 @@ Depends: ${misc:Depends},
   python3-mako,
   python3-parted,
   python3-passlib,
-  python3-sqlalchemy,
+  python3-sqlalchemy ( << 2),
   python3-debian,
   qemu-user-static,
   qemu-utils,
diff --git a/elbepack/db.py b/elbepack/db.py
index ecdd396dc6..0aa47d0270 100644
--- a/elbepack/db.py
+++ b/elbepack/db.py
@@ -12,6 +12,7 @@ import os
 import errno
 import re
 import glob
+import warnings
 
 from datetime import datetime
 from shutil import (rmtree, copyfile, copyfileobj)
@@ -27,7 +28,7 @@ from sqlalchemy import create_engine
 from sqlalchemy.orm import sessionmaker, scoped_session
 from sqlalchemy.orm import relationship
 from sqlalchemy.orm.exc import NoResultFound
-from sqlalchemy.exc import OperationalError
+from sqlalchemy.exc import MovedIn20Warning, OperationalError
 
 from passlib.hash import pbkdf2_sha512
 
@@ -35,6 +36,7 @@ from elbepack.elbeproject import ElbeProject
 from elbepack.elbexml import (ElbeXML, ValidationMode)
 from elbepack.dosunix import dos2unix
 
+warnings.simplefilter('ignore', category=MovedIn20Warning)
 Base = declarative_base()
 
 
-- 
2.39.2



More information about the elbe-devel mailing list