diff options
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 48 |
1 files changed, 26 insertions, 22 deletions
@@ -12,6 +12,29 @@ import os, sys from distutils.core import setup, Extension from distutils.command import build_ext +my_inc = os.path.join(os.getcwd(), 'SWIG') + +if os.name == 'nt': + openssl_dir = 'c:\\pkg\\openssl' + include_dirs = [my_inc, openssl_dir + '/include'] + swig_opts_str = '-I"' + openssl_dir + os.sep + 'include"' + library_dirs = [openssl_dir + '\\lib'] + libraries = ['ssleay32', 'libeay32'] + +elif os.name == 'posix': + include_dirs = [my_inc, '/usr/include'] + swig_opts_str = '-I/usr/include' + library_dirs = ['/usr/lib'] + if sys.platform == 'cygwin': + # Cygwin SHOULD work (there's code in distutils), but + # if one first starts a Windows command prompt, then bash, + # the distutils code does not seem to work. If you start + # Cygwin directly, then it would work even without this change. + # Someday distutils will be fixed and this won't be needed. + library_dirs += ['/usr/bin'] + libraries = ['ssl', 'crypto'] + + if sys.version_info < (2,4): # This copy of swig_sources is from Python 2.2. @@ -55,6 +78,8 @@ if sys.version_info < (2,4): if self.swig_cpp: swig_cmd.append("-c++") + swig_cmd.append(swig_opts_str) + for source in swig_sources: target = swig_targets[source] self.announce("swigging %s to %s" % (source, target)) @@ -64,27 +89,6 @@ if sys.version_info < (2,4): build_ext.build_ext.swig_sources = swig_sources -my_inc = os.path.join(os.getcwd(), 'SWIG') - -if os.name == 'nt': - openssl_dir = 'c:\\pkg\\openssl' - include_dirs = [my_inc, openssl_dir + '/include'] - swig_opts = ['-I"' + openssl_dir + os.sep + 'include"'] - library_dirs = [openssl_dir + '\\lib'] - libraries = ['ssleay32', 'libeay32'] - -elif os.name == 'posix': - include_dirs = [my_inc, '/usr/include'] - swig_opts = ['-I/usr/include'] - library_dirs = ['/usr/lib'] - if sys.platform == 'cygwin': - # Cygwin SHOULD work (there's code in distutils), but - # if one first starts a Windows command prompt, then bash, - # the distutils code does not seem to work. If you start - # Cygwin directly, then it would work even without this change. - # Someday distutils will be fixed and this won't be needed. - library_dirs += ['/usr/bin'] - libraries = ['ssl', 'crypto'] m2crypto = Extension(name = '__m2crypto', sources = ['SWIG/_m2crypto.i'], @@ -93,7 +97,7 @@ m2crypto = Extension(name = '__m2crypto', libraries = libraries, extra_compile_args = ['-DTHREADING', '-DSWIG_COBJECT_PYTHON'], - swig_opts = swig_opts + swig_opts = [swig_opts_str] ) setup(name = 'M2Crypto', |