forked from apache/kudu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
93 lines (81 loc) · 2.85 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
#!/usr/bin/env python
# Copyright 2014 Cloudera, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from Cython.Distutils import build_ext
from Cython.Build import cythonize
import Cython
if Cython.__version__ < '0.19.1':
raise Exception('Please upgrade to Cython 0.19.1 or newer')
import sys
from setuptools import setup
from distutils.extension import Extension
import os
MAJOR = 0
MINOR = 0
MICRO = 1
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
from distutils.command.clean import clean as _clean
class clean(_clean):
def run(self):
_clean.run(self)
for x in ['kudu/client.cpp']:
try:
os.remove(x)
except OSError:
pass
# If we're in the context of the Kudu git repository, build against the
# latest in-tree build artifacts
if 'KUDU_HOME' in os.environ and \
os.path.exists(os.path.join(os.environ['KUDU_HOME'], "build/latest")):
print >>sys.stderr, "Building from in-tree build artifacts"
kudu_include_dir = os.path.join(os.environ['KUDU_HOME'], 'src')
kudu_lib_dir = os.path.join(os.environ['KUDU_HOME'], 'build/latest/exported')
else:
if os.path.exists("/usr/local/include/kudu"):
prefix="/usr/local"
elif os.path.exists("/usr/include/kudu"):
prefix="/usr"
else:
print >>sys.stderr, "Cannot find installed kudu client."
sys.exit(1)
print >>sys.stderr, "Building from system prefix ", prefix
kudu_include_dir = prefix + "/include"
kudu_lib_dir = prefix + "/lib"
INCLUDE_PATHS = [kudu_include_dir]
LIBRARY_DIRS = [kudu_lib_dir]
RT_LIBRARY_DIRS = LIBRARY_DIRS
client_ext = Extension('kudu.client', ['kudu/client.pyx'],
libraries=['kudu_client'],
include_dirs=INCLUDE_PATHS,
library_dirs=LIBRARY_DIRS,
runtime_library_dirs=RT_LIBRARY_DIRS)
extensions = cythonize([client_ext])
setup(
name="python-kudu",
packages=["kudu"],
version=VERSION,
setup_requires=['nose>=1.0'],
package_data={'kudu': ['*.pxd', '*.pyx']},
ext_modules=extensions,
cmdclass = {
'clean': clean,
'build_ext': build_ext
},
install_requires=['cython >= 0.21'],
description="Cython wrapper for the Kudu C++ API",
license='Proprietary',
author="Wes McKinney",
maintainer_email="[email protected]",
test_suite="kudu.tests"
)