-í
ì¶<c       s¤   d  Z  d Z d k Z d k Z d k Z d k Z d k Td k l Z d k	 Td k
 l Z d k l Z d k l Z e i d ƒ Z d	 „  Z d
 e f d „  ƒ  YZ d S(   s¶   distutils.command.build_ext

Implements the Distutils 'build_ext' command, for building extension
modules (currently limited to C extensions, should accommodate C++
extensions ASAP).s9   $Id: build_ext.py,v 1.77 2001/12/06 22:59:54 fdrake Exp $N(   s   *(   s   Command(   s   customize_compiler(   s   newer_group(   s	   Extensions3   ^[a-zA-Z_][a-zA-Z_0-9]*(\.[a-zA-Z_][a-zA-Z_0-9]*)*$c     s   d k  l }  |  ƒ  d  S(   N(   s   show_compilers(   s   distutils.ccompilers   show_compilers(   s   show_compilers(    (    s1   /usr/lib/python2.2/distutils/command/build_ext.pys   show_compilers s    s	   build_extc      sz  t  Z d Z d e i Z d d d f d d d f d	 d
 d d f d d d e f d d d f d d d f d d d f d d d e f d d d f d d  d! f d" d# d$ f d% d& d' f d( d) d* f d+ e d, f g Z d	 d" d% d+ g Z d- e d. e	 f g Z
 d/ „  Z d0 „  Z d1 „  Z d2 „  Z d3 „  Z d4 „  Z d5 „  Z d6 „  Z d7 „  Z d8 „  Z d9 „  Z d: „  Z d; „  Z d< „  Z RS(=   Ns8   build C/C++ extensions (compile/link to build directory)s    (separated by '%s')s
   build-lib=s   bs(   directory for compiled extension moduless   build-temp=s   ts1   directory for temporary files (build by-products)s   inplaces   is=   ignore build-lib and put compiled extensions into the source s,   directory alongside your pure Python moduless   include-dirs=s   Is.   list of directories to search for header filess   define=s   Ds   C preprocessor macros to defines   undef=s   Us!   C preprocessor macros to undefines
   libraries=s   ls!   external C libraries to link withs   library-dirs=s   Ls.   directories to search for external C librariess   rpath=s   Rs7   directories to search for shared C libraries at runtimes   link-objects=s   Os2   extra explicit link objects to include in the links   debugs   gs'   compile/link with debugging informations   forces   fs2   forcibly build everything (ignore file timestamps)s	   compiler=s   cs   specify the compiler types   swig-cpps)   make SWIG create C++ files (default is C)s   help-compilers   list available compilersc    s”   t  |  _ t  |  _ t  |  _ d |  _ t  |  _ t  |  _ t  |  _ t  |  _	 t  |  _
 t  |  _ t  |  _ t  |  _ t  |  _ t  |  _ t  |  _ t  |  _ d  S(   Ni    (   s   Nones   selfs
   extensionss	   build_libs
   build_temps   inplaces   packages   include_dirss   defines   undefs	   librariess   library_dirss   rpaths   link_objectss   debugs   forces   compilers   swig_cpp(   s   self(    (    s1   /usr/lib/python2.2/distutils/command/build_ext.pys   initialize_options\ s     															c    sk  d k  l } |  i d d d f d d f d d f d d f d d f ƒ |  i t j o |  i i |  _ n |  i i |  _	 | i
 ƒ  } | i
 d d	 ƒ } |  i t j o |  i i p g  |  _ n t |  i ƒ t j o t i |  i t i ƒ |  _ n |  i i | ƒ | | j o |  i i | ƒ n t |  i ƒ t j o |  i g |  _ n |  i t j o g  |  _ n |  i t j o g  |  _ n6 t |  i ƒ t j o t i |  i t i ƒ |  _ n |  i t j o g  |  _ n6 t |  i ƒ t j o t i |  i t i ƒ |  _ n t i d
 j oj |  i i t i i t i d ƒ ƒ |  i o t i i |  i d ƒ |  _ n t i i |  i d ƒ |  _ n t i d  d j oj t i  t i! t i ƒ d j o7 |  i i t i i t i" d d t i# d  d ƒ ƒ n |  i i d ƒ n |  i$ o. t i |  i$ d ƒ } t& d „  | ƒ |  _$ n |  i' o t i |  i' d ƒ |  _' n d  S(   N(   s	   sysconfigs   builds	   build_libs
   build_temps   compilers   debugs   forces   plat_specifici   s   nts   libss   Debugs   Releasei   s   cygwiniÿÿÿÿs   libs   pythoni   s   configs   .s   ,c    s
   |  d f S(   Ns   1(   s   symbol(   s   symbol(    (    s1   /usr/lib/python2.2/distutils/command/build_ext.pys   <lambda>» s    ((   s	   distutilss	   sysconfigs   selfs   set_undefined_optionss   packages   Nones   distributions   ext_packages   ext_moduless
   extensionss   get_python_incs
   py_includes   plat_py_includes   include_dirss   types
   StringTypes   strings   splits   oss   pathseps   appends	   librariess   library_dirss   rpaths   names   paths   joins   syss   exec_prefixs   debugs
   build_temps   platforms   finds
   executables   prefixs   versions   defines   definess   maps   undef(   s   selfs   plat_py_includes
   py_includes	   sysconfigs   defines(    (    s1   /usr/lib/python2.2/distutils/command/build_ext.pys   finalize_optionsp sZ    					"
7

c  	  sú  d k  l } |  i o d  Sn |  i i ƒ  oC |  i d ƒ } |  i i	 | i
 ƒ  p g  ƒ |  i i | i ƒ n | d |  i d |  i d |  i d |  i ƒ |  _ t |  i ƒ |  i t j	 o |  i i |  i ƒ n |  i t j	 o1 x* |  i D] \ } } |  i i | | ƒ qñ Wn |  i t j	 o( x! |  i D] } |  i i | ƒ q2Wn |  i t j	 o |  i i |  i ƒ n |  i t j	 o |  i i |  i ƒ n |  i t j	 o |  i i |  i ƒ n |  i  t j	 o |  i i! |  i  ƒ n |  i" ƒ  d  S(   N(   s   new_compilers
   build_clibs   compilers   verboses   dry_runs   force(#   s   distutils.ccompilers   new_compilers   selfs
   extensionss   distributions   has_c_librariess   get_finalized_commands
   build_clibs	   librariess   extends   get_library_namess   library_dirss   appends   compilers   verboses   dry_runs   forces   customize_compilers   include_dirss   Nones   set_include_dirss   defines   names   values   define_macros   undefs   macros   undefine_macros   set_librariess   set_library_dirss   rpaths   set_runtime_library_dirss   link_objectss   set_link_objectss   build_extensions(   s   selfs   names   macros
   build_clibs   values   new_compiler(    (    s1   /usr/lib/python2.2/distutils/command/build_ext.pys   runÆ s>    		
 
 c 
   sz  t  | ƒ t j	 o t d ‚ n xSt t | ƒ ƒ D]?} | | }	 t |	 t	 ƒ o q3 n |	 \ } } |  i d | ƒ t  |	 ƒ t j	 o t |	 ƒ d j o t d ‚ n t  | ƒ t j o t i | ƒ o t d ‚ n t  | ƒ t j	 o t d ‚ n t	 | | d ƒ }	 xP d d	 d
 d d d f D]6 } | i | ƒ } | t j	 o t |	 | | ƒ n q'W| i d ƒ |	 _ | i d ƒ o |  i d ƒ n | i d ƒ } | o¾ g  |	 _ g  |	 _ x¥ | D] } t  | ƒ t j o! d t | ƒ j o
 d j n o t d ‚ n t | ƒ d j o |	 i i | d ƒ n( t | ƒ d j o |	 i i | ƒ n qÃWn |	 | | <q3 Wd S(   s¬  Ensure that the list of extensions (presumably provided as a
        command option 'extensions') is valid, i.e. it is a list of
        Extension objects.  We also support the old-style list of 2-tuples,
        where the tuples are (ext_name, build_info), which are converted to
        Extension instances here.

        Raise DistutilsSetupError if the structure is invalid anywhere;
        just returns otherwise.
        s:   'ext_modules' option must be a list of Extension instancessu   old-style (ext_name, build_info) tuple found in ext_modules for extension '%s'-- please convert to Extension instancei   sM   each element of 'ext_modules' option must be an Extension instance or 2-tuplesR   first element of each tuple in 'ext_modules' must be the extension name (a string)sO   second element of each tuple in 'ext_modules' must be a dictionary (build info)s   sourcess   include_dirss   library_dirss	   librariess   extra_objectss   extra_compile_argss   extra_link_argss   rpaths   def_files9   'def_file' element of build info dict no longer supporteds   macrosi   s9   'macros' element of build info dict must be 1- or 2-tuplei    N(   s   types
   extensionss   ListTypes   DistutilsSetupErrors   ranges   lens   is   exts
   isinstances	   Extensions   ext_names
   build_infos   selfs   warns	   TupleTypes
   StringTypes   extension_name_res   matchs   DictionaryTypes   keys   gets   vals   Nones   setattrs   runtime_library_dirss   has_keys   macross   define_macross   undef_macross   macros   append(
   s   selfs
   extensionss   keys   ext_names
   build_infos   vals   is   macros   macross   ext(    (    s1   /usr/lib/python2.2/distutils/command/build_ext.pys   check_extensions_listsL    	  
&$ 		 8c    sB   |  i |  i ƒ g  } x! |  i D] } | i | i ƒ q  W| Sd  S(   N(   s   selfs   check_extensions_lists
   extensionss	   filenamess   exts   extends   sources(   s   selfs   exts	   filenames(    (    s1   /usr/lib/python2.2/distutils/command/build_ext.pys   get_source_files[s    
 c    sl   |  i |  i ƒ g  } xK |  i D]@ } |  i | i ƒ } | i t	 i
 i |  i |  i | ƒ ƒ ƒ q  W| Sd  S(   N(   s   selfs   check_extensions_lists
   extensionss   outputss   exts   get_ext_fullnames   names   fullnames   appends   oss   paths   joins	   build_libs   get_ext_filename(   s   selfs   outputss   fullnames   ext(    (    s1   /usr/lib/python2.2/distutils/command/build_ext.pys   get_outputsfs    
 c    s5   |  i |  i ƒ x |  i D] } |  i | ƒ q Wd  S(   N(   s   selfs   check_extensions_lists
   extensionss   exts   build_extension(   s   selfs   ext(    (    s1   /usr/lib/python2.2/distutils/command/build_ext.pys   build_extensionsys    
 c    s¨  | i } | t j p t | ƒ t t f j o t d d d | i ‚ n t | ƒ } |  i
 | i ƒ } |  i ou t i | d ƒ } t i | d d !d ƒ } | d } |  i d ƒ } | i | ƒ } t i i | |  i | ƒ ƒ } n" t i i |  i |  i | ƒ ƒ } |  i p t | | d ƒ o |  i d	 | i ƒ d  Sn |  i d
 | i ƒ |  i | ƒ } | i  p g  }	 | i" }
 x! | i$ D] } |
 i& | f ƒ qŠWt i' i( d ƒ o! |	 i) t i t i' d ƒ ƒ n |  i* i+ | d |  i, d |
 d | i- d |  i. d |	 ƒ} | |  _0 | i1 o | i) | i1 ƒ n | i2 p g  }	 |  i* i3 | | d |  i4 | ƒ d | i5 d | i6 d |	 d |  i7 | ƒ d |  i. d |  i, ƒd  S(   Ns*   in 'ext_modules' option (extension '%s'), s&   'sources' must be present and must be s   a list of source filenamess   .i    iÿÿÿÿs   build_pys   newers$   skipping '%s' extension (up-to-date)s   building '%s' extensions   CFLAGSs
   output_dirs   macross   include_dirss   debugs   extra_postargss	   librariess   library_dirss   runtime_library_dirss   export_symbolss
   build_temp(8   s   exts   sourcess   Nones   types   ListTypes	   TupleTypes   DistutilsSetupErrors   names   lists   selfs   get_ext_fullnames   fullnames   inplaces   strings   splits   modpaths   joins   packages   bases   get_finalized_commands   build_pys   get_package_dirs   package_dirs   oss   paths   get_ext_filenames   ext_filenames	   build_libs   forces   newer_groups   announces   swig_sourcess   extra_compile_argss
   extra_argss   define_macross   macross   undef_macross   undefs   appends   environs   has_keys   extends   compilers   compiles
   build_temps   include_dirss   debugs   objectss   _built_objectss   extra_objectss   extra_link_argss   link_shared_objects   get_librariess   library_dirss   runtime_library_dirss   get_export_symbols(   s   selfs   exts   sourcess   bases   modpaths   ext_filenames   undefs   build_pys   packages
   extra_argss   macross   objectss   fullnames   package_dir(    (    s1   /usr/lib/python2.2/distutils/command/build_ext.pys   build_extensionsZ    	&



 !			

			c    s<  g  }
 g  } h  } |  i o
 d }	 n d }	 xp | D]h } t i	 i
 | ƒ \ } } | d j o0 |
 i | |	 ƒ | i | ƒ |
 d | | <n |
 i | ƒ q3 W| o |
 Sn |  i ƒ  } | d d d g } |  i o | i d ƒ n xI | D]A } | | } |  i d	 | | f ƒ |  i | d
 | | g ƒ qï W|
 Sd S(   sü   Walk the list of source files in 'sources', looking for SWIG
        interface (.i) files.  Run SWIG on all that are found, and
        return a modified 'sources' list with SWIG source files replaced
        by the generated C (or C++) files.
        s   .cpps   .cs   .iiÿÿÿÿs   -pythons   -dnones   -ISWIGs   -c++s   swigging %s to %ss   -oN(   s   new_sourcess   swig_sourcess   swig_targetss   selfs   swig_cpps
   target_exts   sourcess   sources   oss   paths   splitexts   bases   exts   appends	   find_swigs   swigs   swig_cmds   targets   announces   spawn(   s   selfs   sourcess   swig_sourcess   sources   swigs   swig_cmds   swig_targetss   exts   bases
   target_exts   new_sourcess   target(    (    s1   /usr/lib/python2.2/distutils/command/build_ext.pys   swig_sourcesés6     

 
 
c    s’   t  i d j o d Snw t  i d j oV xO d d d f D]: } t  i i d | d ƒ } t  i i | ƒ o | Sn q8 Wd Sn t d	 t  i ‚ d
 S(   s›   Return the name of the SWIG executable.  On Unix, this is
        just "swig" -- it should be in the PATH.  Tries a bit harder on
        Windows.
        s   posixs   swigs   nts   1.3s   1.2s   1.1s	   c:\swig%ss   swig.exes>   I don't know how to find (much less run) SWIG on platform '%s'N(   s   oss   names   verss   paths   joins   fns   isfiles   DistutilsPlatformError(   s   selfs   verss   fn(    (    s1   /usr/lib/python2.2/distutils/command/build_ext.pys	   find_swigs      c    s+   |  i t j o | Sn |  i d | Sd  S(   Ns   .(   s   selfs   packages   Nones   ext_name(   s   selfs   ext_name(    (    s1   /usr/lib/python2.2/distutils/command/build_ext.pys   get_ext_fullname7s    c    s   d k  l } t i | d ƒ } | d ƒ } t i d j o |  i
 o t t i i | ƒ d | Sn t t i i | ƒ | Sd S(   s¦   Convert the name of an extension (eg. "foo.bar") into the name
        of the file from which it will be loaded (eg. "foo/bar.so", or
        "foo\bar.pyd").
        (   s   get_config_vars   .s   SOs   nts   _dN(   s   distutils.sysconfigs   get_config_vars   strings   splits   ext_names   ext_paths   so_exts   oss   names   selfs   debugs   applys   paths   join(   s   selfs   ext_names   get_config_vars   so_exts   ext_path(    (    s1   /usr/lib/python2.2/distutils/command/build_ext.pys   get_ext_filename=s     c    sL   d t  i | i d ƒ d } | | i j o | i i | ƒ n | i Sd S(   s  Return the list of symbols that a shared extension has to
        export.  This either uses 'ext.export_symbols' or, if it's not
        provided, "init" + module_name.  Only relevant on Windows, where
        the .pyd file (DLL) must export the module "init" function.
        s   inits   .iÿÿÿÿN(   s   strings   splits   exts   names   initfunc_names   export_symbolss   append(   s   selfs   exts   initfunc_name(    (    s1   /usr/lib/python2.2/distutils/command/build_ext.pys   get_export_symbolsKs
     c    sÜ   d k  l } t i d j o t |  i | ƒ oR d } |  i o | d } n | t i	 d ?t i	 d ?d @f } | i | g SnV t i d  d	 j o: d
 } | t i	 d ?t i	 d ?d @f } | i | g Sn | i Sd S(   sÓ   Return the list of libraries to link against when building a
        shared extension.  On most platforms, this is just 'ext.libraries';
        on Windows, we add the Python library (eg. python20.dll).
        (   s   MSVCCompilers   win32s
   python%d%ds   _di   i   iÿ   i   s   cygwins   python%d.%dN(   s   distutils.msvccompilers   MSVCCompilers   syss   platforms
   isinstances   selfs   compilers   templates   debugs
   hexversions	   pythonlibs   exts	   libraries(   s   selfs   exts   MSVCCompilers   templates	   pythonlib(    (    s1   /usr/lib/python2.2/distutils/command/build_ext.pys   get_librariesWs     $
""(   s   __name__s
   __module__s   descriptions   oss   pathseps   sep_bys   Nones   user_optionss   boolean_optionss   show_compilerss   help_optionss   initialize_optionss   finalize_optionss   runs   check_extensions_lists   get_source_filess   get_outputss   build_extensionss   build_extensions   swig_sourcess	   find_swigs   get_ext_fullnames   get_ext_filenames   get_export_symbolss   get_libraries(    (    (    s1   /usr/lib/python2.2/distutils/command/build_ext.pys	   build_ext s&   º 		V	?	V				h	0				(   s   __doc__s   __revision__s   syss   oss   strings   res   typess   distutils.cores   Commands   distutils.errorss   distutils.sysconfigs   customize_compilers   distutils.dep_utils   newer_groups   distutils.extensions	   Extensions   compiles   extension_name_res   show_compilerss	   build_ext(   s   customize_compilers   __revision__s   strings	   Extensions   oss   syss   res   Commands   show_compilerss   extension_name_res   newer_groups	   build_ext(    (    s1   /usr/lib/python2.2/distutils/command/build_ext.pys   ? s   $	