|
1 | 1 | import sys
|
| 2 | +import os |
| 3 | + |
| 4 | +__version__ = "1.1.0" |
2 | 5 |
|
3 | 6 |
|
4 | 7 | def _using_cython_modules(): # pragma: no cover
|
5 | 8 | modules = ["cdc", "minhash", "simhash", "dct", "wtahash"]
|
6 | 9 | cython_modules = []
|
7 | 10 | for module in modules:
|
8 |
| - module_path = getattr(sys.modules.get(f"iscc_core.{module}"), "__file__", "") |
9 |
| - if module_path.endswith((".so", ".pyd")): |
10 |
| - cython_modules.append(module) |
11 |
| - print(f"Module {module} path: {module_path}") |
| 11 | + try: |
| 12 | + module_obj = __import__(f"iscc_core.{module}", fromlist=[module]) |
| 13 | + module_path = getattr(module_obj, "__file__", "") |
| 14 | + if module_path.endswith((".so", ".pyd")): |
| 15 | + cython_modules.append(module) |
| 16 | + print(f"Module {module} path: {module_path}") |
| 17 | + print(f"Module {module} type: {type(module_obj)}") |
| 18 | + except ImportError as e: |
| 19 | + print(f"Error importing {module}: {e}") |
12 | 20 | print(f"Cython modules: {cython_modules}")
|
| 21 | + print(f"iscc_core directory contents: {os.listdir(os.path.dirname(__file__))}") |
13 | 22 | return bool(cython_modules)
|
14 | 23 |
|
15 | 24 |
|
16 | 25 | USING_CYTHON = _using_cython_modules()
|
17 | 26 | print(f"USING_CYTHON: {USING_CYTHON}")
|
18 | 27 |
|
19 |
| -__version__ = "1.1.0" |
20 | 28 | from iscc_core.options import core_opts, conformant_options
|
21 | 29 |
|
22 | 30 | # Import full api to toplevel
|
23 | 31 | from iscc_core.conformance import *
|
24 | 32 | from iscc_core.constants import *
|
25 |
| - |
26 | 33 | from iscc_core.simhash import *
|
27 | 34 | from iscc_core.minhash import *
|
28 | 35 | from iscc_core.wtahash import *
|
29 | 36 | from iscc_core.dct import *
|
30 | 37 | from iscc_core.cdc import *
|
31 |
| - |
32 | 38 | from iscc_core.iscc_code import *
|
33 | 39 | from iscc_core.iscc_id import *
|
34 | 40 | from iscc_core.code_meta import *
|
|
0 commit comments