sqlite3: optional loading (#5534)

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>
This commit is contained in:
Andy Kipp 2024-06-24 21:11:55 +02:00 committed by GitHub
parent 934351254a
commit 3e41a744d4
Failed to generate hash of commit

View file

@ -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":