From 9a00f0539d5ab9b03b84625791663f11d7bed75c Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Thu, 2 Jan 2014 13:09:34 -0800 Subject: All the necessary things for setup.py to build cffi stuff --- setup.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 1856cadb..0776ba6e 100644 --- a/setup.py +++ b/setup.py @@ -10,6 +10,8 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. +from distutils.command.build import build + from setuptools import setup, find_packages @@ -30,6 +32,20 @@ setup_requires = [ CFFI_DEPENDENCY, ] + +class cffi_build(build): + def finalize_options(self): + from cryptography.hazmat.bindings.openssl.binding import Binding + from cryptography.hazmat.primitives import constant_time, padding + + self.distribution.ext_modules = [ + Binding().ffi.verifier.get_extension(), + constant_time._ffi.verifier.get_extension(), + padding._ffi.verifier.get_extension() + ] + build.finalize_options(self) + + setup( name=about["__title__"], version=about["__version__"], @@ -70,4 +86,8 @@ setup( # for cffi zip_safe=False, + ext_package="cryptography", + cmdclass={ + "build": cffi_build, + } ) -- cgit v1.2.3 From 91f119e75865e72d66e8c8b4f24164988e5b8d20 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Thu, 2 Jan 2014 13:12:59 -0800 Subject: six is now required at build time --- setup.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 0776ba6e..2ff57e97 100644 --- a/setup.py +++ b/setup.py @@ -23,15 +23,11 @@ with open("cryptography/__about__.py") as fp: CFFI_DEPENDENCY = "cffi>=0.6" SIX_DEPENDENCY = "six>=1.4.1" -install_requires = [ +requirements = [ CFFI_DEPENDENCY, SIX_DEPENDENCY ] -setup_requires = [ - CFFI_DEPENDENCY, -] - class cffi_build(build): def finalize_options(self): @@ -81,8 +77,8 @@ setup( packages=find_packages(exclude=["tests", "tests.*"]), - install_requires=install_requires, - setup_requires=setup_requires, + install_requires=requirements, + setup_requires=requirements, # for cffi zip_safe=False, -- cgit v1.2.3 From f51f2c1c5f24f627cfe57c2ea6d821c87f7a6c20 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Fri, 3 Jan 2014 07:33:01 -0800 Subject: Include a long description in our setup.py --- setup.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 1856cadb..e2df1c46 100644 --- a/setup.py +++ b/setup.py @@ -10,6 +10,8 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. +import os + from setuptools import setup, find_packages @@ -30,11 +32,16 @@ setup_requires = [ CFFI_DEPENDENCY, ] +with open(os.path.join(os.path.dirname(__file__), "README.rst")) as f: + long_description = f.read() + + setup( name=about["__title__"], version=about["__version__"], description=about["__summary__"], + long_description=long_description, license=about["__license__"], url=about["__uri__"], -- cgit v1.2.3 From 7630d6c50b3112eae69de606760cfb3e3b070c26 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Fri, 3 Jan 2014 07:34:43 -0800 Subject: Also use an absolute path for the about file --- setup.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index e2df1c46..3202f843 100644 --- a/setup.py +++ b/setup.py @@ -15,9 +15,11 @@ import os from setuptools import setup, find_packages +base_dir = os.path.dirname(__file__) + about = {} -with open("cryptography/__about__.py") as fp: - exec(fp.read(), about) +with open(os.path.join(base_dir, "cryptography", "__about__.py")) as f: + exec(f.read(), about) CFFI_DEPENDENCY = "cffi>=0.6" @@ -32,7 +34,7 @@ setup_requires = [ CFFI_DEPENDENCY, ] -with open(os.path.join(os.path.dirname(__file__), "README.rst")) as f: +with open(os.path.join(base_dir, "README.rst")) as f: long_description = f.read() -- cgit v1.2.3 From 4969751fde0ef09cd72c738a80c32851c1b1f21d Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Fri, 3 Jan 2014 15:08:45 -0800 Subject: Explanatory comment --- setup.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'setup.py') diff --git a/setup.py b/setup.py index fe37d9fb..0bdad485 100644 --- a/setup.py +++ b/setup.py @@ -33,6 +33,15 @@ requirements = [ class cffi_build(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): from cryptography.hazmat.bindings.openssl.binding import Binding from cryptography.hazmat.primitives import constant_time, padding -- cgit v1.2.3 From 50f233efe4d37a20b4372cf21f1c462914ea5d40 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 6 Jan 2014 11:10:40 -0800 Subject: Check to see if a binding is available before trying to install it --- setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 0bdad485..514fdab7 100644 --- a/setup.py +++ b/setup.py @@ -47,10 +47,12 @@ class cffi_build(build): from cryptography.hazmat.primitives import constant_time, padding self.distribution.ext_modules = [ - Binding().ffi.verifier.get_extension(), constant_time._ffi.verifier.get_extension(), padding._ffi.verifier.get_extension() ] + if Binding.is_available(): + self.distribution.ext_modules.append(Binding().ffi.verifier.get_extension()) + build.finalize_options(self) -- cgit v1.2.3 From ffa8b4d5fedad8f9c1fdbd05a2da8fb2679168af Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 6 Jan 2014 11:19:11 -0800 Subject: flake8 --- setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 514fdab7..a053fe61 100644 --- a/setup.py +++ b/setup.py @@ -51,7 +51,9 @@ class cffi_build(build): padding._ffi.verifier.get_extension() ] if Binding.is_available(): - self.distribution.ext_modules.append(Binding().ffi.verifier.get_extension()) + self.distribution.ext_modules.append( + Binding().ffi.verifier.get_extension() + ) build.finalize_options(self) -- cgit v1.2.3 From 5e5316de9ca968f646aa04301fcf3109aef0473f Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Tue, 7 Jan 2014 12:27:08 -0800 Subject: This is dangerous --- setup.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index a053fe61..feed0cd8 100644 --- a/setup.py +++ b/setup.py @@ -47,13 +47,10 @@ class cffi_build(build): from cryptography.hazmat.primitives import constant_time, padding self.distribution.ext_modules = [ + Binding().ffi.verifier.get_extension(), constant_time._ffi.verifier.get_extension(), padding._ffi.verifier.get_extension() ] - if Binding.is_available(): - self.distribution.ext_modules.append( - Binding().ffi.verifier.get_extension() - ) build.finalize_options(self) -- cgit v1.2.3 From a8dcf8428fed7d66309959b64d5bd55794c25386 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Fri, 10 Jan 2014 23:34:20 -0600 Subject: require cffi >= 0.8.1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index feed0cd8..d03e5ff8 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ with open(os.path.join(base_dir, "cryptography", "__about__.py")) as f: exec(f.read(), about) -CFFI_DEPENDENCY = "cffi>=0.6" +CFFI_DEPENDENCY = "cffi>=0.8.1" SIX_DEPENDENCY = "six>=1.4.1" requirements = [ -- cgit v1.2.3 From 7fcaa3715f1b3afde3256b6a01232c8a71fea891 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Fri, 10 Jan 2014 23:39:58 -0600 Subject: drop to >= 0.8 to make pypy happy --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index d03e5ff8..e8bcc11f 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ with open(os.path.join(base_dir, "cryptography", "__about__.py")) as f: exec(f.read(), about) -CFFI_DEPENDENCY = "cffi>=0.8.1" +CFFI_DEPENDENCY = "cffi>=0.8" SIX_DEPENDENCY = "six>=1.4.1" requirements = [ -- cgit v1.2.3