-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
238 lines (209 loc) · 6.83 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
"""
petclinic_flask
---------------
Python Flask Version of Spring Petclinic with SQLAlchemy, Celery et al
"""
import logging
import os
import re
import subprocess
import sys
from setuptools import find_packages
from setuptools import setup
HERE = os.path.dirname(os.path.abspath(__file__))
def get_version():
filename = os.path.join(HERE, "project", "__init__.py")
with open(filename) as f:
contents = f.read()
pattern = r"^__version__ = '(.*?)'$"
return re.search(pattern, contents, re.MULTILINE).group(1)
pip_requirements_in_dir = (
"requirements" + os.sep + "in"
)
pip_requirements_linux_dir = (
"requirements" + os.sep + "linux"
)
pip_requirements_windows_dir = (
"requirements" + os.sep + "windows"
)
readme = open("docs" + os.sep + "README.md").read()
history = open("docs" + os.sep + "CHANGES.md").read()
keywords_list = [
"data",
"python",
"flask",
"celery",
"sqlalchemy",
"mysql",
]
requires_build = [
"wheel",
"build",
"pip-tools",
"pre-commit",
"tox",
"toml",
"pipenv>=2022.1.8",
"virtualenv",
"pytoolbox",
"python-dotenv",
"Flask",
"urllib3>=1.26.5",
"Pillow>=9.0.1",
]
requires_test = [
"pytest",
"pytest-runner",
"pytest-flask",
"pytest-flask-sqlalchemy",
]
requires_docs = [
"Pallets-Sphinx-Themes",
"Sphinx",
"myst-parser",
"babel>=2.9.1",
"sqlalchemy-sphinx",
"sphinx-issues",
"sphinx-tabs",
"sphinx-sqlalchemy",
"sphinxcontrib-images",
"sphinxcontrib-srclinks",
"sphinxcontrib-gravizo",
"sphinxcontrib-needs",
"sphinxcontrib-plantuml",
"sphinxcontrib-sqltable",
"sphinxcontrib-websupport",
"sphinxcontrib-sadisplay",
"sphinxcontrib.sqltable",
"sqla2uml"
]
needs_pytest = {"pytest", "test", "ptr"}.intersection(sys.argv)
pytest_runner = ["pytest-runner"] if needs_pytest else []
dotenv_require = ["python-dotenv", "tqdm"]
requires_extras = {
"docs": requires_docs,
"tests": requires_test,
"dotenv": dotenv_require,
"all": [],
}
requires_dev = [
"Flask-SQLAlchemy",
"Flask-Migrate",
"Flask-Cors",
"Flask-BS4>=5.1.3.0",
"Flask-Admin",
"Flask-Login",
"Flask-WTF",
"Flask-Uploads",
"Flask-Babel",
"flask-login-dictabase-blueprint",
"SQLAlchemy",
"sqlalchemy-mixins",
"SQLAlchemy-Defaults",
"WTForms-Alchemy",
"wtforms-validators",
"ibm_db",
"psycopg2",
"mysql-connector-python",
"mysqldb-wrapper",
"mariadb",
"cx_Oracle",
"wget",
"email_validator",
] + pytest_runner
for reqs in requires_extras.values():
requires_extras["all"].extend(reqs)
keywords = ""
for kw in keywords_list:
keywords += " " + kw
packages = find_packages()
def run_compile_requirements():
u = os.uname()
if u.sysname == "Linux":
pip_requirements_dir = pip_requirements_linux_dir
my_cmd_list = [
["pip-compile", "-r", pip_requirements_in_dir + os.sep + "build.in"],
["pip-compile", "-r", pip_requirements_in_dir + os.sep + "docs.in"],
["pip-compile", "-r", pip_requirements_in_dir + os.sep + "tests.in"],
["pip-compile", "-r", pip_requirements_in_dir + os.sep + "dev.in"],
["pip-compile", "-r", pip_requirements_in_dir + os.sep + "linux.in"],
["pip", "install", "-r", pip_requirements_dir + os.sep + "build.in"],
["pip", "install", "-r", pip_requirements_dir + os.sep + "docs.in"],
["pip", "install", "-r", pip_requirements_dir + os.sep + "tests.in"],
["pip", "install", "-r", pip_requirements_dir + os.sep + "dev.in"],
["pip", "install", "-r", pip_requirements_dir + os.sep + "linux.in"],
]
else:
pip_requirements_dir = pip_requirements_windows_dir
my_cmd_list = [
["pip-compile", "-r", pip_requirements_in_dir + os.sep + "build.in"],
["pip-compile", "-r", pip_requirements_in_dir + os.sep + "docs.in"],
["pip-compile", "-r", pip_requirements_in_dir + os.sep + "tests.in"],
["pip-compile", "-r", pip_requirements_in_dir + os.sep + "dev.in"],
["pip-compile", "-r", pip_requirements_in_dir + os.sep + "windows.in"],
["pip", "install", "-r", pip_requirements_dir + os.sep + "build.in"],
["pip", "install", "-r", pip_requirements_dir + os.sep + "docs.in"],
["pip", "install", "-r", pip_requirements_dir + os.sep + "tests.in"],
["pip", "install", "-r", pip_requirements_dir + os.sep + "dev.in"],
["pip", "install", "-r", pip_requirements_dir + os.sep + "windows.in"],
]
for my_cmd in my_cmd_list:
return_code = subprocess.call(my_cmd, shell=True)
if return_code == 0:
logging.info("return_code: " + str(return_code))
else:
logging.error("return_code: " + str(return_code))
return None
def run_npm_install():
my_cmd_list = [
["npm", "-y"],
["npm", "install"],
]
for my_cmd in my_cmd_list:
return_code = subprocess.call(my_cmd, shell=True)
if return_code == 0:
logging.info("return_code: " + str(return_code))
else:
logging.error("return_code: " + str(return_code))
return None
setup(
name="petclinic_flask",
description="Python Flask Version of Spring Petclinic with SQLAlchemy, Celery et al.",
version="1.0.0",
url="https://github.com/Jakarta-EE-Petclinic/petclinic_flask.git",
author="Thomas Woehlke",
author_email="[email protected]",
license="GNU General Public License v3 (GPLv3)",
classifiers=[
"Environment :: Web Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows :: Windows 10",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Development Status :: 3 - Alpha",
"Natural Language :: German",
"Natural Language :: English",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Database :: Frontends",
"Framework :: Flask",
],
long_description=readme + history,
long_description_content_type="text/markdown",
keywords=keywords,
packages=packages,
zip_safe=False,
include_package_data=True,
entry_points={},
extras_require=requires_extras,
install_requires=requires_dev,
setup_requires=requires_build,
tests_require=requires_test,
python_requires=">= 3.9",
)