summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py132
1 files changed, 61 insertions, 71 deletions
diff --git a/setup.py b/setup.py
index 6de648f..1db9191 100644
--- a/setup.py
+++ b/setup.py
@@ -21,7 +21,7 @@ CFFI_MODULES = [
# Manually extract the __about__
__about__ = {}
with open("src/bcrypt/__about__.py") as fp:
- exec(fp.read(), __about__)
+ exec (fp.read(), __about__)
if platform.python_implementation() == "PyPy":
@@ -40,6 +40,7 @@ class PyTest(test):
def run_tests(self):
import pytest
+
errno = pytest.main(self.test_args)
sys.exit(errno)
@@ -70,47 +71,52 @@ def keywords_with_side_effects(argv):
.. _setup.py script: https://github.com/scipy/scipy/blob/master/setup.py
"""
no_setup_requires_arguments = (
- '-h', '--help',
- '-n', '--dry-run',
- '-q', '--quiet',
- '-v', '--verbose',
- '-V', '--version',
- '--author',
- '--author-email',
- '--classifiers',
- '--contact',
- '--contact-email',
- '--description',
- '--egg-base',
- '--fullname',
- '--help-commands',
- '--keywords',
- '--licence',
- '--license',
- '--long-description',
- '--maintainer',
- '--maintainer-email',
- '--name',
- '--no-user-cfg',
- '--obsoletes',
- '--platforms',
- '--provides',
- '--requires',
- '--url',
- 'clean',
- 'egg_info',
- 'register',
- 'sdist',
- 'upload',
+ "-h",
+ "--help",
+ "-n",
+ "--dry-run",
+ "-q",
+ "--quiet",
+ "-v",
+ "--verbose",
+ "-V",
+ "--version",
+ "--author",
+ "--author-email",
+ "--classifiers",
+ "--contact",
+ "--contact-email",
+ "--description",
+ "--egg-base",
+ "--fullname",
+ "--help-commands",
+ "--keywords",
+ "--licence",
+ "--license",
+ "--long-description",
+ "--maintainer",
+ "--maintainer-email",
+ "--name",
+ "--no-user-cfg",
+ "--obsoletes",
+ "--platforms",
+ "--provides",
+ "--requires",
+ "--url",
+ "clean",
+ "egg_info",
+ "register",
+ "sdist",
+ "upload",
)
def is_short_option(argument):
"""Check whether a command line argument is a short option."""
- return len(argument) >= 2 and argument[0] == '-' and argument[1] != '-'
+ return len(argument) >= 2 and argument[0] == "-" and argument[1] != "-"
def expand_short_options(argument):
"""Expand combined short options into canonical short options."""
- return ('-' + char for char in argument[1:])
+ return ("-" + char for char in argument[1:])
def argument_without_setup_requirements(argv, i):
"""Check whether a command line argument needs setup requirements."""
@@ -118,21 +124,24 @@ def keywords_with_side_effects(argv):
# Simple case: An argument which is either an option or a command
# which doesn't need setup requirements.
return True
- elif (is_short_option(argv[i]) and
- all(option in no_setup_requires_arguments
- for option in expand_short_options(argv[i]))):
+ elif is_short_option(argv[i]) and all(
+ option in no_setup_requires_arguments
+ for option in expand_short_options(argv[i])
+ ):
# Not so simple case: Combined short options none of which need
# setup requirements.
return True
- elif argv[i - 1:i] == ['--egg-base']:
+ elif argv[i - 1 : i] == ["--egg-base"]:
# Tricky case: --egg-info takes an argument which should not make
# us use setup_requires (defeating the purpose of this code).
return True
else:
return False
- if all(argument_without_setup_requirements(argv, i)
- for i in range(1, len(argv))):
+ if all(
+ argument_without_setup_requirements(argv, i)
+ for i in range(1, len(argv))
+ ):
return {
"cmdclass": {
"build": DummyCFFIBuild,
@@ -143,16 +152,16 @@ def keywords_with_side_effects(argv):
else:
return {
"setup_requires": [CFFI_DEPENDENCY],
- "cmdclass": {
- "test": PyTest,
- },
+ "cmdclass": {"test": PyTest},
"cffi_modules": CFFI_MODULES,
}
-setup_requires_error = ("Requested setup command that needs 'setup_requires' "
- "while command line arguments implied a side effect "
- "free command or option.")
+setup_requires_error = (
+ "Requested setup command that needs 'setup_requires' "
+ "while command line arguments implied a side effect "
+ "free command or option."
+)
class DummyCFFIBuild(build):
@@ -191,36 +200,19 @@ class DummyPyTest(test):
setup(
name=__about__["__title__"],
version=__about__["__version__"],
-
description=__about__["__summary__"],
- long_description=io.open("README.rst", encoding='utf-8').read(),
+ long_description=io.open("README.rst", encoding="utf-8").read(),
url=__about__["__uri__"],
license=__about__["__license__"],
-
author=__about__["__author__"],
author_email=__about__["__email__"],
-
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
- install_requires=[
- CFFI_DEPENDENCY,
- SIX_DEPENDENCY,
- ],
- extras_require={
- "tests": [
- "pytest>=3.2.1,!=3.3.0",
- ],
- },
- tests_require=[
- "pytest>=3.2.1,!=3.3.0",
- ],
-
+ install_requires=[CFFI_DEPENDENCY, SIX_DEPENDENCY],
+ extras_require={"tests": ["pytest>=3.2.1,!=3.3.0"]},
+ tests_require=["pytest>=3.2.1,!=3.3.0"],
package_dir={"": "src"},
- packages=[
- "bcrypt",
- ],
-
+ packages=["bcrypt"],
zip_safe=False,
-
classifiers=[
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: Apache Software License",
@@ -234,8 +226,6 @@ setup(
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
-
ext_package="bcrypt",
-
**keywords_with_side_effects(sys.argv)
)