From dbefb4bea52ff9b2f768be555094fae3508cb0b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= Date: Tue, 8 Dec 2020 10:56:51 +0100 Subject: Stop playing with swig, we don't support swig 1.* anymore. --- INSTALL.rst | 4 ++-- setup.py | 45 +-------------------------------------------- 2 files changed, 3 insertions(+), 46 deletions(-) diff --git a/INSTALL.rst b/INSTALL.rst index f0ab79e..b95469e 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -18,8 +18,8 @@ system the following packages are needed: - ``build-essential`` - ``python3-dev`` and/or ``python-dev`` - ``libssl-dev`` -- ``swig 2.0.4`` or newer (installation is also possible on some -particular old systems with swig v1.*) +- ``swig 2.0.10`` or newer (default swig on RHEL-7, which is the + oldest I could find in the wild). Installing on Unix-like systems, including Cygwin ------------------------------------------------- diff --git a/setup.py b/setup.py index 0e87136..e39f51c 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,6 @@ import sys from distutils.command import build from distutils.command.clean import clean from distutils.dir_util import mkpath -from distutils.version import StrictVersion import setuptools from setuptools.command import build_ext @@ -34,8 +33,6 @@ logging.basicConfig(format='%(levelname)s:%(funcName)s:%(message)s', stream=sys.stdout, level=logging.INFO) log = logging.getLogger('setup') -REQUIRED_SWIG_VERSION = '2.0.4' - requires_list = ['parametrized'] if (2, 6) < sys.version_info[:2] < (3, 5): requires_list = ['typing'] @@ -265,39 +262,6 @@ class _M2CryptoBuildExt(build_ext.build_ext): build_ext.build_ext.run(self) -def swig_version(req_ver): - # type: (str) -> bool - """ - Compare version of the swig with the required version. - - :param req_ver: required version as a str (e.g., '2.0.4') - :return: Boolean indicating whether the satisfying version of swig - has been installed. - """ - ver_str = None - IND_VER_LINE = 'SWIG Version ' - - try: - pid = subprocess.Popen(['swig', '-version'], stdout=subprocess.PIPE) - except OSError: - return False - - out, _ = pid.communicate() - if hasattr(out, 'decode'): - out = out.decode('utf8') - - for line in out.split('\n'): - line = line.strip() - if line.startswith(IND_VER_LINE): - ver_str = line.strip()[len(IND_VER_LINE):] - break - - if not ver_str: - raise OSError('Unknown format of swig -version output:\n%s' % out) - - return StrictVersion(ver_str) >= StrictVersion(req_ver) - - x_comp_args = set() # We take care of deprecated functions in OpenSSL with our code, no need @@ -307,15 +271,8 @@ if sys.platform == 'win32': else: x_comp_args.update(['-DTHREADING', '-Wno-deprecated-declarations']) -# Don't try to run swig on the ancient platforms -if swig_version(REQUIRED_SWIG_VERSION): - lib_sources = ['SWIG/_m2crypto.i'] -else: - lib_sources = ['SWIG/_m2crypto_wrap.c'] - - m2crypto = setuptools.Extension(name='M2Crypto._m2crypto', - sources=lib_sources, + sources=['SWIG/_m2crypto.i'], extra_compile_args=list(x_comp_args), # Uncomment to build Universal Mac binaries # extra_link_args = -- cgit v1.2.1