-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
195 lines (161 loc) · 6.76 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
"""
passlib setup script
This script honors one environmental variable:
SETUP_TAG_RELEASE
if "yes" (the default), revision tag is appended to version.
for release, this is explicitly set to "no".
"""
#=============================================================================
# init script env -- ensure cwd = root of source dir
#=============================================================================
import os
root_dir = os.path.abspath(os.path.join(__file__, ".."))
os.chdir(root_dir)
#=============================================================================
# imports
#=============================================================================
import setuptools
import sys
#=============================================================================
# init setup options
#=============================================================================
opts = dict(
#==================================================================
# sources
#==================================================================
packages=setuptools.find_packages(root_dir),
package_data={
"passlib.tests": ["*.cfg"],
"passlib": ["_data/wordsets/*.txt"],
},
zip_safe=True,
#==================================================================
# metadata
#==================================================================
name="passlib",
# NOTE: 'version' set below
author="Eli Collins",
author_email="elic@assurancetechnologies.com",
license="BSD",
url="https://passlib.readthedocs.io",
# NOTE: 'download_url' set below
extras_require={
# extras w/ recommended library for argon2 backend
"argon2": "argon2_cffi>=18.2.0",
# extras w/ recommended library for bcrypt backend (if not present on host)
"bcrypt": "bcrypt>=3.1.0",
# extras to make (full) use of "passlib.totp" module
"totp": "cryptography",
# extras required to build passlib docs
# TODO: automate way to sync this w/ "./docs/requirements.txt"
"build_docs": [
"sphinx>=1.6",
"sphinxcontrib-fulltoc>=1.2.0",
"cloud_sptheme>=1.10.1",
],
},
# NOTE: 'python_requires' should be kept in sync w/ passlib.utils.compat's version check.
python_requires='>=3.5',
#==================================================================
# details
#==================================================================
description=
"comprehensive password hashing framework supporting over 30 schemes",
long_description="""\
Passlib is a password hashing library for Python 3, which provides
cross-platform implementations of over 30 password hashing algorithms, as well
as a framework for managing existing password hashes. It's designed to be useful
for a wide range of tasks, from verifying a hash found in /etc/shadow, to
providing full-strength password hashing for multi-user applications.
* See the `documentation <https://passlib.readthedocs.io>`_
for details, installation instructions, and examples.
* See the `homepage <https://foss.heptapod.net/python-libs/passlib/wikis/home>`_
for the latest news and more information.
* See the `changelog <https://passlib.readthedocs.io/en/stable/history>`_
for a description of what's new in Passlib.
All releases are signed with the gpg key
`4D8592DF4CE1ED31 <http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x4D8592DF4CE1ED31>`_.
""",
keywords="""\
password secret hash security
crypt md5-crypt
sha256-crypt sha512-crypt pbkdf2 argon2 scrypt bcrypt
apache htpasswd htdigest
totp 2fa
""",
classifiers="""\
Intended Audience :: Developers
License :: OSI Approved :: BSD License
Natural Language :: English
Operating System :: OS Independent
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: Jython
Programming Language :: Python :: Implementation :: PyPy
Topic :: Security :: Cryptography
Topic :: Software Development :: Libraries
""".splitlines(),
# TODO: add "Programming Language :: Python :: Implementation :: IronPython"
# (blocked by issue 34)
#==================================================================
# testing
#==================================================================
tests_require='nose >= 1.1',
test_suite='nose.collector',
#==================================================================
# custom setup
#==================================================================
script_args=sys.argv[1:],
cmdclass={},
)
#=============================================================================
# set version string
#=============================================================================
# pull version string from passlib
from passlib import __version__ as version
# append hg revision to builds
stamp_build = True # NOTE: modified by stamp_distutils_output()
if stamp_build:
from passlib._setup.stamp import (
as_bool, append_hg_revision, stamp_distutils_output,
install_build_py_exclude, set_command_options
)
# add HG revision to end of version
if as_bool(os.environ.get("SETUP_TAG_RELEASE", "yes")):
version = append_hg_revision(version)
# subclass build_py & sdist to rewrite source version string,
# and clears stamp_build flag so this doesn't run again.
stamp_distutils_output(opts, version)
# exclude 'passlib._setup' from builds, only needed for sdist
install_build_py_exclude(opts)
set_command_options(opts, "build_py",
exclude_packages=["passlib._setup"],
)
opts['version'] = version
#=============================================================================
# set release status
#=============================================================================
if '.dev' in version:
status = "Development Status :: 3 - Alpha"
elif '.post' in version:
status = "Development Status :: 4 - Beta"
else:
status = "Development Status :: 5 - Production/Stable"
# only list download url for final release
opts.update(
download_url=("https://pypi.python.org/packages/source/p/passlib/"
"passlib-" + version + ".tar.gz")
)
opts['classifiers'].append(status)
#=============================================================================
# run setup
#=============================================================================
setuptools.setup(**opts)
#=============================================================================
# eof
#=============================================================================