forked from lancopku/pkuseg-python
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetup.py
45 lines (37 loc) · 1.19 KB
/
setup.py
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
import setuptools
import os
from distutils.extension import Extension
import numpy as np
def is_source_release(path):
return os.path.exists(os.path.join(path, "PKG-INFO"))
def setup_package():
root = os.path.abspath(os.path.dirname(__file__))
extensions = [
Extension(
"spacy_pkuseg.inference",
["spacy_pkuseg/inference.pyx"],
include_dirs=[np.get_include()],
language="c++"
),
Extension(
"spacy_pkuseg.feature_extractor",
["spacy_pkuseg/feature_extractor.pyx"],
include_dirs=[np.get_include()],
),
Extension(
"spacy_pkuseg.postag.feature_extractor",
["spacy_pkuseg/postag/feature_extractor.pyx"],
include_dirs=[np.get_include()],
),
]
if not is_source_release(root):
from Cython.Build import cythonize
extensions = cythonize(extensions, annotate=True)
setuptools.setup(
name="spacy_pkuseg",
packages=setuptools.find_packages(),
package_data={"": ["*.txt*", "*.pkl", "*.npz", "*.pyx", "*.pxd"]},
ext_modules=extensions,
)
if __name__ == "__main__":
setup_package()