-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup.py
190 lines (163 loc) · 6.05 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
"""passlib setup script"""
#=========================================================
# 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 re
import sys
import time
py3k = (sys.version_info[0] >= 3)
try:
from setuptools import setup
has_distribute = True
except ImportError:
from distutils import setup
has_distribute = False
#=========================================================
# init setup options
#=========================================================
opts = { "cmdclass": { } }
args = sys.argv[1:]
#=========================================================
# 2to3 translation
#=========================================================
if py3k:
# monkeypatch preprocessor into lib2to3
from passlib._setup.cond2to3 import patch2to3
patch2to3()
# enable 2to3 translation in build_py
if has_distribute:
opts['use_2to3'] = True
else:
# if we can't use distribute's "use_2to3" flag,
# have to override build_py command
from distutils.command.build_py import build_py_2to3 as build_py
opts['cmdclass']['build_py'] = build_py
#=========================================================
#register docdist command (not required)
#=========================================================
try:
from passlib._setup.docdist import docdist
opts['cmdclass']['docdist'] = docdist
except ImportError:
pass
#=========================================================
# version string / datestamps
#=========================================================
from passlib import __version__ as VERSION
# if this is an hg checkout of passlib, add datestamp to version string.
# XXX: could check for *absence* of PKG-INFO instead
if os.path.exists(os.path.join(root_dir, "passlib.komodoproject")):
# check for --for-release flag indicating this isn't a snapshot
for_release = False
i = 0
while i < len(args):
v = args[i]
if v == '--for-release':
for_release = True
del args[i]
break
elif not v.startswith("-"):
break
i += 1
if for_release:
assert '.dev' not in VERSION and '.post' not in VERSION
else:
# add datestamp if doing a snapshot
dstr = time.strftime("%Y%m%d")
if VERSION.endswith(".dev0") or VERSION.endswith(".post0"):
VERSION = VERSION[:-1] + dstr
else:
assert '.dev' not in VERSION and '.post' not in VERSION
VERSION += ".post" + dstr
# subclass build_py & sdist so they rewrite passlib/__init__.py
# to have the correct version string
from passlib._setup.stamp import stamp_distutils_output
stamp_distutils_output(opts, VERSION)
#=========================================================
#static text
#=========================================================
SUMMARY = "comprehensive password hashing framework supporting over 20 schemes"
DESCRIPTION = """\
Passlib is a password hashing library for Python 2 & 3,
which provides cross-platform implementations of over 20
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 application.
* See the `online documentation <http://packages.python.org/passlib>`_
for details, installation instructions, and examples.
* See the `passlib homepage <http://passlib.googlecode.com>`_
for the latest news, more information, and additional downloads.
* See the `changelog <http://packages.python.org/passlib/history.html>`_
for description of what's new in Passlib.
All releases are signed with the gpg key
`4CE1ED31 <http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x4D8592DF4CE1ED31>`_.
"""
KEYWORDS = "password secret hash security crypt md5-crypt \
sha256-crypt sha512-crypt bcrypt apache htpasswd htdigest pbkdf2"
CLASSIFIERS = """\
Intended Audience :: Developers
License :: OSI Approved :: BSD License
Natural Language :: English
Operating System :: OS Independent
Programming Language :: Python :: 2.5
Programming Language :: Python :: 2.6
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Topic :: Security :: Cryptography
Topic :: Software Development :: Libraries
""".splitlines()
is_release = False
if '.dev' in VERSION:
CLASSIFIERS.append("Development Status :: 3 - Alpha")
elif '.post' in VERSION:
CLASSIFIERS.append("Development Status :: 4 - Beta")
else:
is_release = True
CLASSIFIERS.append("Development Status :: 5 - Production/Stable")
#=========================================================
#run setup
#=========================================================
# XXX: could omit 'passlib.setup' from eggs, but not sdist
setup(
#package info
packages = [
"passlib",
"passlib.ext",
"passlib.ext.django",
"passlib.handlers",
"passlib.tests",
"passlib.utils",
"passlib._setup",
],
package_data = { "passlib": ["*.cfg" ], "passlib.tests": ["*.cfg"] },
zip_safe=True,
#metadata
name = "passlib",
version = VERSION,
author = "Eli Collins",
author_email = "[email protected]",
license = "BSD",
url = "http://passlib.googlecode.com",
download_url =
("http://passlib.googlecode.com/files/passlib-" + VERSION + ".tar.gz")
if is_release else None,
description = SUMMARY,
long_description = DESCRIPTION,
keywords = KEYWORDS,
classifiers = CLASSIFIERS,
tests_require = 'nose >= 1.0',
test_suite = 'nose.collector',
#extra opts
script_args=args,
**opts
)
#=========================================================
#EOF
#=========================================================