28 lines
1.2 KiB
Diff
28 lines
1.2 KiB
Diff
diff -Naur geoalchemy2-0.17.1.orig/geoalchemy2/admin/dialects/sqlite.py geoalchemy2-0.17.1/geoalchemy2/admin/dialects/sqlite.py
|
|
--- geoalchemy2-0.17.1.orig/geoalchemy2/admin/dialects/sqlite.py 2025-02-19 18:15:51.981848600 +0300
|
|
+++ geoalchemy2-0.17.1/geoalchemy2/admin/dialects/sqlite.py 2025-02-19 18:25:01.252520600 +0300
|
|
@@ -1,6 +1,8 @@
|
|
"""This module defines specific functions for SQLite dialect."""
|
|
|
|
import os
|
|
+import sys
|
|
+import pathlib
|
|
from typing import Optional
|
|
|
|
from sqlalchemy import text
|
|
@@ -30,7 +32,13 @@
|
|
dbapi_conn: The DBAPI connection.
|
|
"""
|
|
if "SPATIALITE_LIBRARY_PATH" not in os.environ:
|
|
- raise RuntimeError("The SPATIALITE_LIBRARY_PATH environment variable is not set.")
|
|
+ mod_path = None
|
|
+ if os.name == "nt":
|
|
+ mod_path = pathlib.Path(sys.executable).parent.joinpath('mod_spatialite.dll')
|
|
+ if mod_path and mod_path.exists():
|
|
+ os.environ["SPATIALITE_LIBRARY_PATH"] = str(mod_path.absolute())
|
|
+ else:
|
|
+ raise RuntimeError("The SPATIALITE_LIBRARY_PATH environment variable is not set.")
|
|
dbapi_conn.enable_load_extension(True)
|
|
dbapi_conn.load_extension(os.environ["SPATIALITE_LIBRARY_PATH"])
|
|
dbapi_conn.enable_load_extension(False)
|