³ò
Ÿ›\Kc           @   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 d	 e	 f d
 „  ƒ  YZ d e f d „  ƒ  YZ d Z d Z d Z d „  Z d „  Z d S(   s  distutils.cygwinccompiler

Provides the CygwinCCompiler class, a subclass of UnixCCompiler that
handles the Cygwin port of the GNU C compiler to Windows.  It also contains
the Mingw32CCompiler class which handles the mingw32 port of GCC (same as
cygwin in no-cygwin mode).
s;   $Id: cygwinccompiler.py 37828 2004-11-10 22:23:15Z loewis $iÿÿÿÿN(   t   gen_preprocess_optionst   gen_lib_options(   t   UnixCCompiler(   t
   write_file(   t   DistutilsExecErrort   CompileErrort   UnknownFileError(   t   logt   CygwinCCompilerc           B   sƒ   e  Z d  Z d Z d Z d Z d Z d Z d Z d d d d „ Z	 d	 „  Z
 d d d d d d d d d d d
 „
 Z d d d „ Z RS(   t   cygwins   .os   .as   .dlls   lib%s%ss   %s%ss   .exei    c   	      C   sÍ  t  i |  | | | ƒ t ƒ  \ } } |  i d | | f ƒ | t j	 o |  i d | ƒ n t ƒ  \ |  _ |  _ |  _	 |  i |  i
 d |  i |  i |  i	 f ƒ |  i d j o d |  _ n
 d |  _ |  i d j o
 d } n d	 } |  i d
 d d d d d d d d d |  i | f ƒ |  i d j o d g |  _ |  i d ƒ n g  |  _ t i i d ƒ } | d j oV t i | d | d !} | d j o d g |  _ qÉ| d j o d g |  _ qÉn d  S(   Ns%   Python's GCC status: %s (details: %s)sƒ   Python's pyconfig.h doesn't seem to support your compiler. Reason: %s. Compiling may fail because of undefined preprocessor macros.s   : gcc %s, ld %s, dllwrap %s
s   2.10.90t   gcct   dllwraps   2.13s   -shareds   -mdll -statict   compilers   gcc -mcygwin -O -Wallt   compiler_sos   gcc -mcygwin -mdll -O -Wallt   compiler_cxxs   g++ -mcygwin -O -Wallt
   linker_exes   gcc -mcygwint	   linker_sos   %s -mcygwin %ss   2.91.57t   msvcrts,   Consider upgrading to a newer version of gccs   MSC v.iÿÿÿÿi   i
   t   1300t   msvcr70t   1310t   msvcr71(   R   t   __init__t   check_config_ht   debug_printt   CONFIG_H_OKt   warnt   get_versionst   gcc_versiont
   ld_versiont   dllwrap_versiont   compiler_typet
   linker_dllt   set_executablest   dll_librariest   syst   versiont   find(	   t   selft   verboset   dry_runt   forcet   statust   detailst   shared_optiont   msc_post   msc_ver(    (    s/   /usr/lib/python2.5/distutils/cygwinccompiler.pyR   E   sJ    		
	c      	   C   s­   | d j p | d j oE y  |  i  d d | d | g ƒ Wq© t j
 o } t | ‚ q© XnK y) |  i  |  i | | d | g | ƒ Wn t j
 o } t | ‚ n Xd  S(   Ns   .rcs   .rest   windress   -is   -o(   t   spawnR   R   R   (   R&   t   objt   srct   extt   cc_argst   extra_postargst   pp_optst   msg(    (    s/   /usr/lib/python2.5/distutils/cygwinccompiler.pyt   _compileŒ   s     c         C   sá  t  i  |
 p g  ƒ }
 t  i  | p g  ƒ } t  i  | p g  ƒ } | i |  i ƒ | d  j	 o2| |  i j p |  i d j ot i i | d ƒ } t i i	 t i i
 | ƒ ƒ \ } } t i i | | d ƒ } t i i | d | d ƒ } d t i i
 | ƒ d g } x | D] } | i | ƒ qW|  i t | | f d | ƒ |  i d	 j o* |
 i d
 | g ƒ |
 i d | g ƒ q‘| i | ƒ n |	 p |
 i d ƒ n t i |  | | | | | | | d  |	 |
 | | | ƒ d  S(   NR
   i    s   .deft   libs   .as
   LIBRARY %st   EXPORTSs
   writing %sR   s   --output-libs   --defs   -s(   t   copyt   extendR"   t   Nonet
   EXECUTABLER    t   ost   patht   dirnamet   splitextt   basenamet   joint   appendt   executeR   R   t   link(   R&   t   target_desct   objectst   output_filenamet
   output_dirt	   librariest   library_dirst   runtime_library_dirst   export_symbolst   debugt   extra_preargsR5   t
   build_tempt   target_langt   temp_dirt   dll_namet   dll_extensiont   def_filet   lib_filet   contentst   sym(    (    s/   /usr/lib/python2.5/distutils/cygwinccompiler.pyRG   š   sL     			 	t    c         C   s  | d  j o
 d } n g  } xè | D]à } t i i t i i | ƒ ƒ \ } } | |  i d d g j o t d | | f ‚ n | o t i i | ƒ } n | d j p | d j o+ | i t i i	 | | | |  i
 ƒ ƒ q$ | i t i i	 | | |  i
 ƒ ƒ q$ W| S(   NR[   s   .rcs   .ress"   unknown file type '%s' (from '%s')(   R=   R?   R@   RB   t   normcaset   src_extensionsR   RC   RE   RD   t   obj_extension(   R&   t   source_filenamest	   strip_dirRK   t	   obj_namest   src_namet   baseR3   (    (    s/   /usr/lib/python2.5/distutils/cygwinccompiler.pyt   object_filenamesý   s$     
 $N(   t   __name__t
   __module__R   R^   t   static_lib_extensiont   shared_lib_extensiont   static_lib_formatt   shared_lib_formatt   exe_extensionR   R8   R=   RG   Rd   (    (    (    s/   /usr/lib/python2.5/distutils/cygwinccompiler.pyR   ;   s*   G	Xt   Mingw32CCompilerc           B   s    e  Z d  Z d d d d „ Z RS(   t   mingw32i    c         C   s  t  i |  | | | ƒ |  i d j o
 d } n d } |  i d j o
 d } n d } |  i d d d	 d
 d d d d d d |  i | | f ƒ g  |  _ t i i	 d ƒ } | d j oV t i | d | d !} | d j o d g |  _ q| d j o d g |  _ qn d  S(   Ns   2.13s   -shareds   -mdll -statics   2.91.57s   --entry _DllMain@12R[   R   s   gcc -mno-cygwin -O -WallR   s   gcc -mno-cygwin -mdll -O -WallR   s   g++ -mno-cygwin -O -WallR   s   gcc -mno-cygwinR   s   %s -mno-cygwin %s %ss   MSC v.iÿÿÿÿi   i
   R   R   R   R   (
   R   R   R   R   R!   R    R"   R#   R$   R%   (   R&   R'   R(   R)   R,   t   entry_pointR-   R.   (    (    s/   /usr/lib/python2.5/distutils/cygwinccompiler.pyR     s,    

		(   Re   Rf   R   R   (    (    (    s/   /usr/lib/python2.5/distutils/cygwinccompiler.pyRl     s   t   oks   not okt	   uncertainc          C   sä   d d k  l }  d d k } | i t i d ƒ d j o t d f Sn |  i ƒ  } y& t | ƒ } | i	 ƒ  } | i
 ƒ  Wn, t j
 o  } t d | | i f f Sn; X| i | d ƒ d j o t d	 | f Sn t d
 | f Sd S(   s¡  Check if the current Python installation (specifically, pyconfig.h)
    appears amenable to building extensions with GCC.  Returns a tuple
    (status, details), where 'status' is one of the following constants:
      CONFIG_H_OK
        all is well, go ahead and compile
      CONFIG_H_NOTOK
        doesn't look good
      CONFIG_H_UNCERTAIN
        not sure -- unable to read pyconfig.h
    'details' is a human-readable string explaining the situation.

    Note there are two ways to conclude "OK": either 'sys.version' contains
    the string "GCC" (implying that this Python was built with GCC), or the
    installed "pyconfig.h" contains the string "__GNUC__".
    iÿÿÿÿ(   t	   sysconfigNt   GCCi    s   sys.version mentions 'GCC's   couldn't read '%s': %st   __GNUC__s   '%s' mentions '__GNUC__'s    '%s' does not mention '__GNUC__'(   t	   distutilsRq   t   stringR%   R#   R$   R   t   get_config_h_filenamet   opent   readt   closet   IOErrort   CONFIG_H_UNCERTAINt   strerrort   CONFIG_H_NOTOK(   Rq   Ru   t   fnt   ft   st   exc(    (    s/   /usr/lib/python2.5/distutils/cygwinccompiler.pyR   Z  s    c          C   s¼  d d k  l }  d d k l } d d k } | d ƒ } | oh t i | d d ƒ } | i ƒ  } | i ƒ  | i	 d | ƒ } | o |  | i
 d	 ƒ ƒ } q­ d } n d } | d
 ƒ } | oh t i | d d ƒ } | i ƒ  } | i ƒ  | i	 d | ƒ } | o |  | i
 d	 ƒ ƒ }	 q.d }	 n d }	 | d ƒ }
 |
 oh t i |
 d d ƒ } | i ƒ  } | i ƒ  | i	 d | ƒ } | o |  | i
 d	 ƒ ƒ } q¯d } n d } | |	 | f S(   sj    Try to find out the versions of gcc, ld and dllwrap.
        If not possible it returns None for it.
    iÿÿÿÿ(   t   StrictVersion(   t   find_executableNR
   s    -dumpversiont   rs   (\d+\.\d+(\.\d+)*)i   t   lds    -vR   s
    --versions    (\d+\.\d+(\.\d+)*)(   t   distutils.versionR‚   t   distutils.spawnRƒ   t   reR?   t   popenRx   Ry   t   searcht   groupR=   (   R‚   Rƒ   Rˆ   t   gcc_exet   outt
   out_stringt   resultR   t   ld_exeR   t   dllwrap_exeR   (    (    s/   /usr/lib/python2.5/distutils/cygwinccompiler.pyR     sD    





(   t   __doc__t   __revision__R?   R#   R;   t   distutils.ccompilerR    R   t   distutils.unixccompilerR   t   distutils.file_utilR   t   distutils.errorsR   R   R   Rt   R   R   Rl   R   R}   R{   R   R   (    (    (    s/   /usr/lib/python2.5/distutils/cygwinccompiler.pys   <module>   s   +$à;	3