-
Notifications
You must be signed in to change notification settings - Fork 7
/
setup.py
159 lines (145 loc) · 5.24 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/usr/bin/env python3
###
# CLOUDERA CDP Control (cdpctl)
#
# (C) Cloudera, Inc. 2021-2021
# All rights reserved.
#
# Applicable Open Source License: GNU AFFERO GENERAL PUBLIC LICENSE
#
# NOTE: Cloudera open source products are modular software products
# made up of hundreds of individual components, each of which was
# individually copyrighted. Each Cloudera open source product is a
# collective work under U.S. Copyright Law. Your license to use the
# collective work is as provided in your written agreement with
# Cloudera. Used apart from the collective work, this file is
# licensed for your use pursuant to the open source license
# identified above.
#
# This code is provided to you pursuant a written agreement with
# (i) Cloudera, Inc. or (ii) a third-party authorized to distribute
# this code. If you do not have a written agreement with Cloudera nor
# with an authorized and properly licensed third party, you do not
# have any rights to access nor to use this code.
#
# Absent a written agreement with Cloudera, Inc. (“Cloudera”) to the
# contrary, A) CLOUDERA PROVIDES THIS CODE TO YOU WITHOUT WARRANTIES OF ANY
# KIND; (B) CLOUDERA DISCLAIMS ANY AND ALL EXPRESS AND IMPLIED
# WARRANTIES WITH RESPECT TO THIS CODE, INCLUDING BUT NOT LIMITED TO
# IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND
# FITNESS FOR A PARTICULAR PURPOSE; (C) CLOUDERA IS NOT LIABLE TO YOU,
# AND WILL NOT DEFEND, INDEMNIFY, NOR HOLD YOU HARMLESS FOR ANY CLAIMS
# ARISING FROM OR RELATED TO THE CODE; AND (D)WITH RESPECT TO YOUR EXERCISE
# OF ANY RIGHTS GRANTED TO YOU FOR THE CODE, CLOUDERA IS NOT LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE OR
# CONSEQUENTIAL DAMAGES INCLUDING, BUT NOT LIMITED TO, DAMAGES
# RELATED TO LOST REVENUE, LOST PROFITS, LOSS OF INCOME, LOSS OF
# BUSINESS ADVANTAGE OR UNAVAILABILITY, OR LOSS OR CORRUPTION OF
# DATA.
#
# Source File Name: setup.py
###
"""The setup script."""
import os
import re
import sys
from typing import Any
from setuptools import find_packages, setup
install_requires = []
dependency_links = []
package_data = {}
VERSION_PATTERN = r"""
__version__\s=\s\"(?P<version>v?
(?:
(?:(?P<epoch>[0-9]+)!)? # epoch
(?P<release>[0-9]+(?:\.[0-9]+)*) # release segment
(?P<pre> # pre-release
[-_\.]?
(?P<pre_l>(a|b|c|rc|alpha|beta|pre|preview))
[-_\.]?
(?P<pre_n>[0-9]+)?
)?
(?P<post> # post release
(?:-(?P<post_n1>[0-9]+))
|
(?:
[-_\.]?
(?P<post_l>post|rev|r)
[-_\.]?
(?P<post_n2>[0-9]+)?
)
)?
(?P<dev> # dev release
[-_\.]?
(?P<dev_l>dev)
[-_\.]?
(?P<dev_n>[0-9]+)?
)?
)
(?:\+(?P<local>[a-z0-9]+(?:[-_\.][a-z0-9]+)*))? # local version
)\"
"""
def get_version() -> Any:
"""Get current version from code."""
path = ("cdpctl", "__version__.py")
return re.search(VERSION_PATTERN, read(*path), re.X).group("version")
# determine requirements
with open("requirements.txt") as f:
requirements = f.read()
for line in re.split("\n", requirements):
if line and line[0] == "#" and "#egg=" in line:
line = re.search(r"#\s*(.*)", line).group(1)
if line and line[0] != "#":
lib_stripped = line.split(" #")[0].strip()
install_requires.append(lib_stripped)
def read(*parts):
"""Read file."""
filename = os.path.join(os.path.abspath(os.path.dirname(__file__)), *parts)
sys.stdout.write(filename)
with open(filename, encoding="utf-8", mode="rt") as fp:
return fp.read()
with open("README.md") as readme_file:
readme = readme_file.read()
package_data = {
"": ["Makefile", "*.md", "bin"],
"cdpctl": [
"requirements*.txt",
"validation/validation.ini",
"templates/*.j2",
"validation/renderer/templates/*.j2",
"validation/**/issue_templates.yml",
"validation/issue_templates.yml",
"validation/resources/*",
],
}
if __name__ == "__main__":
setup(
author="Cloudera Labs",
author_email="[email protected]",
classifiers=[
"Development Status :: 4 - Beta",
"Framework :: AsyncIO",
"Intended Audience :: Developers",
"License :: OSI Approved :: License",
"Natural Language :: English",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Libraries :: Python Modules",
],
description="Cloudera CDP Cloud Resources Automation and Validation",
include_package_data=True,
install_requires=install_requires,
keywords=["cdpctl"],
license="license",
long_description_content_type="text/markdown",
long_description=readme,
name="cdpctl",
packages=find_packages(exclude=("tests", "tests.*")),
package_data=package_data,
scripts=["bin/cdpctl", "bin/cdpctl.bat"],
dependency_links=dependency_links,
test_suite="tests",
url="",
version=get_version(),
zip_safe=False,
)