Skip to content

Commit 24bb62c

Browse files
committed
More debug output
1 parent 75c1877 commit 24bb62c

File tree

3 files changed

+32
-13
lines changed

3 files changed

+32
-13
lines changed

build.py

+15-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
from setuptools import Extension
3-
4-
2+
from setuptools import Extension, setup
53
import os
64
import sys
75

@@ -38,8 +36,21 @@ def build(setup_kwargs):
3836
print(f"Number of extensions: {len(ext_modules)}")
3937
for ext in ext_modules:
4038
print(f"Extension: {ext.name}")
39+
40+
# Force the build process
41+
setup(**setup_kwargs)
42+
print("Build process completed")
43+
44+
# Check if the compiled modules exist
45+
for ext in ext_modules:
46+
module_name = ext.name.split(".")[-1]
47+
compiled_file = f"{module_name}.cp{sys.version_info.major}{sys.version_info.minor}-win_amd64.pyd"
48+
if os.path.exists(os.path.join("iscc_core", compiled_file)):
49+
print(f"Compiled module found: {compiled_file}")
50+
else:
51+
print(f"Compiled module not found: {compiled_file}")
4152
except Exception as e:
42-
print(f"Failed to prepare Cython modules: {e}")
53+
print(f"Failed to prepare or build Cython modules: {e}")
4354
print("Falling back to pure Python")
4455
else:
4556
print("Cython not available, using pure Python")

iscc_core/__init__.py

+13-7
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,40 @@
11
import sys
2+
import os
3+
4+
__version__ = "1.1.0"
25

36

47
def _using_cython_modules(): # pragma: no cover
58
modules = ["cdc", "minhash", "simhash", "dct", "wtahash"]
69
cython_modules = []
710
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}")
1220
print(f"Cython modules: {cython_modules}")
21+
print(f"iscc_core directory contents: {os.listdir(os.path.dirname(__file__))}")
1322
return bool(cython_modules)
1423

1524

1625
USING_CYTHON = _using_cython_modules()
1726
print(f"USING_CYTHON: {USING_CYTHON}")
1827

19-
__version__ = "1.1.0"
2028
from iscc_core.options import core_opts, conformant_options
2129

2230
# Import full api to toplevel
2331
from iscc_core.conformance import *
2432
from iscc_core.constants import *
25-
2633
from iscc_core.simhash import *
2734
from iscc_core.minhash import *
2835
from iscc_core.wtahash import *
2936
from iscc_core.dct import *
3037
from iscc_core.cdc import *
31-
3238
from iscc_core.iscc_code import *
3339
from iscc_core.iscc_id import *
3440
from iscc_core.code_meta import *

iscc_core/cdc.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# -*- coding: utf-8 -*-
22
"""Compatible with [fastcdc](https://pypi.org/project/fastcdc/)"""
3+
34
import io
45
from math import log2
56
from typing import Generator
7+
from iscc_core.options import core_opts
68
import iscc_core as ic
79

810

@@ -11,7 +13,7 @@
1113
]
1214

1315

14-
def alg_cdc_chunks(data, utf32, avg_chunk_size=ic.core_opts.data_avg_chunk_size):
16+
def alg_cdc_chunks(data, utf32, avg_chunk_size=core_opts.data_avg_chunk_size):
1517
# type: (ic.Data, bool, int) -> Generator[bytes, None, None]
1618
"""
1719
A generator that yields data-dependent chunks for `data`.
@@ -31,7 +33,7 @@ def alg_cdc_chunks(data, utf32, avg_chunk_size=ic.core_opts.data_avg_chunk_size)
3133
"""
3234

3335
stream = io.BytesIO(data)
34-
buffer = stream.read(ic.core_opts.io_read_size)
36+
buffer = stream.read(core_opts.io_read_size)
3537
if not buffer:
3638
yield b""
3739

0 commit comments

Comments
 (0)