summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2015-12-22 05:23:27 +0100
committerMatěj Cepl <mcepl@cepl.eu>2016-01-20 23:01:06 +0100
commit3cc0bd1288fc1e99b46ffcf44ef643c99dfd9f67 (patch)
tree1ff577b28b542cd04b0383bb7439232bcff1f0b9 /setup.py
parent2786294999359054159d6c5413df18eb46cc551f (diff)
downloadm2crypto-3cc0bd1288fc1e99b46ffcf44ef643c99dfd9f67.tar.gz
Move openssl option to build_ext, but read it from options of build as well.
Fixes #89
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/setup.py b/setup.py
index 95e42ed..ad623ba 100644
--- a/setup.py
+++ b/setup.py
@@ -16,6 +16,7 @@ import sys
import setuptools
+from distutils.command import build
from distutils.file_util import copy_file
from setuptools.command import build_ext
@@ -31,6 +32,19 @@ else:
_multiarch = sysconfig.get_config_var("MULTIARCH")
+class _M2CryptoBuild(build.build):
+ '''Specialization of build to enable swig_opts to inherit any
+ include_dirs settings made at the command line or in a setup.cfg file'''
+ user_options = build.build.user_options + \
+ [('openssl=', 'o', 'Prefix for openssl installation location')]
+
+ def initialize_options(self):
+ '''Overload to enable custom openssl settings to be picked up'''
+
+ build.build.initialize_options(self)
+ self.openssl = None
+
+
class _M2CryptoBuildExt(build_ext.build_ext):
'''Specialization of build_ext to enable swig_opts to inherit any
include_dirs settings made at the command line or in a setup.cfg file'''
@@ -56,6 +70,12 @@ class _M2CryptoBuildExt(build_ext.build_ext):
build_ext.build_ext.finalize_options(self)
+ openssl_opts = [x for x in sys.argv if '--openssl=' in x]
+ if openssl_opts:
+ _openssl = openssl_opts[0].split('=')[1]
+ if os.path.isdir(_openssl):
+ self.openssl = _openssl
+
self.include_dirs.append(os.path.join(self.openssl, 'include'))
openssl_library_dir = os.path.join(self.openssl, 'lib')
@@ -159,5 +179,8 @@ setuptools.setup(
ext_modules=[m2crypto],
test_suite='tests.alltests.suite',
install_requires=requires_list,
- cmdclass={'build_ext': _M2CryptoBuildExt}
+ cmdclass={
+ 'build_ext': _M2CryptoBuildExt,
+ 'build': _M2CryptoBuild
+ }
)