³ò
Ÿ›\Kc           @   sÌ   d  Z  d Z d d k Z d d k Z d d k Z d d k Td d k l Z l Z l	 Z	 l
 Z
 l Z d d k l Z l Z l Z d d k Z d d k Z d d k l Z d d k Z d e f d	 „  ƒ  YZ d S(
   s¶   distutils.mwerkscompiler

Contains MWerksCompiler, an implementation of the abstract CCompiler class
for MetroWerks CodeWarrior on the Macintosh. Needs work to support CW on
Windows.s:   $Id: mwerkscompiler.py 37828 2004-11-10 22:23:15Z loewis $iÿÿÿÿN(   t   *(   t   DistutilsExecErrort   DistutilsPlatformErrort   CompileErrort   LibErrort	   LinkError(   t	   CCompilert   gen_preprocess_optionst   gen_lib_options(   t   logt   MWerksCompilerc           B   sþ   e  Z d  Z d Z h  Z d g Z d d d g Z d g Z d Z e e e Z	 d Z
 d	 Z d
 Z d Z d Z Z d Z d d d d „ Z d d d d 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(   sy   Concrete class that implements an interface to MetroWerks CodeWarrior,
       as defined by the CCompiler abstract class.t   mwerkss   .cs   .ccs   .cpps   .cxxs   .rs   .exps   .rsrcs   .objs   .libs   .slbs   %s%st    i    c         C   s   t  i |  | | | ƒ d  S(   N(   R   t   __init__(   t   selft   verboset   dry_runt   force(    (    s.   /usr/lib/python2.5/distutils/mwerkscompiler.pyR   6   s    c	   	      C   s=   |  i  | | | ƒ \ } } } | |  _ | |  _ | |  _ g  S(   N(   t   _fix_compile_argst   _MWerksCompiler__sourcest   _MWerksCompiler__macrost   _MWerksCompiler__include_dirs(	   R   t   sourcest
   output_dirt   macrost   include_dirst   debugt   extra_preargst   extra_postargst   depends(    (    s.   /usr/lib/python2.5/distutils/mwerkscompiler.pyt   compile>   s
    
			c   %      C   s1  |  i  | | ƒ \ } } |  i | | | ƒ \ } } } | |  i |  i f j o t d ‚ n | o t d ‚ n |
 p | o t d ‚ n t | ƒ d j o t d ‚ n t |  i |  i ƒ } t |  i |  i	 ƒ } | o t |  i | ƒ } n g  } | o |  i | ƒ } n t
 i ƒ  } | o t
 i i | | ƒ } n |  i | ƒ } t
 i i | ƒ \ } } | d d j o | d  } n6 | d d j o | d  } n t
 i i | ƒ d	 } | d
 } | } | d } | d } d | } t i i | d |  i ƒt i i | d |  i ƒh  } | | d <| | d <| | d <| | d <t i | d <d | d <g  } g  } xU | | D]I } t
 i i | ƒ \ } } | i | ƒ | | j o | i | ƒ ququW| | d <| | d <| | | | d <|  i oC d Gt
 i ƒ  GHx) | i ƒ  D] \ } } d | | f GHqWd  Sn t
 i i | | ƒ } t i d | ƒ t | d ƒ } | i d | d	 ƒ | i ƒ  |  i o± t
 i i t
 i ƒ  t
 i i | | ƒ ƒ } t | d ƒ } | i d ƒ xP |  i D]E \ }  } | d  j o | i d |  ƒ qâ| i d  |  | f ƒ qâW| i ƒ  | | d! <n t
 i i t
 i ƒ  t
 i i | | ƒ ƒ }! t i d" |! ƒ t  i! i" | ƒ }" |" i# ƒ  | d# }# t |! d ƒ } | i |# ƒ | i ƒ  t
 i i t
 i ƒ  t
 i i | | ƒ ƒ }$ t i d$ |$ ƒ t  i$ |! |$ ƒ t i d% ƒ t  i% |$ ƒ d  S(&   Ns@   Can only make SHARED_LIBRARY or SHARED_OBJECT targets on the Macs(   Runtime library dirs not implemented yeti   s   Need exactly one export symboliøÿÿÿs   .ppc.slbiõÿÿÿs   .carbon.slbi    s   .mcps   .xmls   .mcp.exps   mwerks_%s_config.hR   t   mac_exportnamet   mac_outputdirt   mac_dllnamet   mac_targetnamet	   sysprefixt   Absolutet   mac_sysprefixtypeR   t	   librariest   extrasearchdirss   CALLING LINKER INs
   %20.20s %ss   	Create export file %st   ws   %s
s$   #include "mwerks_shcarbon_config.h"
s   #define %s
s   #define %s %s
t
   prefixnames   	Create XML file %st   tmp_projectxmldatas   	Create project file %ss   	Build project(&   t   _fix_object_argst   _fix_lib_argst   SHARED_LIBRARYt   SHARED_OBJECTR   t   lent   mapt   _filename_to_absR   R   t   ost   curdirt   patht   joint   splitt   stript	   distutilst   dir_utilt   mkpathR   t   syst   prefixt   appendt   getcwdt   itemsR	   R   t   opent   writet   closeR   t   Nonet   mkcwprojectt   cwxmlgent   ProjectBuildert   generatet   makeprojectt   buildproject(%   R   t   target_desct   objectst   output_filenameR   R&   t   library_dirst   runtime_library_dirst   export_symbolsR   R   R   t
   build_tempt   target_langR   R   t   basenamet   projectnamet
   targetnamet   xmlnamet
   exportnameR)   t   settingst   sourcefilenamest   sourcefiledirst   filenamet   dirnamet   keyt   valuet   exportfilenamet   fpt   prefixfilenamet   namet   xmlfilenamet
   xmlbuildert   xmldatat   projectfilename(    (    s.   /usr/lib/python2.5/distutils/mwerkscompiler.pyt   linkO   s®    








 


 

*
 
*


*c         C   s«   t  i i | ƒ } t i i | ƒ p% t i ƒ  } t i i | | ƒ } n t i	 | d ƒ } x< t
 d t | ƒ ƒ D]% } | | d j o d | | <qr qr Wt i | d ƒ S(   Nt   :i   s   ..R   (   R8   t   utilt   convert_pathR2   R4   t   isabsR>   R5   t   stringR6   t   rangeR/   (   R   RZ   R3   t
   componentst   i(    (    s.   /usr/lib/python2.5/distutils/mwerkscompiler.pyR1   Í   s     c         C   s   d S(   sk   Return the compiler option to add 'dir' to the list of
        directories searched for libraries.
        N(    (   R   t   dir(    (    s.   /usr/lib/python2.5/distutils/mwerkscompiler.pyt   library_dir_optionÞ   s    c         C   s   d S(   ss   Return the compiler option to add 'dir' to the list of
        directories searched for runtime libraries.
        N(    (   R   Ro   (    (    s.   /usr/lib/python2.5/distutils/mwerkscompiler.pyt   runtime_library_dir_optionä   s    c         C   s   d S(   s   Return the compiler option to add 'dir' to the list of libraries
        linked into the shared library or executable.
        N(    (   R   t   lib(    (    s.   /usr/lib/python2.5/distutils/mwerkscompiler.pyt   library_optionë   s    c         C   s   d S(   sH  Search the specified list of directories for a static or shared
        library file 'lib' and return the full path to that file.  If
        'debug' true, look for a debugging version (if that makes sense on
        the current platform).  Return None if 'lib' wasn't found in any of
        the specified directories.
        i    (    (   R   t   dirsRr   R   (    (    s.   /usr/lib/python2.5/distutils/mwerkscompiler.pyt   find_library_fileñ   s    N(   t   __name__t
   __module__t   __doc__t   compiler_typet   executablest   _c_extensionst   _cpp_extensionst   _rc_extensionst   _exp_extensiont   src_extensionst   res_extensiont   obj_extensiont   static_lib_extensiont   shared_lib_extensiont   static_lib_formatt   shared_lib_formatt   exe_extensionR   RC   R   Rf   R1   Rp   Rq   Rs   Ru   (    (    (    s.   /usr/lib/python2.5/distutils/mwerkscompiler.pyR
      sP   		
q				(   Rx   t   __revision__R;   R2   Rk   t   typest   distutils.errorsR   R   R   R   R   t   distutils.ccompilerR   R   R   t   distutils.utilR8   t   distutils.dir_utilR	   RD   R
   (    (    (    s.   /usr/lib/python2.5/distutils/mwerkscompiler.pys   <module>   s   $
(