forked from couchbase/couchbase-python-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
138 lines (119 loc) · 4.16 KB
/
Copy pathsetup.py
File metadata and controls
138 lines (119 loc) · 4.16 KB
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/usr/bin/env python
import sys
import os.path
import os
import platform
import warnings
import couchbase_version
try:
if os.environ.get('PYCBC_NO_DISTRIBUTE'):
raise ImportError()
from setuptools import setup, Extension
except ImportError:
from distutils.core import setup, Extension
extoptions = {}
pkgdata = {}
pkgversion = None
try:
couchbase_version.gen_version()
except couchbase_version.CantInvokeGit:
pass
pkgversion = couchbase_version.get_version()
LCB_NAME = None
if sys.platform != 'win32':
extoptions['libraries'] = ['couchbase']
if sys.platform == 'darwin' and sys.executable == '/usr/bin/python':
warnings.warn("Compiling on Mac Python. Using homebrew's Python is strongly recommended. Manually adding /usr/local prefix")
# Forcefully add library_dirs and include_dirs:
extoptions['library_dirs'] = ['/usr/local/lib']
extoptions['include_dirs'] = ['/usr/local/include']
else:
warnings.warn("I'm detecting you're running windows."
"You might want to modify "
"the 'setup.py' script to use appropriate paths")
# The layout i have here is an ..\lcb-winbuild, in which there are subdirs
# called 'x86' and 'x64', for x86 and x64 architectures. The default
# 'nmake install' on libcouchbase will install them to 'deps'
bit_type = platform.architecture()[0]
lcb_root = os.path.join(os.path.pardir, 'lcb-winbuild')
if bit_type.startswith('32'):
lcb_root = os.path.join(lcb_root, 'x86')
else:
lcb_root = os.path.join(lcb_root, 'x64')
lcb_root = os.path.join(lcb_root, 'deps')
extoptions['libraries'] = ['libcouchbase']
## Enable these lines for debug builds
#extoptions['extra_compile_args'] = ['/Zi']
#extoptions['extra_link_args'] = ['/DEBUG']
extoptions['library_dirs'] = [os.path.join(lcb_root, 'lib')]
extoptions['include_dirs'] = [os.path.join(lcb_root, 'include')]
extoptions['define_macros'] = [('_CRT_SECURE_NO_WARNINGS', 1)]
pkgdata['couchbase'] = ['libcouchbase.dll']
SOURCEMODS = [
'exceptions',
'ext',
'result',
'opresult',
'callbacks',
'cntl',
'convert',
'connection',
'store',
'constants',
'multiresult',
'miscops',
'typeutil',
'oputil',
'get',
'arithmetic',
'http',
'htresult',
'ctranscoder',
'observe',
'iops',
'connevents',
'pipeline',
os.path.join('viewrow', 'viewrow'),
os.path.join('contrib', 'jsonsl', 'jsonsl')
]
if platform.python_implementation() == 'PyPy':
SOURCEMODS.append('pypy-compat')
extoptions['sources'] = [ os.path.join("src", m + ".c") for m in SOURCEMODS ]
module = Extension('couchbase._libcouchbase', **extoptions)
setup(
name = 'couchbase',
version = pkgversion,
url="https://github.com/couchbase/couchbase-python-client",
author="Couchbase, Inc.",
author_email="mark.nunberg@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"],
ext_modules = [module],
packages = [
'couchbase',
'couchbase.views',
'couchbase.iops',
'couchbase.async',
'couchbase.tests',
'couchbase.tests.cases',
'gcouchbase',
'txcouchbase'
],
package_data = pkgdata,
tests_require = [ 'nose', 'testresources>=0.2.7' ],
test_suite = 'couchbase.tests.test_sync'
)