forked from Restream/reindexer-py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
92 lines (77 loc) · 3.01 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
import os
import sys
from multiprocessing import cpu_count
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext as build_ext_orig
if sys.version_info < (3, 6):
raise RuntimeError('Require Python 3.6 or greater')
PACKAGE_NAME = 'pyreindexer'
class CMakeExtension(Extension):
def __init__(self, name):
super().__init__(name, sources=[])
class build_ext(build_ext_orig):
def run(self):
for ext in self.extensions:
self.build_cmake(ext)
def build_cmake(self, ext):
cwd = os.path.abspath('')
build_temp = os.path.abspath(self.build_temp)
if not os.path.exists(build_temp):
os.makedirs(build_temp)
extension_dir = os.path.abspath(self.get_ext_fullpath(ext.name))
if not os.path.exists(extension_dir):
os.makedirs(extension_dir)
os.chdir(build_temp)
lib_dir = os.path.join(extension_dir, '..')
source_dir = os.path.join(cwd, PACKAGE_NAME)
self.spawn(['cmake', source_dir,
'-DCMAKE_BUILD_TYPE=RelWithDebInfo',
'-DCMAKE_CXX_STANDARD=17',
'-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + lib_dir,
'-DCMAKE_OSX_DEPLOYMENT_TARGET='])
if not self.dry_run:
self.spawn(['cmake', '--build', '.'])
os.chdir(cwd)
setup(name=PACKAGE_NAME,
version='0.2.27',
description='A connector that allows to interact with Reindexer',
url='https://github.com/Restream/reindexer-py',
author='Igor Tulmentyev',
author_email='[email protected]',
maintainer='Reindexer Team',
maintainer_email='[email protected]',
license='Apache License 2.0',
packages=[PACKAGE_NAME],
ext_modules=[CMakeExtension('rawpyreindexer')],
cmdclass={'build_ext': build_ext},
package_data={'pyreindexer': [
'CMakeLists.txt',
'lib/include/pyobjtools.h',
'lib/include/pyobjtools.cc',
'lib/include/queryresults_wrapper.h',
'lib/src/rawpyreindexer.h',
'lib/src/rawpyreindexer.cc',
'lib/src/reindexerinterface.h',
'lib/src/reindexerinterface.cc',
'example/main.py',
'tests/conftest.py',
'tests/test_data/constants.py',
'tests/test_data/__init__.py',
'tests/tests/test_sql.py',
'tests/tests/test_index.py',
'tests/tests/test_items.py',
'tests/tests/test_database.py',
'tests/tests/test_namespace.py',
'tests/tests/test_metadata.py',
'tests/tests/__init__.py',
'tests/helpers/namespace.py',
'tests/helpers/sql.py',
'tests/helpers/items.py',
'tests/helpers/index.py',
'tests/helpers/metadata.py',
'tests/helpers/log_helper.py',
'tests/helpers/__init__.py',
'tests/__init__.py'
]},
test_suite='tests', install_requires=['envoy==0.0.3', 'delegator==0.0.3', 'pytest==6.2.5', 'pyhamcrest==2.0.2']
)