|
10 | 10 | from typing import Optional, NamedTuple, Dict, Any |
11 | 11 | from ctypes.util import find_library |
12 | 12 |
|
13 | | -HERE = os.path.dirname(__file__) |
| 13 | +_HERE = os.path.dirname(__file__) |
| 14 | +_YES = ("1", "true", "t", "yes", "y") |
14 | 15 |
|
15 | | -# One-time global initialization -- locate shared library file; preferably the copy installed with |
16 | | -# this package, otherwise look in the usual places. |
| 16 | +# Module initialization -- locate shared library file; preferably the copy installed with this |
| 17 | +# package, otherwise look in the usual places. |
17 | 18 | _DLL = None |
18 | | -if platform.system() == "Linux" and os.path.isfile(os.path.join(HERE, "libgenomicsqlite.so")): |
19 | | - _DLL = os.path.join(HERE, "libgenomicsqlite.so") |
| 19 | +if os.environ.get("GENOMICSQLITE_SYSTEM_LIBRARY", "").strip().lower() not in _YES: |
| 20 | + if platform.system() == "Linux" and os.path.isfile(os.path.join(_HERE, "libgenomicsqlite.so")): |
| 21 | + _DLL = os.path.join(_HERE, "libgenomicsqlite.so") |
20 | 22 | if not _DLL: |
21 | 23 | _DLL = find_library("genomicsqlite") |
22 | | -assert _DLL, "couldn't locate genomicsqlite shared-library file" |
| 24 | +assert _DLL, "Unable to locate genomicsqlite shared-library file" |
23 | 25 | # open a dummy connection to :memory: just for loading the extension. |
24 | 26 | _MEMCONN = sqlite3.connect(":memory:") |
25 | 27 | _MEMCONN.enable_load_extension(True) |
|
0 commit comments