diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2015-11-20 13:54:52 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2015-11-25 20:59:55 +0100 |
commit | 1df113bb25adaf3a59dd22ca4bd3743694c6aafa (patch) | |
tree | c02ae6efa39afa52c155c7fccb3af5e2e9b4027e /setup.py | |
parent | d952b1f06c882d10201734eebcc8ac357a857c98 (diff) | |
download | m2crypto-1df113bb25adaf3a59dd22ca4bd3743694c6aafa.tar.gz |
Make the construct working even for python 26, where there is no sysconfig module.
Fixes #69 and fixes #49
Also, remove fedora_setup.sh.
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -12,7 +12,6 @@ Copyright 2008-2011 Heikki Toivonen. All rights reserved. """ import sys -import sysconfig requires_list = [] if sys.version_info <= (2, 6): requires_list.append("unittest2") @@ -29,6 +28,15 @@ except ImportError: from distutils.core import Extension from distutils.file_util import copy_file +try: + import sysconfig + _multiarch = sysconfig.get_config_var("MULTIARCH") +except ImportError: + import subprocess + pid = subprocess.Popen(['cc', '--print-multiarch'], + stdout=subprocess.PIPE) + _multiarch = pid.communicate()[0].strip() + class _M2CryptoBuildExt(build_ext.build_ext): '''Specialization of build_ext to enable swig_opts to inherit any @@ -64,12 +72,12 @@ class _M2CryptoBuildExt(build_ext.build_ext): # I guess 'posix' includes Mac OS X, so we have to make an # exclusion if platform.system() == "Linux": - multiarch = sysconfig.get_config_var("MULTIARCH") - self.include_dirs.append( - os.path.join(self.openssl, 'include', 'openssl')) - if multiarch: # on Fedora/RHEL it is an empty string + if _multiarch: # on Fedora/RHEL it is an empty string + self.include_dirs.append( + os.path.join(self.openssl, 'include', _multiarch)) + else: self.include_dirs.append( - os.path.join(self.openssl, 'include', multiarch)) + os.path.join(self.openssl, 'include', 'openssl')) self.swig_opts.append('-D__%s__' % platform.machine().lower()) |