Ñò
$8Zc        
   @   s‹   d  Z  d Z d d k Z d d k Z d d k Td d k l Z d d k Td d k l	 Z	 d d k
 l Z d „  Z d	 e f d
 „  ƒ  YZ d S(   s´   distutils.command.build_clib

Implements the Distutils 'build_clib' command, to build a C/C++ library
that is included in the module distribution and needed by an extension
module.s   $Id$iÿÿÿÿN(   t   *(   t   Command(   t   customize_compiler(   t   logc          C   s   d d k  l }  |  ƒ  d  S(   Niÿÿÿÿ(   t   show_compilers(   t   distutils.ccompilerR   (   R   (    (    s2   /usr/lib/python2.6/distutils/command/build_clib.pyR      s    t
   build_clibc           B   sƒ   e  Z d  Z d d d d d g Z d d
 g Z d d d e f g Z d „  Z d „  Z	 d „  Z
 d „  Z d „  Z d „  Z d „  Z RS(   s/   build C/C++ libraries used by Python extensionss
   build-clibt   bs%   directory to build C/C++ libraries tos
   build-tempt   ts,   directory to put temporary build by-productst   debugt   gs"   compile with debugging informationt   forcet   fs2   forcibly build everything (ignore file timestamps)s	   compiler=t   cs   specify the compiler types   help-compilers   list available compilersc         C   sU   d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d |  _ d  |  _	 d  S(   Ni    (
   t   NoneR   t
   build_tempt	   librariest   include_dirst   definet   undefR	   R   t   compiler(   t   self(    (    s2   /usr/lib/python2.6/distutils/command/build_clib.pyt   initialize_options9   s    								c         C   s¬   |  i  d d d d	 d
 d ƒ |  i i |  _ |  i o |  i |  i ƒ n |  i d  j o |  i i p g  |  _ n t |  i ƒ t j o t i	 |  i t
 i ƒ |  _ n d  S(   Nt   buildR   R   R   R	   R   (   s
   build_temps
   build_clib(   s
   build_temps
   build_temp(   s   compilers   compiler(   s   debugs   debug(   s   forces   force(   t   set_undefined_optionst   distributionR   t   check_library_listR   R   t   typet
   StringTypet   stringt   splitt   ost   pathsep(   R   (    (    s2   /usr/lib/python2.6/distutils/command/build_clib.pyt   finalize_optionsK   s    	
c         C   s  |  i  p d  Sd d k l } | d |  i d |  i d |  i ƒ |  _ t |  i ƒ |  i d  j	 o |  i i	 |  i ƒ n |  i
 d  j	 o1 x. |  i
 D] \ } } |  i i | | ƒ q” Wn |  i d  j	 o( x% |  i D] } |  i i | ƒ qÕ Wn |  i |  i  ƒ d  S(   Niÿÿÿÿ(   t   new_compilerR   t   dry_runR   (   R   R   R"   R   R#   R   R   R   R   t   set_include_dirsR   t   define_macroR   t   undefine_macrot   build_libraries(   R   R"   t   namet   valuet   macro(    (    s2   /usr/lib/python2.6/distutils/command/build_clib.pyt   runi   s$    
	
 
 c         C   s  t  | ƒ t j	 o t d ‚ n xß | D]× } t  | ƒ t j	 o  t | ƒ d j o t d ‚ n t  | d ƒ t j	 o t d d ‚ n d | d j p$ t i d j o- t i | d j o t d d	 | d ‚ n t  | d
 ƒ t j	 o t d d ‚ q' q' Wd S(   s:  Ensure that the list of libraries (presumably provided as a
           command option 'libraries') is valid, i.e. it is a list of
           2-tuples, where the tuples are (library_name, build_info_dict).
           Raise DistutilsSetupError if the structure is invalid anywhere;
           just returns otherwise.s+   'libraries' option must be a list of tuplesi   s*   each element of 'libraries' must a 2-tuplei    s+   first element of each tuple in 'libraries' s#   must be a string (the library name)t   /s   bad library name '%s': s$   may not contain directory separatorsi   s,   second element of each tuple in 'libraries' s!   must be a dictionary (build info)N(	   R   t   ListTypet   DistutilsSetupErrort	   TupleTypet   lenR   R   t   sept   DictionaryType(   R   R   t   lib(    (    s2   /usr/lib/python2.6/distutils/command/build_clib.pyR   „   s*    

 &
5c         C   s@   |  i  p d  Sg  } x$ |  i  D] \ } } | i | ƒ q W| S(   N(   R   R   t   append(   R   t	   lib_namest   lib_namet
   build_info(    (    s2   /usr/lib/python2.6/distutils/command/build_clib.pyt   get_library_namesª   s    

 c         C   s‡   |  i  |  i ƒ g  } xj |  i D]_ \ } } | i d ƒ } | d  j p t | ƒ t t f j o t d | ‚ n | i | ƒ q  W| S(   Nt   sourcessf   in 'libraries' option (library '%s'), 'sources' must be present and must be a list of source filenames(	   R   R   t   getR   R   R-   R/   R.   t   extend(   R   t	   filenamesR6   R7   R9   (    (    s2   /usr/lib/python2.6/distutils/command/build_clib.pyt   get_source_files¹   s    
 c         C   sø   xñ | D]é \ } } | i  d ƒ } | d  j p t | ƒ t t f j o t d d d | ‚ n t | ƒ } t i d | ƒ | i  d ƒ } | i  d ƒ } |  i	 i
 | d |  i d | d | d	 |  i ƒ} |  i	 i | | d |  i d	 |  i ƒq Wd  S(
   NR9   s&   in 'libraries' option (library '%s'), s&   'sources' must be present and must be s   a list of source filenamess   building '%s' libraryt   macrosR   t
   output_dirR	   (   R:   R   R   R-   R/   R.   t   listR   t   infoR   t   compileR   R	   t   create_static_libR   (   R   R   R6   R7   R9   R>   R   t   objects(    (    s2   /usr/lib/python2.6/distutils/command/build_clib.pyR'   Ë   s&     &		(   s
   build-clibR   s%   directory to build C/C++ libraries to(   s
   build-tempR   s,   directory to put temporary build by-products(   s   debugR
   s"   compile with debugging information(   s   forceR   s2   forcibly build everything (ignore file timestamps)(   s	   compiler=R   s   specify the compiler typeN(   t   __name__t
   __module__t   descriptiont   user_optionst   boolean_optionsR   R   t   help_optionsR   R!   R+   R   R8   R=   R'   (    (    (    s2   /usr/lib/python2.6/distutils/command/build_clib.pyR   !   s*        					&		(   t   __doc__t   __revision__R   R   t   typest   distutils.coreR   t   distutils.errorst   distutils.sysconfigR   t	   distutilsR   R   R   (    (    (    s2   /usr/lib/python2.6/distutils/command/build_clib.pyt   <module>   s   

	