-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
138 lines (123 loc) · 4.35 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# ================================================== #
# SETUP #
# ================================================== #
# Author: Brady Hammond #
# Created: 01/21/2018 #
# Last Edited: 02/18/2018 #
# Last Edited By: Brady Hammond #
# ================================================== #
# IMPORTS #
# ================================================== #
from __future__ import generator_stop
from glob import glob
from os.path import basename
from os.path import dirname
from os.path import join
from os.path import relpath
from os.path import splitext
from setuptools import Extension
from setuptools import find_packages
from setuptools import setup
from setuptools.command.build_ext import build_ext
import sys
import io
import os
import re
try:
import Cython
except ImportError:
Cython = None
v = sys.version_info
if v < (3, 6):
msg = "FAIL: Requires Python 3.6 or later, but setup.py was run using {}.{}.{}"
print(msg.format(v.major, v.minor, v.micro))
print("NOTE: Installation failed. Run setup.py using python3")
sys.exit(1)
# ================================================== #
# FUNCTIONS #
# ================================================== #
def read(*names, **kwargs):
return io.open(
join(dirname(__file__), *names),
encoding=kwargs.get('encoding', 'utf8')
).read()
if 'TOXENV' in os.environ and 'SETUPPY_CFLAGS' in os.environ:
os.environ['CFLAGS'] = os.environ['SETUPPY_CFLAGS']
# ================================================== #
# CLASS DEFINITIONS #
# ================================================== #
class optional_build_ext(build_ext):
def run(self):
try:
build_ext.run(self)
except Exception as e:
self._unavailable(e)
self.extensions = []
def _unavailable(self, e):
print('*' * 80)
print('''WARNING:
An optional code optimization (C extension) could not be compiled.
Optimizations for this package will not be available!
''')
print('CAUSE:')
print('')
print(' ' + repr(e))
print('*' * 80)
setup(
name='reputation',
version='0.1.0',
license='Apache2',
description='Xaltry Project Backend',
long_description="Automated Reputation Service",
author='Brady M Hammond',
author_email='[email protected]',
url='https://github.com/BradyHammond/Reputation-API-2.0.git',
packages=find_packages('src'),
package_dir={'': 'src'},
py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')],
include_package_data=True,
zip_safe=False,
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache2 License',
'Operating System :: Unix',
'Operating System :: POSIX',
'Operating System :: Microsoft :: Windows',
'Programming Language :: Python',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Utilities',
],
keywords=[
],
install_requires=[
'click>=6.7', 'falcon>=1.4.1', 'ioflo>=1.6.8', 'libnacl>=1.5.1',
'ujson>=1.35', 'pytest-falcon>=0.4.2', 'arrow>=0.10.0', 'lmdb>=0.93',
'msgpack>=0.5.4', 'pytest>=3.4.0'
],
extras_require={
},
setup_requires=[
'cython',
] if Cython else [],
entry_points={
'console_scripts': [
'reputation = reputation.cli:main',
'reputationd = reputation.reputationd:main',
]
},
cmdclass={'build_ext': optional_build_ext},
ext_modules=[
Extension(
splitext(relpath(path, 'src').replace(os.sep, '.'))[0],
sources=[path],
include_dirs=[dirname(path)]
)
for root, _, _ in os.walk('src')
for path in glob(join(root, '*.pyx' if Cython else '*.c'))
],
)
# ================================================== #
# EOF #
# ================================================== #