mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
Merge pull request #61 from Kriechi/distribute-cffi
distribute cffi correctly
This commit is contained in:
commit
c725325a78
@ -1,8 +1,8 @@
|
|||||||
from __future__ import (absolute_import, print_function, division)
|
from __future__ import (absolute_import, print_function, division)
|
||||||
import cffi
|
from cffi import FFI
|
||||||
import OpenSSL
|
import OpenSSL
|
||||||
|
|
||||||
xffi = cffi.FFI()
|
xffi = FFI()
|
||||||
xffi.cdef("""
|
xffi.cdef("""
|
||||||
struct rsa_meth_st {
|
struct rsa_meth_st {
|
||||||
int flags;
|
int flags;
|
||||||
|
36
setup.py
36
setup.py
@ -1,16 +1,39 @@
|
|||||||
|
from distutils.command.build import build
|
||||||
|
from setuptools.command.install import install
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
from codecs import open
|
from codecs import open
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from netlib import version
|
from netlib import version
|
||||||
|
|
||||||
# Based on https://github.com/pypa/sampleproject/blob/master/setup.py
|
# Based on https://github.com/pypa/sampleproject/blob/master/setup.py
|
||||||
# and https://python-packaging-user-guide.readthedocs.org/
|
# 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__))
|
here = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
with open(os.path.join(here, 'README.mkd'), encoding='utf-8') as f:
|
with open(os.path.join(here, 'README.mkd'), encoding='utf-8') as f:
|
||||||
long_description = f.read()
|
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(
|
setup(
|
||||||
name="netlib",
|
name="netlib",
|
||||||
version=version.VERSION,
|
version=version.VERSION,
|
||||||
@ -36,12 +59,18 @@ setup(
|
|||||||
],
|
],
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
|
zip_safe=False,
|
||||||
install_requires=[
|
install_requires=[
|
||||||
|
"cffi",
|
||||||
"pyasn1>=0.1.7",
|
"pyasn1>=0.1.7",
|
||||||
"pyOpenSSL>=0.15.1",
|
"pyOpenSSL>=0.15.1",
|
||||||
"cryptography>=0.9",
|
"cryptography>=0.9",
|
||||||
"passlib>=1.6.2",
|
"passlib>=1.6.2",
|
||||||
"hpack>=1.0.1"],
|
"hpack>=1.0.1"],
|
||||||
|
setup_requires=[
|
||||||
|
"cffi",
|
||||||
|
"pyOpenSSL>=0.15.1",
|
||||||
|
],
|
||||||
extras_require={
|
extras_require={
|
||||||
'dev': [
|
'dev': [
|
||||||
"mock>=1.0.1",
|
"mock>=1.0.1",
|
||||||
@ -52,4 +81,9 @@ setup(
|
|||||||
"autoflake>=0.6.6",
|
"autoflake>=0.6.6",
|
||||||
"pathod>=%s, <%s" %
|
"pathod>=%s, <%s" %
|
||||||
(version.MINORVERSION,
|
(version.MINORVERSION,
|
||||||
version.NEXT_MINORVERSION)]})
|
version.NEXT_MINORVERSION)]},
|
||||||
|
cmdclass={
|
||||||
|
"build": CFFIBuild,
|
||||||
|
"install": CFFIInstall,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user