forked from LinOTP/LinOTP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
286 lines (265 loc) · 7.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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# -*- coding: utf-8 -*-
#
# LinOTP - the open source solution for two factor authentication
# Copyright (C) 2010-2019 KeyIdentity GmbH
# Copyright (C) 2019- netgo software GmbH
#
# This file is part of LinOTP server.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public
# License, version 3, as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the
# GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
# E-mail: [email protected]
# Contact: www.linotp.org
# Support: www.linotp.de
#
import os
import sys
from setuptools import find_packages, setup
from setuptools.command.build_py import build_py
from linotp import __version__
# Taken from kennethreitz/requests/setup.py
package_directory = os.path.realpath(os.path.dirname(__file__))
# LinOTP runtime dependencies
# install with
# > pip install -e .
install_requirements = [
"Flask<2.2",
"Flask-Babel<3.0.0",
"flask-jwt-extended>=3",
"SQLAlchemy>=0.6,<1.4",
"flask-sqlalchemy",
"mako",
"beaker",
"docutils>=0.4",
"pycryptodomex",
"pyrad>=1.1",
"netaddr",
"qrcode>=2.4",
"configobj>=4.6.0",
"httplib2",
"requests",
"pillow",
"passlib",
"pysodium>=0.6.8",
# python-ldap needs libsasl2-dev and libldap2-dev system packages on
# debian buster to be installable via pip or install python-ldap via
# apt.
"python-ldap",
"bcrypt",
"cryptography",
"click",
"jsonschema",
]
# Requirements needed to run all the tests
# install with
# > pip install -e ".[test]"
test_requirements = [
"flask_testing",
"pytest",
"pytest-cov",
"pytest-freezegun",
"pytest-flask",
"pytest-mock",
"selenium<4.10.0",
"pytest-testconfig",
"mock",
"mockldap",
"freezegun",
"coverage",
"flaky",
]
# Additional packages useful to improve and guarantee
# code quality
# > pip install -e ".[code_quality]"
code_quality_requirements = [
"pylint",
"autopep8",
# black will go back to the latest version as soon as we
# switch to flask 2 (this is due to a conflict with click)
"black<=21.6b0",
"pre-commit",
"mypy",
"sqlalchemy-stubs",
"isort",
]
# packages needed to build the api documentation
# install with
# > pip install -e ".[apidocs]"
apidocs_requirements = ["Sphinx>4.0", "mock", "webhelpers2", "jinja2<=3.0.3"]
# packages needed during package build phase
setup_requirements = [
"Babel",
]
# Requirements for SMPP support.
# Use
# > pip install -e ".[smpp]"
# to install.
smpp_requirements = [
"smpplib",
]
# all packages that are required during development of LinOTP
# install with
# > pip install -e ".[develop]"
development_requirements = (
test_requirements
+ code_quality_requirements
+ apidocs_requirements
+ smpp_requirements
+ setup_requirements
)
# install with
# > pip install -e ".[postgres]"
postgres_requirements = [
# 'psycopg2' would require to compile some sources
"psycopg2-binary",
]
# install with
# > pip install -e ".[mysql]"
mysql_requirements = [
# 'mysql' driver is deprecated and replaced by 'mysqlclient'
"mysqlclient",
]
# Inspired by http://www.mattlayman.com/2015/i18n.html
class Build(build_py):
"""
Custom ``build_py`` command to ensure that mo files are always created.
"""
def run(self):
self.run_command("compile_catalog")
# build_py is an old style class so super cannot be used.
build_py.run(self)
with open(os.path.join(package_directory, "README.md"), encoding="utf-8") as f:
long_description = f.read()
setup(
name="LinOTP",
version=__version__,
description=(
"The Open Source solution for multi-factor authentication "
"(server component)"
),
long_description=long_description,
long_description_content_type="text/markdown",
author="KeyIdentity GmbH",
license="AGPL v3, (C) KeyIdentity GmbH",
author_email="[email protected]",
url="https://www.linotp.org",
setup_requires=setup_requirements,
install_requires=install_requirements,
extras_require={
"postgres": postgres_requirements,
"mysql": mysql_requirements,
"test": test_requirements,
"code_quality": code_quality_requirements,
"develop": development_requirements,
"apidocs": apidocs_requirements,
},
tests_require=test_requirements,
packages=find_packages(),
include_package_data=True,
package_data={
"linotp": [
"linotp/i18n/*/LC_MESSAGES/*.mo",
"linotp/dictionary",
]
},
scripts=[],
data_files=[
(
"etc/linotp/",
[
"config/linotpapp.wsgi",
"config/push-ca-bundle.crt",
"config/etc/linotp.cfg",
],
),
(
"etc/linotp/apache-site-includes/",
[
"config/apache-site-includes/README.txt",
],
),
(
"share/doc/linotp/examples",
[
"examples/apache-site.conf",
"examples/mailtemplate-authenticate.eml",
"examples/mailtemplate-enroll.eml",
"examples/mailtemplate-set-pin.eml",
],
),
(
"share/man/man1",
[
"man/man1/linotp-audit-janitor.1",
"man/man1/linotp-backup.1",
"man/man1/linotp-config.1",
"man/man1/linotp-init.1",
],
),
(
"share/linotp",
[
"config/share/linotp.cfg",
],
),
],
classifiers=[
"License :: OSI Approved :: GNU Affero General Public License v3",
"Programming Language :: Python",
"Programming Language :: Python :: 3.6",
"Topic :: Internet",
"Topic :: Security",
"Topic :: System :: Systems Administration :: Authentication/Directory"
"Framework :: Flask",
],
message_extractors={
"linotp": [
("**.py", "python", None),
("templates/**.mako", "mako", {"input_encoding": "utf-8"}),
("tokens/**.mako", "mako", {"input_encoding": "utf-8"}),
("public/js/manage.js", "javascript", {"input_encoding": "utf-8"}),
("public/js/tools.js", "javascript", {"input_encoding": "utf-8"}),
(
"public/js/selfservice.js",
"javascript",
{"input_encoding": "utf-8"},
),
(
"public/js/linotp_utils.js",
"javascript",
{"input_encoding": "utf-8"},
),
("public/**", "ignore", None),
]
},
zip_safe=False,
cmdclass={"build_py": Build},
entry_points={
"console_scripts": [
"linotp = linotp.cli:main", # LinOTP command line interface
],
"flask.commands": [
"audit = linotp.cli.audit_cmd:audit_cmds",
"admin = linotp.cli.admin_cmd:admin_cmds",
"backup = linotp.cli.mysql_cmd:backup_cmds",
"config = linotp.settings:config_cmds",
"dbsnapshot = linotp.cli.dbsnapshot_cmd:dbsnapshot_cmds",
"init = linotp.cli.init_cmd:init_cmds",
"ldap-test = linotp.useridresolver.LDAPIdResolver:ldap_test",
"support = linotp.cli.support_cmd:support_cmds",
"local-admins = linotp.cli.local_admins_cmd:local_admins_cmds",
],
},
)