-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
106 lines (91 loc) · 3.37 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
# Copyright 2017-2019 object_database Authors
#
# 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.
import pkg_resources
import setuptools
import os
from distutils.command.build_ext import build_ext
from distutils.extension import Extension
class BuildExtension(build_ext):
"""
Used for when numpy headers are needed during build.
Ensures that numpy will be installed before attempting
to include any of its libraries
"""
def run(self):
numpy_dir = pkg_resources.resource_filename("numpy", "core/include")
self.include_dirs.append(numpy_dir)
# The typed_python includes are inline.
# We want to find them as #include <typed_python/...>, so we kluge this
# together this way. Better to modify typed_python to export its
# includes in a more reasonable way.
tp_dir = pkg_resources.resource_filename("typed_python", ".")
dir_to_add = os.path.dirname(os.path.dirname(tp_dir))
self.include_dirs.append(dir_to_add)
build_ext.run(self)
extra_compile_args = [
"-O2",
"-fstack-protector-strong",
"-Wformat",
"-Wdate-time",
"-Werror=format-security",
"-std=c++14",
"-Wno-sign-compare",
"-Wno-narrowing",
"-Wno-sign-compare",
"-Wno-terminate",
"-Wno-reorder",
"-Wno-bool-compare",
"-Wno-cpp",
]
ext_modules = [
Extension(
"object_database._types",
sources=["object_database/all.cpp"],
define_macros=[("_FORTIFY_SOURCE", 2)],
extra_compile_args=extra_compile_args,
libraries=["ssl"],
)
]
def computeInstallRequires():
lines = [line.strip() for line in open("requirements.txt")]
return [line for line in lines if not line.startswith("#") and not line.startswith("-i")]
INSTALL_REQUIRES = computeInstallRequires()
setuptools.setup(
name="object_database",
version="0.2",
description="Distributed software transactional memory.",
author="Braxton Mckee",
author_email="[email protected]",
url="https://github.com/aprioriinvestments/object_database",
packages=setuptools.find_packages(),
cmdclass={"build_ext": BuildExtension},
ext_modules=ext_modules,
# setup_requires: replaced by build-system:requires in pyproject.toml
install_requires=INSTALL_REQUIRES,
# https://pypi.org/classifiers/
classifiers=[
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3 :: Only",
],
license="Apache Software License v2.0",
entry_points={
"console_scripts": [
"object_database_webtest=object_database.frontends.object_database_webtest:main",
"object_database_service_manager=object_database.frontends.service_manager:main",
"object_database_service_config=object_database.frontends.service_config:main",
]
},
include_package_data=True,
zip_safe=False,
)