1
1
import setuptools
2
+ import os
2
3
from distutils .extension import Extension
3
4
4
5
import numpy as np
5
- from Cython .Build import cythonize
6
+
7
+ def is_source_release (path ):
8
+ return os .path .exists (os .path .join (path , "PKG-INFO" ))
6
9
7
10
def setup_package ():
11
+ root = os .path .abspath (os .path .dirname (__file__ ))
8
12
9
13
long_description = "pkuseg-python"
10
14
@@ -26,10 +30,15 @@ def setup_package():
26
30
include_dirs = [np .get_include ()],
27
31
),
28
32
]
33
+
34
+ if not is_source_release (root ):
35
+ from Cython .Build import cythonize
36
+ extensions = cythonize (extensions , annotate = True )
37
+
29
38
30
39
setuptools .setup (
31
40
name = "pkuseg" ,
32
- version = "0.0.22 " ,
41
+ version = "0.0.25 " ,
33
42
author = "Lanco" ,
34
43
author_email = "luoruixuan97@pku.edu.cn" ,
35
44
description = "A small package for Chinese word segmentation" ,
@@ -43,9 +52,9 @@ def setup_package():
43
52
"License :: Other/Proprietary License" ,
44
53
"Operating System :: OS Independent" ,
45
54
],
46
- install_requires = ["numpy>=1.16.0" ],
55
+ install_requires = ["cython" , " numpy>=1.16.0" ],
47
56
setup_requires = ["cython" , "numpy>=1.16.0" ],
48
- ext_modules = cythonize ( extensions , annotate = True ) ,
57
+ ext_modules = extensions ,
49
58
zip_safe = False ,
50
59
)
51
60
0 commit comments