taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 3a93b7b405acd984e9da7349812c1328b6d1bbf5
parent 55ee50017ec306daa51378b98ba536482672e99d
Author: Florian Dold <florian@dold.me>
Date:   Thu,  9 Jan 2025 11:51:07 +0100

sqlite3 helper: be compatible with python3.11

Diffstat:
Mpackages/idb-bridge/taler-helper-sqlite3 | 28++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/packages/idb-bridge/taler-helper-sqlite3 b/packages/idb-bridge/taler-helper-sqlite3 @@ -1,14 +1,36 @@ #!/usr/bin/env python3 +# This file is part of GNU Taler +# (C) 2024 Taler Systems S.A. +# +# GNU Taler is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3, or (at your option) any later version. +# +# GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + import sqlite3 import sys import os +v = sys.version_info +if v.major < 3 or (v.major == 3 and v.minor < 11): + print( + "FATAL: python version >=3.11 required but running on", + sys.version, + file=sys.stderr, + ) + sys.exit(1) + print("started sqlite3 helper at", os.getcwd(), file=sys.stderr) enable_tracing = False - def trace(*args): if not enable_tracing: return @@ -222,7 +244,9 @@ while True: raise Exception("DB already connected") db_handle = pr.read_uint16() filename = pr.read_string() - dbconn = sqlite3.connect(filename, autocommit=True, isolation_level=None) + # This only works in python>=3.12 + # dbconn = sqlite3.connect(filename, autocommit=True, isolation_level=None) + dbconn = sqlite3.connect(filename, isolation_level=None) # Make sure we are not in a transaction dbconn.commit() db_handles[db_handle] = dbconn