summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorDonald Stufft <donald@stufft.io>2015-06-11 09:23:01 -0400
committerDonald Stufft <donald@stufft.io>2015-06-11 09:23:01 -0400
commit51ebadb34d22d25c10c5e54d4dada46b88c3829b (patch)
treeb14a815d477d7f24eebbad6be2b038b21693da7e /setup.py
parentf3280bda0a560fbf4d401bd8edf89b974a97b39c (diff)
downloadpy-bcrypt-git-51ebadb34d22d25c10c5e54d4dada46b88c3829b.tar.gz
Migrate to using CFFI 1.0
* Move everything under src/ to ensure we test against the installed library. * Create a build_bcrypt.py script which will build _bcrypt.so. * Refactor to utilize the new _bcrypt.so instead of implicit compile.
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py55
1 files changed, 13 insertions, 42 deletions
diff --git a/setup.py b/setup.py
index 370a753..f635d94 100644
--- a/setup.py
+++ b/setup.py
@@ -7,48 +7,21 @@ from setuptools.command.install import install
from setuptools.command.test import test
-CFFI_DEPENDENCY = "cffi>=0.8"
+CFFI_DEPENDENCY = "cffi>=1.1"
SIX_DEPENDENCY = "six>=1.4.1"
+CFFI_MODULES = [
+ "src/build_bcrypt.py:ffi",
+]
+
+
# Manually extract the __about__
__about__ = {}
-with open("bcrypt/__about__.py") as fp:
+with open("src/bcrypt/__about__.py") as fp:
exec(fp.read(), __about__)
-def get_ext_modules():
- from bcrypt import _ffi
- return [_ffi.verifier.get_extension()]
-
-
-class CFFIBuild(build):
- """
- This class exists, instead of just providing ``ext_modules=[...]`` directly
- in ``setup()`` because importing cryptography requires we have several
- packages installed first.
-
- By doing the imports here we ensure that packages listed in
- ``setup_requires`` are already installed.
- """
-
- def finalize_options(self):
- self.distribution.ext_modules = get_ext_modules()
- build.finalize_options(self)
-
-
-class CFFIInstall(install):
- """
- As a consequence of CFFIBuild and it's late addition of ext_modules, we
- need the equivalent for the ``install`` command to install into platlib
- install-dir rather than purelib.
- """
-
- def finalize_options(self):
- self.distribution.ext_modules = get_ext_modules()
- install.finalize_options(self)
-
-
class PyTest(test):
def finalize_options(self):
test.finalize_options(self)
@@ -159,12 +132,11 @@ def keywords_with_side_effects(argv):
}
else:
return {
- "setup_requires": [CFFI_DEPENDENCY, SIX_DEPENDENCY],
+ "setup_requires": [CFFI_DEPENDENCY],
"cmdclass": {
- "build": CFFIBuild,
- "install": CFFIInstall,
"test": PyTest,
- }
+ },
+ "cffi_modules": CFFI_MODULES,
}
@@ -231,14 +203,11 @@ setup(
"pytest",
],
+ package_dir={"": "src"},
packages=[
"bcrypt",
],
- package_data={
- "bcrypt": ["crypt_blowfish-1.3/*"],
- },
-
zip_safe=False,
classifiers=[
@@ -252,5 +221,7 @@ setup(
"Programming Language :: Python :: 3.3",
],
+ ext_package="bcrypt",
+
**keywords_with_side_effects(sys.argv)
)