diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2015-05-28 10:56:00 +0200 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2015-05-30 15:15:08 +0200 |
commit | b395049a853aa378773aebae83468c1b889c2d4e (patch) | |
tree | c0f9bf86ea379afd1eff531d6b376610ee54118e /setup.py | |
parent | f76bfabc5d4ce36c56b1d1fd571728ee06f37b78 (diff) | |
download | mitmproxy-b395049a853aa378773aebae83468c1b889c2d4e.tar.gz mitmproxy-b395049a853aa378773aebae83468c1b889c2d4e.tar.bz2 mitmproxy-b395049a853aa378773aebae83468c1b889c2d4e.zip |
distribute cffi correctly
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 36 |
1 files changed, 35 insertions, 1 deletions
@@ -1,16 +1,39 @@ +from distutils.command.build import build +from setuptools.command.install import install from setuptools import setup, find_packages from codecs import open import os + from netlib import version # Based on https://github.com/pypa/sampleproject/blob/master/setup.py # and https://python-packaging-user-guide.readthedocs.org/ +# and https://caremad.io/2014/11/distributing-a-cffi-project/ here = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(here, 'README.mkd'), encoding='utf-8') as f: long_description = f.read() + +def get_ext_modules(): + from netlib import certffi + return [certffi.xffi.verifier.get_extension()] + + +class CFFIBuild(build): + + def finalize_options(self): + self.distribution.ext_modules = get_ext_modules() + build.finalize_options(self) + + +class CFFIInstall(install): + + def finalize_options(self): + self.distribution.ext_modules = get_ext_modules() + install.finalize_options(self) + setup( name="netlib", version=version.VERSION, @@ -36,12 +59,18 @@ setup( ], packages=find_packages(), include_package_data=True, + zip_safe=False, install_requires=[ + "cffi", "pyasn1>=0.1.7", "pyOpenSSL>=0.15.1", "cryptography>=0.9", "passlib>=1.6.2", "hpack>=1.0.1"], + setup_requires=[ + "cffi", + "pyOpenSSL>=0.15.1", + ], extras_require={ 'dev': [ "mock>=1.0.1", @@ -52,4 +81,9 @@ setup( "autoflake>=0.6.6", "pathod>=%s, <%s" % (version.MINORVERSION, - version.NEXT_MINORVERSION)]}) + version.NEXT_MINORVERSION)]}, + cmdclass={ + "build": CFFIBuild, + "install": CFFIInstall, + }, +) |