Alex Gaynor | bfc06bc | 2013-08-06 19:36:19 -0700 | [diff] [blame] | 1 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 2 | # you may not use this file except in compliance with the License. |
| 3 | # You may obtain a copy of the License at |
| 4 | # |
| 5 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | # |
| 7 | # Unless required by applicable law or agreed to in writing, software |
| 8 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 10 | # implied. |
| 11 | # See the License for the specific language governing permissions and |
| 12 | # limitations under the License. |
Alex Gaynor | 9a00f05 | 2014-01-02 13:09:34 -0800 | [diff] [blame^] | 13 | from distutils.command.build import build |
| 14 | |
Donald Stufft | 9ebb8ff | 2013-08-11 17:05:03 -0400 | [diff] [blame] | 15 | from setuptools import setup, find_packages |
Alex Gaynor | c62e91f | 2013-08-06 19:25:52 -0700 | [diff] [blame] | 16 | |
Donald Stufft | 446a457 | 2013-08-11 17:38:13 -0400 | [diff] [blame] | 17 | |
Donald Stufft | 5f12a1b | 2013-08-11 16:37:43 -0400 | [diff] [blame] | 18 | about = {} |
| 19 | with open("cryptography/__about__.py") as fp: |
| 20 | exec(fp.read(), about) |
| 21 | |
| 22 | |
| 23 | CFFI_DEPENDENCY = "cffi>=0.6" |
Paul Kehrer | c024255 | 2013-09-10 18:54:13 -0500 | [diff] [blame] | 24 | SIX_DEPENDENCY = "six>=1.4.1" |
Donald Stufft | 5f12a1b | 2013-08-11 16:37:43 -0400 | [diff] [blame] | 25 | |
| 26 | install_requires = [ |
| 27 | CFFI_DEPENDENCY, |
Paul Kehrer | c024255 | 2013-09-10 18:54:13 -0500 | [diff] [blame] | 28 | SIX_DEPENDENCY |
Donald Stufft | 5f12a1b | 2013-08-11 16:37:43 -0400 | [diff] [blame] | 29 | ] |
| 30 | |
| 31 | setup_requires = [ |
| 32 | CFFI_DEPENDENCY, |
| 33 | ] |
Alex Gaynor | c62e91f | 2013-08-06 19:25:52 -0700 | [diff] [blame] | 34 | |
Alex Gaynor | 9a00f05 | 2014-01-02 13:09:34 -0800 | [diff] [blame^] | 35 | |
| 36 | class cffi_build(build): |
| 37 | def finalize_options(self): |
| 38 | from cryptography.hazmat.bindings.openssl.binding import Binding |
| 39 | from cryptography.hazmat.primitives import constant_time, padding |
| 40 | |
| 41 | self.distribution.ext_modules = [ |
| 42 | Binding().ffi.verifier.get_extension(), |
| 43 | constant_time._ffi.verifier.get_extension(), |
| 44 | padding._ffi.verifier.get_extension() |
| 45 | ] |
| 46 | build.finalize_options(self) |
| 47 | |
| 48 | |
Alex Gaynor | c62e91f | 2013-08-06 19:25:52 -0700 | [diff] [blame] | 49 | setup( |
Donald Stufft | 5f12a1b | 2013-08-11 16:37:43 -0400 | [diff] [blame] | 50 | name=about["__title__"], |
| 51 | version=about["__version__"], |
| 52 | |
| 53 | description=about["__summary__"], |
| 54 | license=about["__license__"], |
| 55 | url=about["__uri__"], |
| 56 | |
| 57 | author=about["__author__"], |
| 58 | author_email=about["__email__"], |
| 59 | |
Christian Heimes | f83ed1d | 2013-08-10 23:28:29 +0200 | [diff] [blame] | 60 | classifiers=[ |
| 61 | "Development Status :: 2 - Pre-Alpha", |
| 62 | "Intended Audience :: Developers", |
| 63 | "License :: OSI Approved :: Apache Software License", |
| 64 | "Natural Language :: English", |
| 65 | "Operating System :: MacOS :: MacOS X", |
| 66 | "Operating System :: POSIX", |
| 67 | "Operating System :: POSIX :: BSD", |
| 68 | "Operating System :: POSIX :: Linux", |
| 69 | "Operating System :: Microsoft :: Windows", |
Christian Heimes | f83ed1d | 2013-08-10 23:28:29 +0200 | [diff] [blame] | 70 | "Programming Language :: Python", |
| 71 | "Programming Language :: Python :: 2", |
| 72 | "Programming Language :: Python :: 2.6", |
| 73 | "Programming Language :: Python :: 2.7", |
| 74 | "Programming Language :: Python :: 3", |
| 75 | "Programming Language :: Python :: 3.2", |
| 76 | "Programming Language :: Python :: 3.3", |
| 77 | "Programming Language :: Python :: Implementation :: CPython", |
| 78 | "Programming Language :: Python :: Implementation :: PyPy", |
| 79 | "Topic :: Security :: Cryptography", |
| 80 | ], |
Donald Stufft | 5f12a1b | 2013-08-11 16:37:43 -0400 | [diff] [blame] | 81 | |
Donald Stufft | 9ebb8ff | 2013-08-11 17:05:03 -0400 | [diff] [blame] | 82 | packages=find_packages(exclude=["tests", "tests.*"]), |
| 83 | |
Donald Stufft | bac187d | 2013-08-10 15:43:51 -0400 | [diff] [blame] | 84 | install_requires=install_requires, |
Donald Stufft | 5f12a1b | 2013-08-11 16:37:43 -0400 | [diff] [blame] | 85 | setup_requires=setup_requires, |
| 86 | |
| 87 | # for cffi |
| 88 | zip_safe=False, |
Alex Gaynor | 9a00f05 | 2014-01-02 13:09:34 -0800 | [diff] [blame^] | 89 | ext_package="cryptography", |
| 90 | cmdclass={ |
| 91 | "build": cffi_build, |
| 92 | } |
Alex Gaynor | c62e91f | 2013-08-06 19:25:52 -0700 | [diff] [blame] | 93 | ) |