generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 85
Expand file tree
/
Copy pathsetup.py
More file actions
149 lines (120 loc) · 4.37 KB
/
setup.py
File metadata and controls
149 lines (120 loc) · 4.37 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
139
140
141
142
143
144
145
146
147
148
149
#!/usr/bin/env python
import os
import sys
import typing
from setuptools import Command, find_packages, setup
from setuptools.command.install import install as InstallCommandBase
from setuptools.dist import Distribution
from wheel.bdist_wheel import bdist_wheel as BDistWheelCommandBase
class BasePytestCommand(Command):
user_options: typing.List = [] # type: ignore
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
self.run_tests()
def run_tests(self):
# This method should be overridden by subclasses
raise NotImplementedError("Subclasses must implement run_tests method")
class UnitTestCommand(BasePytestCommand):
def run_tests(self):
import pytest
src_dir = os.getenv("SRC_DIR", "")
if src_dir:
src_dir += "/"
args = [
"test/unit",
"--cov=redshift_connector",
"--cov-report=xml",
"--cov-report=html",
]
errno = pytest.main(args)
sys.exit(errno)
class IntegrationTestCommand(BasePytestCommand):
def run_tests(self):
import pytest
src_dir = os.getenv("SRC_DIR", "")
if src_dir:
src_dir += "/"
args = [
"test/integration",
"--cov=redshift_connector",
"--cov-report=xml",
"--cov-report=html",
]
errno = pytest.main(args)
sys.exit(errno)
class BinaryDistribution(Distribution):
def has_ext_modules(self):
return True
class InstallCommand(InstallCommandBase):
"""Override the installation dir."""
def finalize_options(self):
ret = InstallCommandBase.finalize_options(self)
self.install_lib = self.install_platlib
return ret
class BDistWheelCommand(BDistWheelCommandBase):
def finalize_options(self):
super().finalize_options()
self.root_is_pure = False
self.universal = True
def get_tag(self):
python, abi, plat = "py3", "none", "any"
return python, abi, plat
custom_cmds = {
"bdist_wheel": BDistWheelCommand,
"unit_test": UnitTestCommand,
"integration_test": IntegrationTestCommand,
}
if os.getenv("CUSTOMINSTALL", False):
custom_cmds["install"] = InstallCommand
elif "install" in custom_cmds:
del custom_cmds["install"]
# read the contents of your README file
this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, "README.rst"), encoding="utf-8") as f:
long_description = f.read()
exec(open("redshift_connector/version.py").read())
optional_deps = {
"full": ["numpy", "pandas"],
}
setup(
name="redshift_connector",
version=__version__, # type: ignore
description="Redshift interface library",
long_description=long_description,
long_description_content_type="text/x-rst",
author="Amazon Web Services",
author_email="redshift-drivers@amazon.com",
url="https://github.com/aws/amazon-redshift-python-driver",
license="Apache License 2.0",
python_requires=">=3.6",
install_requires=open("requirements.txt").read().strip().split("\n"),
extras_require=optional_deps,
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: Jython",
"Programming Language :: Python :: Implementation :: PyPy",
"Operating System :: OS Independent",
"Topic :: Database :: Front-Ends",
"Topic :: Software Development :: Libraries :: Python Modules",
],
keywords="redshift dbapi",
include_package_data=True,
package_data={"redshift-connector": ["*.py", "*.crt", "LICENSE", "NOTICE", "py.typed"]},
packages=find_packages(exclude=["test*"]),
cmdclass=custom_cmds, # type: ignore
)