summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
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
+ }
)