[PATCH 2/2] Don't require all Python database modules to be installed

Lukas Fleischer lfleischer at archlinux.org
Sat Nov 23 17:31:20 UTC 2019


We support multiple database backends. Don't require Python modules for
all backends to be installed.

Signed-off-by: Lukas Fleischer <lfleischer at archlinux.org>
---
 aurweb/db.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/aurweb/db.py b/aurweb/db.py
index 0b58197..c6d4de1 100644
--- a/aurweb/db.py
+++ b/aurweb/db.py
@@ -1,5 +1,12 @@
-import mysql.connector
-import sqlite3
+try:
+    import mysql.connector
+except ImportError:
+    pass
+
+try:
+    import sqlite3
+except ImportError:
+    pass
 
 import aurweb.config
 
-- 
2.24.0


More information about the aur-dev mailing list