summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2016-12-05 12:49:52 -0500
committerEli Collins <elic@assurancetechnologies.com>2016-12-05 12:49:52 -0500
commita198470e350ffb0f308158f1e33bb567cd9df230 (patch)
tree586647ffdf6af95fc2c821f621f1f9ba78992acd
parentf5992a60837a4da87dd50843d7cb29ae8f9c9286 (diff)
downloadpasslib-a198470e350ffb0f308158f1e33bb567cd9df230.tar.gz
setup.py: reorganized content to simplified code
-rw-r--r--setup.py191
1 files changed, 105 insertions, 86 deletions
diff --git a/setup.py b/setup.py
index 1ea2b9d..1cf9598 100644
--- a/setup.py
+++ b/setup.py
@@ -16,52 +16,49 @@ os.chdir(root_dir)
#=============================================================================
# imports
#=============================================================================
-from setuptools import setup, find_packages
+import setuptools
import sys
#=============================================================================
# init setup options
#=============================================================================
-opts = {"cmdclass": {}}
-args = sys.argv[1:]
-
-#=============================================================================
-# register docdist command (not required)
-#=============================================================================
-try:
- from passlib._setup.docdist import docdist
- opts['cmdclass']['docdist'] = docdist
-except ImportError:
- pass
-
-#=============================================================================
-# version string / datestamps
-#=============================================================================
-
-# pull version string from passlib
-from passlib import __version__ as version
+opts = dict(
+ #==================================================================
+ # sources
+ #==================================================================
+ # XXX: could omit 'passlib._setup' for bdist_wheel & eggs
+ packages=setuptools.find_packages(root_dir),
+ package_data={
+ "passlib.tests": ["*.cfg"],
+ "passlib": ["_data/wordsets/*.txt"],
+ },
+ zip_safe=True,
-# 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
- )
+ #==================================================================
+ # metadata
+ #==================================================================
+ name="passlib",
+ # NOTE: 'version' set below
+ author="Eli Collins",
+ author_email="elic@assurancetechnologies.com",
+ license="BSD",
- # add HG revision to end of version
- if as_bool(os.environ.get("SETUP_TAG_RELEASE", "yes")):
- version = append_hg_revision(version)
+ url="https://bitbucket.org/ecollins/passlib",
+ # NOTE: 'download_url' set below
- # 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)
+ extras_require={
+ "argon2": "argon2_cffi>=16.2",
+ "bcrypt": "bcrypt>=3.1.0",
+ "totp": "cryptography",
+ },
-#=============================================================================
-# static text
-#=============================================================================
-SUMMARY = "comprehensive password hashing framework supporting over 30 schemes"
+ #==================================================================
+ # details
+ #==================================================================
+ description=
+ "comprehensive password hashing framework supporting over 30 schemes",
-DESCRIPTION = """\
+ long_description="""\
Passlib is a password hashing library for Python 2 & 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
@@ -79,86 +76,108 @@ providing full-strength password hashing for multi-user applications.
All releases are signed with the gpg key
`4D8592DF4CE1ED31 <http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x4D8592DF4CE1ED31>`_.
-"""
+""",
-KEYWORDS = """\
+ keywords="""\
password secret hash security
crypt md5-crypt
sha256-crypt sha512-crypt pbkdf2 argon2 scrypt bcrypt
apache htpasswd htdigest
totp 2fa
-"""
+""",
-CLASSIFIERS = """\
+ classifiers="""\
Intended Audience :: Developers
License :: OSI Approved :: BSD License
Natural Language :: English
Operating System :: OS Independent
+Programming Language :: Python :: 2
Programming Language :: Python :: 2.6
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
+Programming Language :: Python :: 3.3
+Programming Language :: Python :: 3.4
+Programming Language :: Python :: 3.5
+Programming Language :: Python :: 3.6
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: Jython
Programming Language :: Python :: Implementation :: PyPy
Topic :: Security :: Cryptography
Topic :: Software Development :: Libraries
-""".splitlines()
+""".splitlines(),
-# TODO: "Programming Language :: Python :: Implementation :: IronPython" -- issue 34
+ # TODO: add "Programming Language :: Python :: Implementation :: IronPython"
+ # (blocked by issue 34)
-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")
+ #==================================================================
+ # testing
+ #==================================================================
+ tests_require='nose >= 1.1',
+ test_suite='nose.collector',
+
+ #==================================================================
+ # custom setup
+ #==================================================================
+ script_args=sys.argv[1:],
+ cmdclass={},
+)
#=============================================================================
-# run setup
+# register docdist command (not required)
#=============================================================================
-# XXX: could omit 'passlib._setup' from eggs, but not sdist
-setup(
- # package info
- # XXX: could omit 'passlib._setup' for bdist_wheel
- packages=find_packages(root_dir),
- package_data={
- "passlib.tests": ["*.cfg"],
- "passlib": ["_data/wordsets/*.txt"],
- },
- zip_safe=True,
+try:
+ from passlib._setup.docdist import docdist
+ opts['cmdclass']['docdist'] = docdist
+except ImportError:
+ pass
- # metadata
- name="passlib",
- version=version,
- author="Eli Collins",
- author_email="elic@assurancetechnologies.com",
- license="BSD",
+#=============================================================================
+# set version string
+#=============================================================================
- url="https://bitbucket.org/ecollins/passlib",
- download_url=
- ("https://pypi.python.org/packages/source/p/passlib/passlib-" + version + ".tar.gz")
- if is_release else None,
+# pull version string from passlib
+from passlib import __version__ as version
- description=SUMMARY,
- long_description=DESCRIPTION,
- keywords=KEYWORDS,
- classifiers=CLASSIFIERS,
+# 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
+ )
- tests_require='nose >= 1.1',
- test_suite='nose.collector',
+ # add HG revision to end of version
+ if as_bool(os.environ.get("SETUP_TAG_RELEASE", "yes")):
+ version = append_hg_revision(version)
- extras_require={
- "argon2": "argon2_cffi>=16.2",
- "bcrypt": "bcrypt>=3.1.0",
- "totp": "cryptography",
- },
+ # 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)
- # extra opts
- script_args=args,
- **opts
-)
+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