-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·107 lines (89 loc) · 3.29 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
#!/usr/bin/env python
#
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not
# use this file except in compliance with the License. A copy of the License
# is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file 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 codecs
import os.path
import re
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
PY2 = sys.version_info[0] == 2
here = os.path.abspath(os.path.dirname(__file__))
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass into py.test")]
def __init__(self, *args, **kwargs):
super(PyTest, self).__init__(*args, **kwargs)
self.pytest_args = None
self.test_suite = None
def initialize_options(self):
TestCommand.initialize_options(self)
try:
from multiprocessing import cpu_count
self.pytest_args = ['-n', str(cpu_count()), '--boxed']
except (ImportError, NotImplementedError):
self.pytest_args = ['-n', '1', '--boxed']
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
import pytest
errno = pytest.main(self.pytest_args)
sys.exit(errno)
def read(*parts):
return codecs.open(os.path.join(here, *parts), 'r').read()
def find_version(*file_paths):
version_file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
def read_requirements(filename):
with open(filename) as requirements:
return [package.strip() for package in requirements]
packages = [
'amazondax',
'amazondax.generated',
# Both versions must be included since we don't know where it will end up running
'amazondax.grammar',
'amazondax.grammar2'
]
install_requires = read_requirements("requirements.txt")
tests_require = read_requirements('requirements-dev.txt')
setup_params = dict(
name='noq-dax-client',
version=find_version("amazondax", "__init__.py"),
author='Amazon Web Services',
packages=packages,
url='https://aws.amazon.com/dynamodb/dax/',
scripts=[],
license='Apache License 2.0',
description='Amazon DAX Client for Python',
long_description=open('README.rst').read(),
install_requires=install_requires,
tests_require=tests_require,
cmdclass={'test': PyTest},
python_requires='>=3.6',
classifiers=(
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
),
)
setup(**setup_params)