From 3e41a744d4362f25e0597c41f30df481f3355166 Mon Sep 17 00:00:00 2001 From: Andy Kipp Date: Mon, 24 Jun 2024 21:11:55 +0200 Subject: [PATCH] sqlite3: optional loading (#5534) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After testing xonsh on ALT linux (https://github.com/xonsh/xonsh/issues/5517#issuecomment-2187069017) I see that we need to make sqlite3 loading optional. ## For community ⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍 comment** --------- Co-authored-by: a <1@1.1> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- xonsh/history/main.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/xonsh/history/main.py b/xonsh/history/main.py index 4c41f0520..d40ec821a 100644 --- a/xonsh/history/main.py +++ b/xonsh/history/main.py @@ -15,9 +15,20 @@ from xonsh.built_ins import XSH from xonsh.history.base import History from xonsh.history.dummy import DummyHistory from xonsh.history.json import JsonHistory -from xonsh.history.sqlite import SqliteHistory -HISTORY_BACKENDS = {"dummy": DummyHistory, "json": JsonHistory, "sqlite": SqliteHistory} +HISTORY_BACKENDS = {"dummy": DummyHistory, "json": JsonHistory} + +try: + from xonsh.history.sqlite import SqliteHistory + + HISTORY_BACKENDS |= {"sqlite": SqliteHistory} +except Exception: + """ + On some linux systems (e.g. alt linux) sqlite3 is not installed + and it's hard to install it and maybe user can't install it. + We need to just go forward. + """ + pass def construct_history(backend=None, **kwargs) -> "History":