-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
121 lines (103 loc) · 3.79 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/usr/bin/env python
import logging
import os
import couchbase_version
from cbuild_config import get_ext_options, couchbase_core, build_type
from cmodule import gen_distutils_build
from cmake_build import gen_cmake_build
try:
if os.environ.get('PYCBC_NO_DISTRIBUTE'):
raise ImportError()
from setuptools import setup, Extension
except ImportError:
from distutils.core import setup, Extension
import os
import sys
import platform
import itertools
lcb_min_version = (2, 9, 0)
try:
from lcb_version import get_lcb_min_version
lcb_min_version=get_lcb_min_version()
except:
lcb_min_version=(2,9,0)
if not os.path.exists("build"):
os.mkdir("build")
with open("build/lcb_min_version.h", "w+") as LCB_MIN_VERSION:
LCB_MIN_VERSION.write('\n'.join(
["#define LCB_MIN_VERSION 0x{}".format(''.join(map(lambda x: "{0:02d}".format(x), lcb_min_version))),
'#define LCB_MIN_VERSION_TEXT "{}"'.format('.'.join(map(str, lcb_min_version))),
'#define PYCBC_PACKAGE_NAME "{}"'.format(couchbase_core)]))
try:
couchbase_version.gen_version()
except couchbase_version.CantInvokeGit:
pass
pkgversion = couchbase_version.get_version()
def handle_build_type_and_gen_deps():
cmake_build = build_type in ['CMAKE', 'CMAKE_HYBRID']
print("Build type: {}, cmake:{}".format(build_type, cmake_build))
general_requires = open('requirements.txt').readlines()
extoptions, pkgdata=get_ext_options()
if cmake_build:
e_mods, extra_requires, cmdclass = gen_cmake_build(extoptions, pkgdata)
general_requires += extra_requires
else:
print("Legacy build")
e_mods, cmdclass = gen_distutils_build(extoptions, pkgdata)
setup_kw = {'ext_modules': e_mods}
logging.error(setup_kw)
setup_kw['setup_requires'] = general_requires
setup_kw['install_requires'] = general_requires
setup_kw['cmdclass'] = cmdclass
setup_kw['package_data'] = pkgdata
setup_kw['eager_resources'] = list(itertools.chain.from_iterable(pkgdata.values()))
return setup_kw
setup_kw = handle_build_type_and_gen_deps()
packages = {
'acouchbase',
'couchbase',
couchbase_core,
'couchbase_v2',
couchbase_core+'.views',
couchbase_core+'.iops',
couchbase_core+'.asynchronous',
'couchbase_v2.views',
'couchbase_v2.iops',
'couchbase_v2.asynchronous',
'couchbase_v2.tests',
'couchbase_v2.tests.cases',
'gcouchbase',
'txcouchbase',
'acouchbase',
}.union({
'acouchbase.tests',
'acouchbase.py34only'
} if sys.version_info >= (3, 4) else set())
setup(
name = 'couchbase',
version = pkgversion,
url="https://github.com/couchbase/couchbase-python-client",
author="Couchbase, Inc.",
author_email="PythonPackage@couchbase.com",
license="Apache License 2.0",
description="Python Client for Couchbase",
long_description=open("README.rst", "r").read(),
keywords=["couchbase", "nosql", "pycouchbase", "libcouchbase"],
classifiers=[
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: Apache Software License",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Database",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules"],
python_requires=(">=3" if platform.system().lower().startswith("win") else ">=2.7"),
packages = list(packages),
tests_require=['utilspie','nose', 'testresources>=0.2.7', 'basictracer==2.2.0'],
test_suite='couchbase_tests.test_sync',
**setup_kw
)