Ńň
$8Zc           @   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 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$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.6/distutils/mwerkscompiler.pyR   5   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.6/distutils/mwerkscompiler.pyt   compile=   s
    
			c   &      C   s:  |  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 o@ d Gt
 i   GHx) | i   D] \ } } d | | f GHqWd  S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" |!  d# d  k  }" |" i! i" |  }# |# i#   | d$ }$ t |! d  } | i |$  | i   t
 i i t
 i   t
 i i | |   }% t i d% |%  |" i$ |! |%  t i d&  |" 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 %si˙˙˙˙t   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   xmlfilenameRD   t
   xmlbuildert   xmldatat   projectfilename(    (    s.   /usr/lib/python2.6/distutils/mwerkscompiler.pyt   linkN   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.6/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.6/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.6/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.6/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.6/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.6/distutils/mwerkscompiler.pyR
      sP   		
r				(   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	   R
   (    (    (    s.   /usr/lib/python2.6/distutils/mwerkscompiler.pyt   <module>   s   $
(