Ñò
$8Zc           @   s×   d  Z  d Z d d k Z d d k Z d d k Z d d k l Z l Z d d k l	 Z	 d d k
 l Z d d k l Z l Z l Z d d k l Z l Z l Z l Z d d	 k l Z d
 „  Z d e f d „  ƒ  YZ d S(   s9  distutils.unixccompiler

Contains the UnixCCompiler class, a subclass of CCompiler that handles
the "typical" Unix-style command-line C compiler:
  * macros defined with -Dname[=value]
  * macros undefined with -Uname
  * include search directories specified with -Idir
  * libraries specified with -lllib
  * library search directories specified with -Ldir
  * compile handled by 'cc' (or similar) executable with -c option:
    compiles .c to .o
  * link static library handled by 'ar' command (possibly with 'ranlib')
  * link shared library handled by 'cc -shared'
s   $Id$iÿÿÿÿN(   t
   StringTypet   NoneType(   t	   sysconfig(   t   newer(   t	   CCompilert   gen_preprocess_optionst   gen_lib_options(   t   DistutilsExecErrort   CompileErrort   LibErrort	   LinkError(   t   logc   	      C   sâ  d } } t  |  ƒ }  t i ƒ  d } t | i d ƒ d ƒ } | d j  o t } } n d | j } d | j } | p d t i j oB x? y! |  i d ƒ } |  | | d 5WqŒ t j
 o PqŒ XqŒ n d t i j o# | o |  t i d i ƒ  }  n | o; y! |  i d ƒ } |  | | d 5Wq@t j
 o q@Xn d } d | j o! | i d ƒ } | | d } n/ d |  j o! |  i d ƒ } |  | d } n | o5 t i
 i | ƒ o! t i d	 | ƒ t i d
 ƒ n |  S(   se  
    This function will strip '-isysroot PATH' and '-arch ARCH' from the
    compile flags if the user has specified one them in extra_compile_flags.

    This is needed because '-arch ARCH' adds another architecture to the
    build, without a way to remove an architecture. Furthermore GCC will
    barf if multiple '-isysroot' arguments are present.
    i    i   t   .i   s   -archs	   -isysroott	   ARCHFLAGSi   s4   Compiling with an SDK that doesn't seem to exist: %ss$   Please check your Xcode installationN(   t   listt   ost   unamet   intt   splitt   Truet   environt   indext
   ValueErrort   Nonet   patht   isdirR   t   warn(	   t   compiler_sot   cc_argst	   stripArcht   stripSysroott   kernel_versiont   major_versionR   t   sysroott   idx(    (    s-   /usr/lib/python2.6/distutils/unixccompiler.pyt   _darwin_compiler_fixup,   sF    	
		t   UnixCCompilerc           B   sk  e  Z d  Z h d& d 6d g d 6d g d 6d g d 6d d g d 6d g d 6d	 d
 g d 6d& d 6Z e i d  d j o d g e d <n d d d d d d g Z d Z d Z	 d Z
 d Z d Z Z Z e i d j o
 d Z n d& d& d& d& d& d „ Z d „  Z d& d d& d „ Z d& d& d& d& d& d d& d& d& d& d  „
 Z d! „  Z d" „  Z d# „  Z d$ „  Z d d% „ Z RS('   t   unixt   preprocessort   cct   compilerR   t   compiler_cxxs   -sharedt	   linker_sot
   linker_exet   ars   -crt   archivert   ranlibi   t   darwins   .cs   .Cs   .ccs   .cxxs   .cpps   .ms   .os   .as   .sos   .dylibs   lib%s%st   cygwins   .exec         C   s  |  i  d  | | ƒ \ } } } t | | ƒ } |  i | }	 | o |	 i d | g ƒ n | o | |	 d *n | o |	 i | ƒ n |	 i | ƒ |  i p | d  j p t | | ƒ oZ | o |  i t	 i
 i | ƒ ƒ n y |  i |	 ƒ Wqt j
 o }
 t |
 ‚ qXn d  S(   Ns   -oi    (   t   _fix_compile_argsR   R   R&   t   extendt   appendt   forceR   t   mkpathR   R   t   dirnamet   spawnR   R   (   t   selft   sourcet   output_filet   macrost   include_dirst   extra_preargst   extra_postargst   ignoret   pp_optst   pp_argst   msg(    (    s-   /usr/lib/python2.6/distutils/unixccompiler.pyt
   preprocess‘   s"    'c   	      C   s{   |  i  } t i d j o t | | | ƒ } n y& |  i | | | d | g | ƒ Wn t j
 o } t | ‚ n Xd  S(   NR/   s   -o(   R   t   syst   platformR#   R7   R   R   (	   R8   t   objt   srct   extR   R>   R@   R   RB   (    (    s-   /usr/lib/python2.6/distutils/unixccompiler.pyt   _compile¬   s    	i    c         C   sÝ   |  i  | | ƒ \ } } |  i | d | ƒ} |  i | | ƒ o‰ |  i t i i | ƒ ƒ |  i |  i | g | |  i	 ƒ |  i
 o@ y |  i |  i
 | g ƒ WqÅ t j
 o } t | ‚ qÅ XqÙ n t i d | ƒ d  S(   Nt
   output_dirs   skipping %s (up-to-date)(   t   _fix_object_argst   library_filenamet
   _need_linkR5   R   R   R6   R7   R-   t   objectsR.   R   R	   R   t   debug(   R8   RN   t   output_libnameRJ   RO   t   target_langt   output_filenameRB   (    (    s-   /usr/lib/python2.6/distutils/unixccompiler.pyt   create_static_lib¶   s    
c         C   sœ  |  i  | | ƒ \ } } |  i | | | ƒ \ } } } g  } | D] } | d j o | | qA qA ~ } g  } | D] } | d j o | | qs qs ~ } t |  | | | ƒ } t | ƒ t t f j o t d ‚ n | d  j	 o t i	 i
 | | ƒ } n |  i | | ƒ oz| |  i | d | g } |	 o d g | d *n |
 o |
 | d *n | o | i | ƒ n |  i t i	 i | ƒ ƒ yÜ | t i j o |  i } n |  i } | d	 j oo |  i oe d } t i	 i | d ƒ d
 j o- d } x$ d | | j o | d } qõWn |  i | | | <n t i d j o t | | ƒ } n |  i | | ƒ Wq˜t j
 o } t | ‚ q˜Xn t i d | ƒ d  S(   Ns   /libs   /lib64s   /usr/libs
   /usr/lib64s%   'output_dir' must be a string or Nones   -os   -gi    s   c++t   envi   t   =R/   s   skipping %s (up-to-date)(   s   /libs   /lib64s   /usr/libs
   /usr/lib64(   s   /libs   /lib64s   /usr/libs
   /usr/lib64(   RK   t   _fix_lib_argsR   t   typeR    R   t	   TypeErrorR   R   R   t   joinRM   RN   R2   R5   R6   R   t
   EXECUTABLER+   R*   R)   t   basenameRD   RE   R#   R7   R   R
   R   RO   (   R8   t   target_descRN   RR   RJ   t	   librariest   library_dirst   runtime_library_dirst   export_symbolsRO   R=   R>   t
   build_tempRQ   t   _[1]t   dirt   _[2]t   lib_optst   ld_argst   linkert   iRB   (    (    s-   /usr/lib/python2.6/distutils/unixccompiler.pyt   linkÐ   sN    !!	
 c         C   s   d | S(   Ns   -L(    (   R8   Rc   (    (    s-   /usr/lib/python2.6/distutils/unixccompiler.pyt   library_dir_option  s    c         C   s   d | j p
 d | j S(   Nt   gccs   g++(    (   R8   t   compiler_name(    (    s-   /usr/lib/python2.6/distutils/unixccompiler.pyt   _is_gcc  s    c         C   sÒ   t  i i t i d ƒ ƒ } t i d  d j o	 d | St i d  d j o. |  i | ƒ o d d | g Sd d | g St i d	  d
 j p t i d  d j o d | g S|  i | ƒ o	 d | Sd | Sd  S(   Nt   CCi   R/   s   -Li   s   hp-uxs   -Wl,+ss   +si   t   irix646t   osf1V5s   -rpaths   -Wl,-Rs   -R(   R   R   R[   R   t   get_config_varRD   RE   Rm   (   R8   Rc   R(   (    (    s-   /usr/lib/python2.6/distutils/unixccompiler.pyt   runtime_library_dir_option  s    	(	c         C   s   d | S(   Ns   -l(    (   R8   t   lib(    (    s-   /usr/lib/python2.6/distutils/unixccompiler.pyt   library_option1  s    c         C   sÏ  |  i  | d d ƒ} |  i  | d d ƒ} |  i  | d d ƒ} t i d j oK t i d ƒ } t i d | ƒ } | d  j o
 d }	 qš | i d	 ƒ }	 n x.| D]&}
 t	 i
 i |
 | ƒ } t	 i
 i |
 | ƒ } t	 i
 i |
 | ƒ } t i d j o‰ |
 i d
 ƒ p! |
 i d ƒ oi |
 i d ƒ oX t	 i
 i |	 |
 d	 | ƒ } t	 i
 i |	 |
 d	 | ƒ } t	 i
 i |	 |
 d	 | ƒ } n t	 i
 i | ƒ o | St	 i
 i | ƒ o | St	 i
 i | ƒ o | Sq¡ Wd  S(   Nt   lib_typet   sharedt   dylibt   staticR/   t   CFLAGSs   -isysroot\s+(\S+)t   /i   s   /System/s   /usr/s   /usr/local/(   RL   RD   RE   R   Rq   t   ret   searchR   t   groupR   R   RY   t
   startswitht   exists(   R8   t   dirsRs   RO   t   shared_ft   dylib_ft   static_ft   cflagst   mR!   Rc   Rv   Rw   Rx   (    (    s-   /usr/lib/python2.6/distutils/unixccompiler.pyt   find_library_file4  s6    
 ! 	N(   t   __name__t
   __module__t   compiler_typeR   t   executablesRD   RE   t   src_extensionst   obj_extensiont   static_lib_extensiont   shared_lib_extensiont   dylib_lib_extensiont   static_lib_formatt   shared_lib_formatt   dylib_lib_formatt   exe_extensionRC   RI   RS   Ri   Rj   Rm   Rr   Rt   R†   (    (    (    s-   /usr/lib/python2.6/distutils/unixccompiler.pyR$   k   s@   






			;				(   t   __doc__t   __revision__R   RD   R{   t   typesR    R   t	   distutilsR   t   distutils.dep_utilR   t   distutils.ccompilerR   R   R   t   distutils.errorsR   R   R	   R
   R   R#   R$   (    (    (    s-   /usr/lib/python2.6/distutils/unixccompiler.pyt   <module>   s   $"	?