-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
59 lines (54 loc) · 1.46 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# -*- coding: utf-8 -*-
import sys
from setuptools import setup, find_packages
def build_native(spec):
name = 'jieba'
if sys.platform == 'darwin':
lib = 'lib%s.dylib' % name
elif sys.platform == 'win32':
lib = '%s.dll' % name
else:
lib = 'lib%s.so' % name
build = spec.add_external_build(
cmd=[
'c++',
'-shared',
'-std=c++11',
'-fPIC',
'-O3',
'-I./cppjieba/deps/',
'-I./cppjieba/include/',
'-I./include/',
'-o',
lib,
'lib/jieba.cc'
],
path='./cjieba/cabi/'
)
spec.add_cffi_module(
module_path='cjieba._native',
dylib=lambda: build.find_dylib('jieba', in_path='.'),
header_filename=lambda: build.find_header('jieba.h', in_path='include/'),
rtld_flags=['NOW', 'NODELETE']
)
setup(
name='cjieba',
version='0.4.4',
author='messense',
author_email='messense@icloud.com',
url='https://github.com/messense/cjieba-py',
description='Python cffi binding for cjieba',
packages=find_packages(exclude=('tests', 'tests.*')),
include_package_data=True,
package_data={
'cjieba': ['dict/*.utf8'],
},
zip_safe=False,
platforms='any',
setup_requires=['milksnake'],
install_requires=['milksnake'],
tests_require=['pytest>=3.6', 'pytest-cov'],
milksnake_tasks=[
build_native
]
)