Dominic Chen | 9604d9e | 2015-10-10 05:13:31 +0000 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | |
Alex Gaynor | 5951f46 | 2014-11-16 09:08:42 -0800 | [diff] [blame] | 3 | # This file is dual licensed under the terms of the Apache License, Version |
| 4 | # 2.0, and the BSD License. See the LICENSE file in the root of this repository |
| 5 | # for complete details. |
Alex Gaynor | c37feed | 2014-03-08 08:32:56 -0800 | [diff] [blame] | 6 | |
| 7 | from __future__ import absolute_import, division, print_function |
| 8 | |
Alex Gaynor | f51f2c1 | 2014-01-03 07:33:01 -0800 | [diff] [blame] | 9 | import os |
Terry Chia | 361545d | 2014-07-28 12:06:54 +0800 | [diff] [blame] | 10 | import platform |
Alex Stapleton | a39a319 | 2014-03-14 20:03:12 +0000 | [diff] [blame] | 11 | import subprocess |
Alex Stapleton | 707b008 | 2014-04-20 22:24:41 +0100 | [diff] [blame] | 12 | import sys |
Alex Stapleton | 4b610cc | 2014-03-22 08:49:35 +0000 | [diff] [blame] | 13 | from distutils.command.build import build |
Alex Stapleton | a39a319 | 2014-03-14 20:03:12 +0000 | [diff] [blame] | 14 | |
| 15 | import pkg_resources |
Alex Gaynor | 9a00f05 | 2014-01-02 13:09:34 -0800 | [diff] [blame] | 16 | |
Alex Gaynor | 4941fc5 | 2017-10-28 11:28:53 -0400 | [diff] [blame] | 17 | import setuptools |
Paul Kehrer | afc1ccd | 2014-03-19 11:49:32 -0400 | [diff] [blame] | 18 | from setuptools import find_packages, setup |
Sascha Peilicke | c549205 | 2014-03-31 17:59:37 +0200 | [diff] [blame] | 19 | from setuptools.command.install import install |
Alex Gaynor | acac6a6 | 2014-03-04 15:24:03 -0800 | [diff] [blame] | 20 | from setuptools.command.test import test |
Donald Stufft | 446a457 | 2013-08-11 17:38:13 -0400 | [diff] [blame] | 21 | |
Paul Kehrer | afc1ccd | 2014-03-19 11:49:32 -0400 | [diff] [blame] | 22 | |
Alex Gaynor | 4941fc5 | 2017-10-28 11:28:53 -0400 | [diff] [blame] | 23 | if ( |
| 24 | pkg_resources.parse_version(setuptools.__version__) < |
| 25 | pkg_resources.parse_version("18.5") |
| 26 | ): |
| 27 | raise RuntimeError( |
| 28 | "cryptography requires setuptools 18.5 or newer, please upgrade to a " |
| 29 | "newer version of setuptools" |
| 30 | ) |
| 31 | |
Alex Gaynor | 7630d6c | 2014-01-03 07:34:43 -0800 | [diff] [blame] | 32 | base_dir = os.path.dirname(__file__) |
Donald Stufft | c62a78c | 2014-11-07 19:17:08 -0500 | [diff] [blame] | 33 | src_dir = os.path.join(base_dir, "src") |
| 34 | |
| 35 | # When executing the setup.py, we need to be able to import ourselves, this |
| 36 | # means that we need to add the src/ directory to the sys.path. |
| 37 | sys.path.insert(0, src_dir) |
Alex Gaynor | 7630d6c | 2014-01-03 07:34:43 -0800 | [diff] [blame] | 38 | |
Donald Stufft | 5f12a1b | 2013-08-11 16:37:43 -0400 | [diff] [blame] | 39 | about = {} |
Donald Stufft | c62a78c | 2014-11-07 19:17:08 -0500 | [diff] [blame] | 40 | with open(os.path.join(src_dir, "cryptography", "__about__.py")) as f: |
Alex Gaynor | 7630d6c | 2014-01-03 07:34:43 -0800 | [diff] [blame] | 41 | exec(f.read(), about) |
Donald Stufft | 5f12a1b | 2013-08-11 16:37:43 -0400 | [diff] [blame] | 42 | |
| 43 | |
Alex Stapleton | a39a319 | 2014-03-14 20:03:12 +0000 | [diff] [blame] | 44 | VECTORS_DEPENDENCY = "cryptography_vectors=={0}".format(about['__version__']) |
Donald Stufft | 5f12a1b | 2013-08-11 16:37:43 -0400 | [diff] [blame] | 45 | |
Alex Gaynor | 2af3d4c | 2018-07-23 13:10:13 -0400 | [diff] [blame] | 46 | # `setup_requirements` must be kept in sync with `pyproject.toml` |
Paul Kehrer | 3c68250 | 2018-12-10 12:13:31 +0800 | [diff] [blame] | 47 | setup_requirements = ["cffi>=1.8,!=1.11.3"] |
Donald Stufft | 5f12a1b | 2013-08-11 16:37:43 -0400 | [diff] [blame] | 48 | |
Paul Kehrer | 7d17cbb | 2015-08-20 13:25:15 -0500 | [diff] [blame] | 49 | if platform.python_implementation() == "PyPy": |
Paul Kehrer | 3c68250 | 2018-12-10 12:13:31 +0800 | [diff] [blame] | 50 | if sys.pypy_version_info < (5, 4): |
Paul Kehrer | 7d17cbb | 2015-08-20 13:25:15 -0500 | [diff] [blame] | 51 | raise RuntimeError( |
Paul Kehrer | 3c68250 | 2018-12-10 12:13:31 +0800 | [diff] [blame] | 52 | "cryptography is not compatible with PyPy < 5.4. Please upgrade " |
Alex Gaynor | ba45d28 | 2018-04-08 16:39:08 -0400 | [diff] [blame] | 53 | "PyPy to use this library." |
Paul Kehrer | 7d17cbb | 2015-08-20 13:25:15 -0500 | [diff] [blame] | 54 | ) |
Julian Berman | 4cf3811 | 2015-02-24 10:51:53 -0500 | [diff] [blame] | 55 | |
koobs | ff0dd1e | 2014-02-24 21:55:04 +1100 | [diff] [blame] | 56 | test_requirements = [ |
Paul Kehrer | 71e4251 | 2018-10-23 19:34:01 +0800 | [diff] [blame] | 57 | "pytest>=3.6.0,!=3.9.0,!=3.9.1,!=3.9.2", |
koobs | ff0dd1e | 2014-02-24 21:55:04 +1100 | [diff] [blame] | 58 | "pretend", |
Alex Stapleton | 0bd20e2 | 2014-03-14 19:58:07 +0000 | [diff] [blame] | 59 | "iso8601", |
InvalidInterrupt | 8e66ca6 | 2016-08-16 19:39:31 -0700 | [diff] [blame] | 60 | "pytz", |
Paul Kehrer | 71e4251 | 2018-10-23 19:34:01 +0800 | [diff] [blame] | 61 | "hypothesis>=1.11.4,!=3.79.2", |
koobs | ff0dd1e | 2014-02-24 21:55:04 +1100 | [diff] [blame] | 62 | ] |
Alex Gaynor | de3aa05 | 2016-02-19 07:33:56 -0500 | [diff] [blame] | 63 | |
koobs | ff0dd1e | 2014-02-24 21:55:04 +1100 | [diff] [blame] | 64 | |
Alex Stapleton | a39a319 | 2014-03-14 20:03:12 +0000 | [diff] [blame] | 65 | # If there's no vectors locally that probably means we are in a tarball and |
| 66 | # need to go and get the matching vectors package from PyPi |
| 67 | if not os.path.exists(os.path.join(base_dir, "vectors/setup.py")): |
| 68 | test_requirements.append(VECTORS_DEPENDENCY) |
| 69 | |
Alex Gaynor | 9a00f05 | 2014-01-02 13:09:34 -0800 | [diff] [blame] | 70 | |
Alex Gaynor | acac6a6 | 2014-03-04 15:24:03 -0800 | [diff] [blame] | 71 | class PyTest(test): |
koobs | ff0dd1e | 2014-02-24 21:55:04 +1100 | [diff] [blame] | 72 | def finalize_options(self): |
Alex Gaynor | 6858cd4 | 2014-03-04 15:33:13 -0800 | [diff] [blame] | 73 | test.finalize_options(self) |
koobs | ff0dd1e | 2014-02-24 21:55:04 +1100 | [diff] [blame] | 74 | self.test_args = [] |
| 75 | self.test_suite = True |
koobs | 0667180 | 2014-02-24 22:33:07 +1100 | [diff] [blame] | 76 | |
Alex Stapleton | a39a319 | 2014-03-14 20:03:12 +0000 | [diff] [blame] | 77 | # This means there's a vectors/ folder with the package in here. |
| 78 | # cd into it, install the vectors package and then refresh sys.path |
| 79 | if VECTORS_DEPENDENCY not in test_requirements: |
Alex Gaynor | d9f9b75 | 2014-07-11 10:18:24 -0700 | [diff] [blame] | 80 | subprocess.check_call( |
| 81 | [sys.executable, "setup.py", "install"], cwd="vectors" |
| 82 | ) |
Alex Stapleton | a39a319 | 2014-03-14 20:03:12 +0000 | [diff] [blame] | 83 | pkg_resources.get_distribution("cryptography_vectors").activate() |
| 84 | |
koobs | ff0dd1e | 2014-02-24 21:55:04 +1100 | [diff] [blame] | 85 | def run_tests(self): |
koobs | 92a4cdb | 2014-02-24 22:13:17 +1100 | [diff] [blame] | 86 | # Import here because in module scope the eggs are not loaded. |
koobs | ff0dd1e | 2014-02-24 21:55:04 +1100 | [diff] [blame] | 87 | import pytest |
Alex Gaynor | 8a58e69 | 2015-02-20 07:58:39 -0800 | [diff] [blame] | 88 | test_args = [os.path.join(base_dir, "tests")] |
| 89 | errno = pytest.main(test_args) |
koobs | ff0dd1e | 2014-02-24 21:55:04 +1100 | [diff] [blame] | 90 | sys.exit(errno) |
| 91 | |
Alex Gaynor | 9a00f05 | 2014-01-02 13:09:34 -0800 | [diff] [blame] | 92 | |
Peter Odding | 51ec05f | 2014-07-12 01:18:35 +0200 | [diff] [blame] | 93 | def keywords_with_side_effects(argv): |
Peter Odding | c9b83f7 | 2014-07-12 00:52:58 +0200 | [diff] [blame] | 94 | """ |
| 95 | Get a dictionary with setup keywords that (can) have side effects. |
| 96 | |
Peter Odding | 51ec05f | 2014-07-12 01:18:35 +0200 | [diff] [blame] | 97 | :param argv: A list of strings with command line arguments. |
| 98 | :returns: A dictionary with keyword arguments for the ``setup()`` function. |
| 99 | |
Peter Odding | c9b83f7 | 2014-07-12 00:52:58 +0200 | [diff] [blame] | 100 | This setup.py script uses the setuptools 'setup_requires' feature because |
| 101 | this is required by the cffi package to compile extension modules. The |
| 102 | purpose of ``keywords_with_side_effects()`` is to avoid triggering the cffi |
Peter Odding | e914456 | 2014-07-12 03:14:55 +0200 | [diff] [blame] | 103 | build process as a result of setup.py invocations that don't need the cffi |
| 104 | module to be built (setup.py serves the dual purpose of exposing package |
| 105 | metadata). |
Peter Odding | c9b83f7 | 2014-07-12 00:52:58 +0200 | [diff] [blame] | 106 | |
Peter Odding | e914456 | 2014-07-12 03:14:55 +0200 | [diff] [blame] | 107 | All of the options listed by ``python setup.py --help`` that print |
| 108 | information should be recognized here. The commands ``clean``, |
| 109 | ``egg_info``, ``register``, ``sdist`` and ``upload`` are also recognized. |
| 110 | Any combination of these options and commands is also supported. |
Peter Odding | c9b83f7 | 2014-07-12 00:52:58 +0200 | [diff] [blame] | 111 | |
Peter Odding | e914456 | 2014-07-12 03:14:55 +0200 | [diff] [blame] | 112 | This function was originally based on the `setup.py script`_ of SciPy (see |
| 113 | also the discussion in `pip issue #25`_). |
Peter Odding | c9b83f7 | 2014-07-12 00:52:58 +0200 | [diff] [blame] | 114 | |
| 115 | .. _pip issue #25: https://github.com/pypa/pip/issues/25 |
Peter Odding | 63ce5df | 2014-07-12 01:56:37 +0200 | [diff] [blame] | 116 | .. _setup.py script: https://github.com/scipy/scipy/blob/master/setup.py |
Peter Odding | c9b83f7 | 2014-07-12 00:52:58 +0200 | [diff] [blame] | 117 | """ |
Peter Odding | e914456 | 2014-07-12 03:14:55 +0200 | [diff] [blame] | 118 | no_setup_requires_arguments = ( |
| 119 | '-h', '--help', |
| 120 | '-n', '--dry-run', |
| 121 | '-q', '--quiet', |
| 122 | '-v', '--verbose', |
| 123 | '-V', '--version', |
| 124 | '--author', |
| 125 | '--author-email', |
| 126 | '--classifiers', |
| 127 | '--contact', |
| 128 | '--contact-email', |
| 129 | '--description', |
Peter Odding | 6c1e9ef | 2014-07-14 15:50:31 +0200 | [diff] [blame] | 130 | '--egg-base', |
Peter Odding | e914456 | 2014-07-12 03:14:55 +0200 | [diff] [blame] | 131 | '--fullname', |
| 132 | '--help-commands', |
| 133 | '--keywords', |
| 134 | '--licence', |
| 135 | '--license', |
| 136 | '--long-description', |
| 137 | '--maintainer', |
| 138 | '--maintainer-email', |
| 139 | '--name', |
| 140 | '--no-user-cfg', |
| 141 | '--obsoletes', |
| 142 | '--platforms', |
| 143 | '--provides', |
| 144 | '--requires', |
| 145 | '--url', |
| 146 | 'clean', |
| 147 | 'egg_info', |
| 148 | 'register', |
| 149 | 'sdist', |
| 150 | 'upload', |
| 151 | ) |
Peter Odding | 97f4530 | 2014-07-14 21:40:35 +0200 | [diff] [blame] | 152 | |
Peter Odding | 6c1e9ef | 2014-07-14 15:50:31 +0200 | [diff] [blame] | 153 | def is_short_option(argument): |
| 154 | """Check whether a command line argument is a short option.""" |
| 155 | return len(argument) >= 2 and argument[0] == '-' and argument[1] != '-' |
Peter Odding | 97f4530 | 2014-07-14 21:40:35 +0200 | [diff] [blame] | 156 | |
Peter Odding | 6c1e9ef | 2014-07-14 15:50:31 +0200 | [diff] [blame] | 157 | def expand_short_options(argument): |
| 158 | """Expand combined short options into canonical short options.""" |
| 159 | return ('-' + char for char in argument[1:]) |
Peter Odding | 97f4530 | 2014-07-14 21:40:35 +0200 | [diff] [blame] | 160 | |
Peter Odding | 6c1e9ef | 2014-07-14 15:50:31 +0200 | [diff] [blame] | 161 | def argument_without_setup_requirements(argv, i): |
| 162 | """Check whether a command line argument needs setup requirements.""" |
| 163 | if argv[i] in no_setup_requires_arguments: |
| 164 | # Simple case: An argument which is either an option or a command |
| 165 | # which doesn't need setup requirements. |
| 166 | return True |
Peter Odding | 97f4530 | 2014-07-14 21:40:35 +0200 | [diff] [blame] | 167 | elif (is_short_option(argv[i]) and |
| 168 | all(option in no_setup_requires_arguments |
| 169 | for option in expand_short_options(argv[i]))): |
Peter Odding | 6c1e9ef | 2014-07-14 15:50:31 +0200 | [diff] [blame] | 170 | # Not so simple case: Combined short options none of which need |
| 171 | # setup requirements. |
| 172 | return True |
Peter Odding | 97f4530 | 2014-07-14 21:40:35 +0200 | [diff] [blame] | 173 | elif argv[i - 1:i] == ['--egg-base']: |
Peter Odding | 6c1e9ef | 2014-07-14 15:50:31 +0200 | [diff] [blame] | 174 | # Tricky case: --egg-info takes an argument which should not make |
| 175 | # us use setup_requires (defeating the purpose of this code). |
| 176 | return True |
| 177 | else: |
| 178 | return False |
Peter Odding | 97f4530 | 2014-07-14 21:40:35 +0200 | [diff] [blame] | 179 | |
| 180 | if all(argument_without_setup_requirements(argv, i) |
| 181 | for i in range(1, len(argv))): |
Peter Odding | 3ae89a5 | 2014-07-12 02:06:56 +0200 | [diff] [blame] | 182 | return { |
| 183 | "cmdclass": { |
Paul Kehrer | 68b3b1e | 2015-05-19 13:05:21 -0700 | [diff] [blame] | 184 | "build": DummyBuild, |
| 185 | "install": DummyInstall, |
Peter Odding | 3ae89a5 | 2014-07-12 02:06:56 +0200 | [diff] [blame] | 186 | "test": DummyPyTest, |
| 187 | } |
| 188 | } |
Peter Odding | c9b83f7 | 2014-07-12 00:52:58 +0200 | [diff] [blame] | 189 | else: |
Paul Kehrer | 68b3b1e | 2015-05-19 13:05:21 -0700 | [diff] [blame] | 190 | cffi_modules = [ |
| 191 | "src/_cffi_src/build_openssl.py:ffi", |
| 192 | "src/_cffi_src/build_constant_time.py:ffi", |
| 193 | "src/_cffi_src/build_padding.py:ffi", |
| 194 | ] |
Paul Kehrer | 68b3b1e | 2015-05-19 13:05:21 -0700 | [diff] [blame] | 195 | |
Peter Odding | e327cf1 | 2014-07-12 01:18:50 +0200 | [diff] [blame] | 196 | return { |
Paul Kehrer | 4c287d7 | 2015-06-08 00:05:53 -0500 | [diff] [blame] | 197 | "setup_requires": setup_requirements, |
Peter Odding | e327cf1 | 2014-07-12 01:18:50 +0200 | [diff] [blame] | 198 | "cmdclass": { |
Peter Odding | e327cf1 | 2014-07-12 01:18:50 +0200 | [diff] [blame] | 199 | "test": PyTest, |
Paul Kehrer | 68b3b1e | 2015-05-19 13:05:21 -0700 | [diff] [blame] | 200 | }, |
| 201 | "cffi_modules": cffi_modules |
Peter Odding | e327cf1 | 2014-07-12 01:18:50 +0200 | [diff] [blame] | 202 | } |
Peter Odding | c9b83f7 | 2014-07-12 00:52:58 +0200 | [diff] [blame] | 203 | |
| 204 | |
Peter Odding | 3ae89a5 | 2014-07-12 02:06:56 +0200 | [diff] [blame] | 205 | setup_requires_error = ("Requested setup command that needs 'setup_requires' " |
| 206 | "while command line arguments implied a side effect " |
| 207 | "free command or option.") |
| 208 | |
| 209 | |
Paul Kehrer | 68b3b1e | 2015-05-19 13:05:21 -0700 | [diff] [blame] | 210 | class DummyBuild(build): |
Peter Odding | 3ae89a5 | 2014-07-12 02:06:56 +0200 | [diff] [blame] | 211 | """ |
| 212 | This class makes it very obvious when ``keywords_with_side_effects()`` has |
| 213 | incorrectly interpreted the command line arguments to ``setup.py build`` as |
| 214 | one of the 'side effect free' commands or options. |
| 215 | """ |
| 216 | |
Peter Odding | dcce080 | 2014-07-12 02:28:13 +0200 | [diff] [blame] | 217 | def run(self): |
Peter Odding | 3ae89a5 | 2014-07-12 02:06:56 +0200 | [diff] [blame] | 218 | raise RuntimeError(setup_requires_error) |
| 219 | |
| 220 | |
Paul Kehrer | 68b3b1e | 2015-05-19 13:05:21 -0700 | [diff] [blame] | 221 | class DummyInstall(install): |
Peter Odding | 3ae89a5 | 2014-07-12 02:06:56 +0200 | [diff] [blame] | 222 | """ |
| 223 | This class makes it very obvious when ``keywords_with_side_effects()`` has |
| 224 | incorrectly interpreted the command line arguments to ``setup.py install`` |
| 225 | as one of the 'side effect free' commands or options. |
| 226 | """ |
| 227 | |
Peter Odding | dcce080 | 2014-07-12 02:28:13 +0200 | [diff] [blame] | 228 | def run(self): |
Peter Odding | 3ae89a5 | 2014-07-12 02:06:56 +0200 | [diff] [blame] | 229 | raise RuntimeError(setup_requires_error) |
| 230 | |
| 231 | |
Peter Odding | c9861f9 | 2014-07-13 04:17:20 +0200 | [diff] [blame] | 232 | class DummyPyTest(test): |
Peter Odding | 3ae89a5 | 2014-07-12 02:06:56 +0200 | [diff] [blame] | 233 | """ |
| 234 | This class makes it very obvious when ``keywords_with_side_effects()`` has |
| 235 | incorrectly interpreted the command line arguments to ``setup.py test`` as |
| 236 | one of the 'side effect free' commands or options. |
| 237 | """ |
| 238 | |
Peter Odding | 3ae89a5 | 2014-07-12 02:06:56 +0200 | [diff] [blame] | 239 | def run_tests(self): |
| 240 | raise RuntimeError(setup_requires_error) |
| 241 | |
| 242 | |
Alex Gaynor | 7630d6c | 2014-01-03 07:34:43 -0800 | [diff] [blame] | 243 | with open(os.path.join(base_dir, "README.rst")) as f: |
Alex Gaynor | f51f2c1 | 2014-01-03 07:33:01 -0800 | [diff] [blame] | 244 | long_description = f.read() |
| 245 | |
| 246 | |
Alex Gaynor | c62e91f | 2013-08-06 19:25:52 -0700 | [diff] [blame] | 247 | setup( |
Donald Stufft | 5f12a1b | 2013-08-11 16:37:43 -0400 | [diff] [blame] | 248 | name=about["__title__"], |
| 249 | version=about["__version__"], |
| 250 | |
| 251 | description=about["__summary__"], |
Alex Gaynor | f51f2c1 | 2014-01-03 07:33:01 -0800 | [diff] [blame] | 252 | long_description=long_description, |
Donald Stufft | 5f12a1b | 2013-08-11 16:37:43 -0400 | [diff] [blame] | 253 | license=about["__license__"], |
| 254 | url=about["__uri__"], |
| 255 | |
| 256 | author=about["__author__"], |
| 257 | author_email=about["__email__"], |
| 258 | |
Christian Heimes | f83ed1d | 2013-08-10 23:28:29 +0200 | [diff] [blame] | 259 | classifiers=[ |
Jon Dufresne | 95820b4 | 2018-06-16 18:33:33 -0700 | [diff] [blame] | 260 | "Development Status :: 5 - Production/Stable", |
Christian Heimes | f83ed1d | 2013-08-10 23:28:29 +0200 | [diff] [blame] | 261 | "Intended Audience :: Developers", |
| 262 | "License :: OSI Approved :: Apache Software License", |
Alex Gaynor | abe8bc9 | 2014-10-31 19:28:57 -0700 | [diff] [blame] | 263 | "License :: OSI Approved :: BSD License", |
Christian Heimes | f83ed1d | 2013-08-10 23:28:29 +0200 | [diff] [blame] | 264 | "Natural Language :: English", |
| 265 | "Operating System :: MacOS :: MacOS X", |
| 266 | "Operating System :: POSIX", |
| 267 | "Operating System :: POSIX :: BSD", |
| 268 | "Operating System :: POSIX :: Linux", |
| 269 | "Operating System :: Microsoft :: Windows", |
Christian Heimes | f83ed1d | 2013-08-10 23:28:29 +0200 | [diff] [blame] | 270 | "Programming Language :: Python", |
| 271 | "Programming Language :: Python :: 2", |
Christian Heimes | f83ed1d | 2013-08-10 23:28:29 +0200 | [diff] [blame] | 272 | "Programming Language :: Python :: 2.7", |
| 273 | "Programming Language :: Python :: 3", |
Alex Gaynor | 7f8b277 | 2014-03-17 10:22:41 -0700 | [diff] [blame] | 274 | "Programming Language :: Python :: 3.4", |
Alex Gaynor | 1d5805b | 2015-09-17 20:57:44 -0400 | [diff] [blame] | 275 | "Programming Language :: Python :: 3.5", |
Alex Gaynor | 31b5d78 | 2016-12-23 12:20:36 -0500 | [diff] [blame] | 276 | "Programming Language :: Python :: 3.6", |
Paul Kehrer | 4ee1cb9 | 2018-06-27 20:07:14 -0700 | [diff] [blame] | 277 | "Programming Language :: Python :: 3.7", |
Christian Heimes | f83ed1d | 2013-08-10 23:28:29 +0200 | [diff] [blame] | 278 | "Programming Language :: Python :: Implementation :: CPython", |
| 279 | "Programming Language :: Python :: Implementation :: PyPy", |
| 280 | "Topic :: Security :: Cryptography", |
| 281 | ], |
Donald Stufft | 5f12a1b | 2013-08-11 16:37:43 -0400 | [diff] [blame] | 282 | |
Donald Stufft | c62a78c | 2014-11-07 19:17:08 -0500 | [diff] [blame] | 283 | package_dir={"": "src"}, |
Frazer McLean | 542ea8e | 2016-03-26 23:10:23 +0100 | [diff] [blame] | 284 | packages=find_packages(where="src", exclude=["_cffi_src", "_cffi_src.*"]), |
Alex Gaynor | e23dd3a | 2014-08-11 13:51:54 -0700 | [diff] [blame] | 285 | include_package_data=True, |
Donald Stufft | 9ebb8ff | 2013-08-11 17:05:03 -0400 | [diff] [blame] | 286 | |
Alex Gaynor | 0ed80b4 | 2017-12-26 13:04:31 -0500 | [diff] [blame] | 287 | python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*', |
| 288 | |
Alex Gaynor | 4c41ab0 | 2017-08-23 20:33:01 -0400 | [diff] [blame] | 289 | install_requires=[ |
Alex Gaynor | 4c41ab0 | 2017-08-23 20:33:01 -0400 | [diff] [blame] | 290 | "asn1crypto >= 0.21.0", |
| 291 | "six >= 1.4.1", |
Alex Gaynor | ca2055f | 2018-04-28 15:31:02 -0400 | [diff] [blame] | 292 | ] + setup_requirements, |
koobs | ff0dd1e | 2014-02-24 21:55:04 +1100 | [diff] [blame] | 293 | tests_require=test_requirements, |
Alex Gaynor | 22f7ec5 | 2016-01-17 11:41:40 -0500 | [diff] [blame] | 294 | extras_require={ |
Alex Gaynor | 4c41ab0 | 2017-08-23 20:33:01 -0400 | [diff] [blame] | 295 | ":python_version < '3'": ["enum34", "ipaddress"], |
Alex Gaynor | 4c41ab0 | 2017-08-23 20:33:01 -0400 | [diff] [blame] | 296 | |
Alex Gaynor | 22f7ec5 | 2016-01-17 11:41:40 -0500 | [diff] [blame] | 297 | "test": test_requirements, |
Paul Kehrer | e3d2fc1 | 2018-03-05 20:50:10 -0400 | [diff] [blame] | 298 | "docs": [ |
Paul Kehrer | 7700251 | 2018-09-14 13:01:12 -0400 | [diff] [blame] | 299 | "sphinx >= 1.6.5,!=1.8.0", |
Paul Kehrer | e3d2fc1 | 2018-03-05 20:50:10 -0400 | [diff] [blame] | 300 | "sphinx_rtd_theme", |
| 301 | ], |
Paul Kehrer | c6c3b6d | 2016-05-29 00:17:08 -0500 | [diff] [blame] | 302 | "docstest": [ |
Alex Gaynor | 9417608 | 2016-01-17 23:28:05 -0500 | [diff] [blame] | 303 | "doc8", |
Alex Gaynor | 0a8bdff | 2017-07-21 13:57:50 -0400 | [diff] [blame] | 304 | "pyenchant >= 1.6.11", |
Paul Kehrer | 6d7b70e | 2018-12-02 23:50:54 +0800 | [diff] [blame] | 305 | "twine >= 1.12.0", |
Alex Gaynor | 30d35ae | 2017-10-23 19:09:27 -0400 | [diff] [blame] | 306 | "sphinxcontrib-spelling >= 4.0.1", |
Alex Gaynor | 9417608 | 2016-01-17 23:28:05 -0500 | [diff] [blame] | 307 | ], |
Paul Kehrer | c6c3b6d | 2016-05-29 00:17:08 -0500 | [diff] [blame] | 308 | "pep8test": [ |
Alex Gaynor | 9417608 | 2016-01-17 23:28:05 -0500 | [diff] [blame] | 309 | "flake8", |
| 310 | "flake8-import-order", |
| 311 | "pep8-naming", |
| 312 | ], |
Paul Kehrer | 7e42282 | 2018-12-07 11:43:38 +0800 | [diff] [blame] | 313 | # This extra is for the U-label support that was deprecated in |
| 314 | # cryptography 2.1. If you need this deprecated path install with |
| 315 | # pip install cryptography[idna] |
| 316 | "idna": [ |
| 317 | "idna >= 2.1", |
| 318 | ] |
Alex Gaynor | 22f7ec5 | 2016-01-17 11:41:40 -0500 | [diff] [blame] | 319 | }, |
Donald Stufft | 5f12a1b | 2013-08-11 16:37:43 -0400 | [diff] [blame] | 320 | |
| 321 | # for cffi |
| 322 | zip_safe=False, |
Paul Kehrer | 68b3b1e | 2015-05-19 13:05:21 -0700 | [diff] [blame] | 323 | ext_package="cryptography.hazmat.bindings", |
Peter Odding | 51ec05f | 2014-07-12 01:18:35 +0200 | [diff] [blame] | 324 | **keywords_with_side_effects(sys.argv) |
Alex Gaynor | c62e91f | 2013-08-06 19:25:52 -0700 | [diff] [blame] | 325 | ) |