forked from ContinuumIO/AccumuloAdapter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·95 lines (77 loc) · 2.95 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import os
import sys
from distutils.core import setup, Command
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy
import versioneer
class CleanInplace(Command):
user_options = []
def initialize_options(self):
self.cwd = None
def finalize_options(self):
self.cwd = os.getcwd()
def run(self):
files = ['accumuloadapter/core/AccumuloAdapter.cpp']
for file in files:
try:
os.remove(file)
except OSError:
pass
def setup_accumulo(include_dirs, lib_dirs):
src = ['accumuloadapter/core/AccumuloAdapter.pyx',
'accumuloadapter/core/accumulo_adapter.cpp',
'accumuloadapter/core/AccumuloProxy.cpp',
'accumuloadapter/core/proxy_types.cpp',
'accumuloadapter/core/proxy_constants.cpp']
extra_compile_args = []
if sys.platform == 'win32':
vc_version = os.getenv("VS_MAJOR")
libs = ['thrift',
'boost_thread-vc%s0-mt-1_61'%vc_version,
'boost_system-vc%s0-mt-1_61'%vc_version,
'boost_chrono-vc%s0-mt-1_61'%vc_version]
extra_compile_args.append('/D BOOST_ALL_DYN_LINK')
else:
libs = ['thrift']
#extra_compile_args = ['-std=c++11']
return Extension('accumuloadapter.core.AccumuloAdapter',
src,
language='c++',
include_dirs=include_dirs,
library_dirs=lib_dirs,
libraries=libs,
extra_compile_args=extra_compile_args)
def run_setup():
include_dirs = [os.path.join('accumuloadapter', 'lib'),
numpy.get_include()]
if sys.platform == 'win32':
include_dirs.append(os.path.join(sys.prefix, 'Library', 'include'))
else:
include_dirs.append(os.path.join(sys.prefix, 'include'))
lib_dirs = []
if sys.platform == 'win32':
lib_dirs.append(os.path.join(sys.prefix, 'Library', 'lib'))
else:
lib_dirs.append(os.path.join(sys.prefix, 'lib'))
ext_modules = []
packages = ['accumuloadapter', 'accumuloadapter.lib', 'accumuloadapter.tests']
ext_modules.append(setup_accumulo(include_dirs, lib_dirs))
packages.append('accumuloadapter.core')
versioneer.versionfile_source = 'accumuloadapter/_version.py'
versioneer.versionfile_build = 'accumuloadapter/_version.py'
versioneer.tag_prefix = ''
versioneer.parentdir_prefix = 'accumuloadapter-'
cmdclass = versioneer.get_cmdclass()
cmdclass['build_ext'] = build_ext
cmdclass['cleanall'] = CleanInplace
setup(name='accumuloadapter',
version = versioneer.get_version(),
description='optimized IO for NumPy/Blaze',
author='Continuum Analytics',
author_email='[email protected]',
ext_modules=ext_modules,
packages=packages,
cmdclass=cmdclass)
if __name__ == '__main__':
run_setup()