added feature to setup.py
Matthew Rodriguez DSD staff <[email protected]>
| Newsgroups | gmane.comp.python.cryptography |
|---|---|
| Message-ID | <[email protected]> |
I added a feature to setup.py in m2crypto, so that it would take an --openssl argument. This would point to the prefix of the openssl installation. This is useful for me, because I'm compiling against openssl-0.9.8a libraries which are installed in a non standard location. I'm using the 0.15 branch.
setup.py.patch
(text/x-patch, 1.4 KB)
--- setup.py 2005-11-07 10:55:36.000000000 -0800
+++ /home/portnoy/u5/mateo/Python/M2Crypto/branches/0.15/setup.py 2005-11-07 10:41:57.000000000 -0800
@@ -12,6 +12,29 @@
from distutils.core import setup, Extension
from distutils.command import build_ext
+global_option_dict = {'openssl_prefix': '/usr'}
+
+def print_help():
+ print "M2Crypto help"
+ print "--openssl=path_to_openssl, defaults to /usr"
+ print "--help, this usage message"
+
+def parse_args():
+ global global_option_dict
+ args = sys.argv[1:]
+ for arg in args:
+ if arg.find("--openssl") != -1:
+ sys.argv.remove(arg)
+ prefix = string.split(arg, '=')[1]
+ global_option_dict['openssl_prefix'] = prefix
+
+ if arg.find("--help") != -1:
+ sys.argv.remove(arg)
+ print_help()
+ sys.exit(0)
+
+parse_args()
+
if sys.version_info < (2,4):
# This copy of swig_sources is from Python 2.2.
@@ -74,8 +97,10 @@
extra_compile_args = [ "-DTHREADING" ]
elif os.name == 'posix':
- include_dirs = [my_inc, '/usr/include']
- library_dirs = ['/usr/lib']
+ include_dir = os.path.join(global_option_dict['openssl_prefix'], "include")
+ include_dirs = [my_inc, include_dir]
+ library_dir = os.path.join(global_option_dict['openssl_prefix'], "lib")
+ library_dirs = [library_dir]
libraries = ['ssl', 'crypto']
extra_compile_args = [ "-DTHREADING" ]