-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.py
75 lines (65 loc) · 2.24 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import os.path
import platform
from setuptools import Extension
from setuptools import setup
def read(name):
with open(os.path.join(os.path.dirname(__file__), name)) as f:
return f.read()
def _setup():
include_dirs = []
install_requires = read('requirements.txt').split('\n')
setup_requires = ['Cython'] + [
row for row in install_requires if row.startswith('numpy')]
try:
from Cython.Build import cythonize
except ImportError:
cythonize = None
try:
import numpy
include_dirs.append(numpy.get_include())
except ImportError:
pass
if platform.system() == 'Darwin':
extra_compile_args = ['-std=c++11']
else:
extra_compile_args = []
kwargs = dict(
name='embedded_jubatus',
version=read('VERSION').rstrip(),
description='embedded-jubatus-python is a Python bridge to call Jubatus Core library.',
long_description=read('README.rst'),
author='PFN & NTT',
author_email='[email protected]',
url='http://jubat.us',
download_url='http://pypi.python.org/pypi/embedded_jubatus',
license='LGPLv2',
classifiers=[
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'Topic :: Scientific/Engineering :: Information Analysis',
'License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
],
setup_requires=setup_requires,
install_requires=install_requires,
test_suite='tests',
)
kwargs['ext_modules'] = [Extension(
'embedded_jubatus', [
'src/embedded_jubatus.{}'.format(
'pyx' if cythonize else 'cpp'),
'src/_wrapper.cpp',
'src/_model.cpp'
],
include_dirs=include_dirs,
libraries=['jubatus_core', 'jubatus_util_text'],
language='c++',
extra_compile_args=extra_compile_args)
]
if cythonize:
kwargs['ext_modules'] = cythonize(kwargs['ext_modules'])
setup(**kwargs)
if __name__ == '__main__':
_setup()