Ignore:
Timestamp:
11/06/07 15:59:54 (13 years ago)
Author:
pjkersha
Message:

Clean up ready for submission as M2Crypto patch:

  • conditional import of setuptools
  • move self.include_dirs and self.library_dirs initialisation into

finalize_options method otherwise they get overwritten if a config file
containing their equivalent is set

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/branches/Dependencies/m2crypto/setup.py

    r2250 r2574  
    1111 
    1212import os, sys 
    13 from setuptools import setup 
     13try: 
     14    from setuptools import setup 
     15except ImportError: 
     16    from distutils.core import setup 
     17 
    1418from distutils.core import Extension 
    1519from distutils.command import build_ext 
     
    1822import optparse 
    1923 
    20 #  
     24 
    2125class _M2CryptoBuildExt(build_ext.build_ext): 
    2226    '''Specialization of build_ext to enable swig_opts to inherit any  
     
    2731    def initialize_options(self): 
    2832        '''Overload to enable custom openssl settings to be picked up''' 
     33 
    2934        build_ext.build_ext.initialize_options(self) 
    3035         
     
    3742            self.libraries = ['ssl', 'crypto'] 
    3843            self.openssl = '/usr' 
    39              
    40         if sys.platform == 'cygwin': 
    41             # Cygwin SHOULD work (there's code in distutils), but 
    42             # if one first starts a Windows command prompt, then bash, 
    43             # the distutils code does not seem to work. If you start 
    44             # Cygwin directly, then it would work even without this change. 
    45             # Someday distutils will be fixed and this won't be needed. 
    46             self.library_dirs = [os.path.join(self.openssl, 'bin')] 
    47                 
    48         self.include_dirs = [os.path.join(os.getcwd(), 'SWIG')] 
    4944        
    5045     
     
    5247        '''Overloaded build_ext implementation to append custom openssl 
    5348        include file and library linking options''' 
     49 
    5450        build_ext.build_ext.finalize_options(self) 
    5551 
     
    6056                          [opensslIncludeDir]] 
    6157         
    62         self.include_dirs += [os.path.join(self.openssl, opensslIncludeDir)]         
     58        self.include_dirs += [os.path.join(self.openssl, opensslIncludeDir), 
     59                              os.path.join(os.getcwd(), 'SWIG')]         
     60             
     61        if sys.platform == 'cygwin': 
     62            # Cygwin SHOULD work (there's code in distutils), but 
     63            # if one first starts a Windows command prompt, then bash, 
     64            # the distutils code does not seem to work. If you start 
     65            # Cygwin directly, then it would work even without this change. 
     66            # Someday distutils will be fixed and this won't be needed. 
     67            self.library_dirs += [os.path.join(self.openssl, 'bin')] 
     68                
    6369        self.library_dirs += [os.path.join(self.openssl, opensslLibraryDir)] 
    6470 
Note: See TracChangeset for help on using the changeset viewer.