ó
’wÛjc           @   sì   d  Z  d Z d d l Z d d l Z d d l Z d d l m Z m Z d d l m	 Z	 d d l
 m Z d d l m Z m Z m Z d d l m Z m Z m Z m Z d d	 l m Z e j d
 k rÒ d d l Z n  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   logt   darwint   UnixCCompilerc           B   ss  e  Z d  Z i 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 j d  d k r… d g e d <n  d d d d d d g Z d Z d Z	 d Z
 d Z d Z d Z Z Z e Z e j d k rç 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   compilert   compiler_sot   compiler_cxxs   -sharedt	   linker_sot
   linker_exet   ars   -crt   archivert   ranlibi   R   s   .cs   .Cs   .ccs   .cxxs   .cpps   .ms   .os   .as   .sos   .dylibs   .tbds   lib%s%st   cygwins   .exec         C   s	  |  j  d  | | ƒ \ } } } t | | ƒ } |  j | }	 | rV |	 j d | g ƒ n  | ri | |	 d *n  | r |	 j | ƒ n  |	 j | ƒ |  j s° | d  k s° t | | ƒ r| rÒ |  j t	 j
 j | ƒ ƒ n  y |  j |	 ƒ Wqt k
 r}
 t |
 ‚ qXn  d  S(   Ns   -oi    (   t   _fix_compile_argst   NoneR   R   t   extendt   appendt   forceR   t   mkpatht   ost   patht   dirnamet   spawnR   R   (   t   selft   sourcet   output_filet   macrost   include_dirst   extra_preargst   extra_postargst   ignoret   pp_optst   pp_argst   msg(    (    s�   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/unixccompiler.pyt
   preprocessX   s"    $c   	      C   sz   |  j  } t j d k r1 t j | | | ƒ } n  y& |  j | | | d | g | ƒ Wn t k
 ru } t | ‚ n Xd  S(   NR   s   -o(   R   t   syst   platformt   _osx_supportt   compiler_fixupR#   R   R   (	   R$   t   objt   srct   extt   cc_argsR*   R,   R   R.   (    (    s�   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/unixccompiler.pyt   _compiles   s    		i    c         C   s×   |  j  | | ƒ \ } } |  j | d | ƒ} |  j | | ƒ rÃ |  j t j j | ƒ ƒ |  j |  j | g | |  j	 ƒ |  j
 rÓ y |  j |  j
 | g ƒ WqÀ t k
 r¼ } t | ‚ qÀ XqÓ n t j d | ƒ d  S(   Nt
   output_dirs   skipping %s (up-to-date)(   t   _fix_object_argst   library_filenamet
   _need_linkR   R    R!   R"   R#   R   t   objectsR   R   R	   R   t   debug(   R$   R=   t   output_libnameR9   R>   t   target_langt   output_filenameR.   (    (    s�   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/unixccompiler.pyt   create_static_lib~   s    	c         C   s"  |  j  | | ƒ \ } } |  j | | | ƒ \ } } } t |  | | | ƒ } t | ƒ t t f k ro t d ‚ n  | d  k	 r“ t j	 j
 | | ƒ } n  |  j | | ƒ r| |  j | d | g } |	 rÖ d g | d *n  |
 ré |
 | d *n  | rÿ | j | ƒ n  |  j t j	 j | ƒ ƒ yÔ | t j k r7|  j } n
 |  j } | d k r¶|  j r¶d } t j	 j | d ƒ d k r¢d } x! d | | k rž| d } q�Wn  |  j | | | <n  t j d	 k rÚt j | | ƒ } n  |  j | | ƒ Wqt k
 r
} t | ‚ qXn t j d
 | ƒ d  S(   Ns%   'output_dir' must be a string or Nones   -os   -gi    s   c++t   envi   t   =R   s   skipping %s (up-to-date)(   R:   t   _fix_lib_argsR   t   typeR    R   t	   TypeErrorR   R    R!   t   joinR<   R=   R   R   R"   R   t
   EXECUTABLER   R   R   t   basenameR0   R1   R2   R3   R#   R   R
   R   R>   (   R$   t   target_descR=   RA   R9   t	   librariest   library_dirst   runtime_library_dirst   export_symbolsR>   R)   R*   t
   build_tempR@   t   lib_optst   ld_argst   linkert   iR.   (    (    s�   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/unixccompiler.pyt   link˜   sD    	
c         C   s   d | S(   Ns   -L(    (   R$   t   dir(    (    s�   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/unixccompiler.pyt   library_dir_optionÒ   s    c         C   s   d | k p d | k S(   Nt   gccs   g++(    (   R$   t   compiler_name(    (    s�   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/unixccompiler.pyt   _is_gccÕ   s    c         C   sÖ   t  j d ƒ } t j d  d k r* d | St j d  d k rE d | St j d  d	 k rƒ |  j | ƒ ru d
 d | g Sd d | g St j d  d k s© t j d  d k r³ d | g S|  j | ƒ rÊ d | Sd | Sd  S(   Nt   CCi   R   s   -Li   t   freebsds   -Wl,-rpath=i   s   hp-uxs   -Wl,+ss   +st   irix646t   osf1V5s   -rpaths   -Wl,-Rs   -R(   R   t   get_config_varR0   R1   RZ   (   R$   RV   R   (    (    s�   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/unixccompiler.pyt   runtime_library_dir_optionØ   s    &
c         C   s   d | S(   Ns   -l(    (   R$   t   lib(    (    s�   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/unixccompiler.pyt   library_optionö   s    c         C   s  |  j  | d d ƒ} |  j  | d d ƒ} |  j  | d d ƒ} |  j  | d d ƒ} t j d k r« t j d ƒ } t j d | ƒ }	 |	 d  k r™ d	 }
 q« |	 j d
 ƒ }
 n  xj| D]b} t	 j
 j | | ƒ } t	 j
 j | | ƒ } t	 j
 j | | ƒ } t	 j
 j | | ƒ } t j d k r¼| j d ƒ sI| j d ƒ r¼| j d ƒ r¼t	 j
 j |
 | d
 | ƒ } t	 j
 j |
 | d
 | ƒ } t	 j
 j |
 | d
 | ƒ } t	 j
 j |
 | d
 | ƒ } n  t	 j
 j | ƒ rÒ| St	 j
 j | ƒ rè| St	 j
 j | ƒ rþ| St	 j
 j | ƒ r² | Sq² Wd  S(   Nt   lib_typet   sharedt   dylibt
   xcode_stubt   staticR   t   CFLAGSs   -isysroot\s+(\S+)t   /i   s   /System/s   /usr/s   /usr/local/(   R;   R0   R1   R   R_   t   ret   searchR   t   groupR    R!   RH   t
   startswitht   exists(   R$   t   dirsRa   R>   t   shared_ft   dylib_ft   xcode_stub_ft   static_ft   cflagst   mt   sysrootRV   Rd   Re   Rg   Rf   (    (    s�   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/unixccompiler.pyt   find_library_fileù   s>    	N(   t   __name__t
   __module__t   compiler_typeR   t   executablesR0   R1   t   src_extensionst   obj_extensiont   static_lib_extensiont   shared_lib_extensiont   dylib_lib_extensiont   xcode_stub_lib_extensiont   static_lib_formatt   shared_lib_formatt   dylib_lib_formatt   xcode_stub_lib_formatt   exe_extensionR/   R8   RB   RU   RW   RZ   R`   Rb   Rw   (    (    (    s�   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/unixccompiler.pyR   0   sD   





				6				(   t   __doc__t   __revision__R    R0   Rj   t   typesR    R   t	   distutilsR   t   distutils.dep_utilR   t   distutils.ccompilerR   R   R   t   distutils.errorsR   R   R	   R
   R   R1   R2   R   (    (    (    s�   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/unixccompiler.pyt   <module>   s   $"