-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetup.py
More file actions
55 lines (40 loc) · 1.3 KB
/
setup.py
File metadata and controls
55 lines (40 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import os
from skbuild import setup
PACKAGE_NAME = "dedup_cpp_core"
CORE_MODULE_NAME = "_core"
SRC_DIR = "src"
init_py_path = os.path.join(SRC_DIR, PACKAGE_NAME, "__init__.py")
os.makedirs(os.path.dirname(init_py_path), exist_ok=True)
EXPOSED_FUNCTIONS = [
"deduplicate_cpp",
"get_chunks_and_hashes",
"get_CDC_hashes_cpp",
"find_duplicates_cpp",
"get_document_simhash_performance",
"process_texts_for_signatures_cpp",
"clean_texts_with_bad_hashes_cpp"
]
with open(init_py_path, "w") as f:
f.write(f"# This file is automatically generated by setup.py\n\n")
f.write(f"from .{CORE_MODULE_NAME} import (\n")
for func in EXPOSED_FUNCTIONS:
f.write(f" {func},\n")
f.write(f")\n\n")
f.write(f"__all__ = [\n")
for func in EXPOSED_FUNCTIONS:
f.write(f" \"{func}\",\n")
f.write(f"]\n")
print(f"--- Generated __init__.py at: {init_py_path} ---")
setup(
name=PACKAGE_NAME,
version="0.1.0",
description="A C++ accelerated deduplication module",
author="Jinming Hu",
packages=[PACKAGE_NAME],
package_dir={'': SRC_DIR},
cmake_install_dir=os.path.join(SRC_DIR, PACKAGE_NAME),
package_data={PACKAGE_NAME: ['*.*']},
include_package_data=True,
cmake_minimum_required_version='3.12',
has_ext_modules=lambda: True,
)