;
Ñâ"Ic               @   s§   d  Z  d Z d d l Z d d l Z d d l m Z m Z m Z m Z m	 Z	 d d l
 m Z m Z m Z d d l Z d d l Z d d l m Z Gd „  d e ƒ Z d S(	   u¶   distutils.mwerkscompiler

Contains MWerksCompiler, an implementation of the abstract CCompiler class
for MetroWerks CodeWarrior on the Macintosh. Needs work to support CW on
Windows.uF   $Id: mwerkscompiler.py 65250 2008-07-26 20:09:45Z amaury.forgeotdarc $i    N(   u   DistutilsExecErroru   DistutilsPlatformErroru   CompileErroru   LibErroru	   LinkError(   u	   CCompileru   gen_preprocess_optionsu   gen_lib_options(   u   logc             B   s  |  Ee  Z d  Z d Z i  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 d S(   uy   Concrete class that implements an interface to MetroWerks CodeWarrior,
       as defined by the CCompiler abstract class.u   mwerksu   .cu   .ccu   .cppu   .cxxu   .ru   .expu   .rsrcu   .obju   .libu   .slbu   %s%su    i    c             C   s   t  j |  | | | ƒ d  S(   N(   u	   CCompileru   __init__(   u   selfu   verboseu   dry_runu   force(    (    u5   /mit/python/lib/python3.0/distutils/mwerkscompiler.pyu   __init__2   s    c	       	      C   s=   |  j  | | | ƒ \ } } } | |  _ | |  _ | |  _ g  S(   N(   u   _fix_compile_argsu   _MWerksCompiler__sourcesu   _MWerksCompiler__macrosu   _MWerksCompiler__include_dirs(	   u   selfu   sourcesu
   output_diru   macrosu   include_dirsu   debugu   extra_preargsu   extra_postargsu   depends(    (    u5   /mit/python/lib/python3.0/distutils/mwerkscompiler.pyu   compile:   s
    
			c       &         ss  ˆ  j  | | ƒ \ } } ˆ  j | | | ƒ \ } } } | ˆ  j ˆ  j f k o t d ƒ ‚ n | o t d ƒ ‚ n |
 p | o t d ƒ ‚ n t | ƒ d k o t d ƒ ‚ n ‡  f d †  ˆ  j Dƒ } ‡  f d †  ˆ  j Dƒ } | o ‡  f d †  | Dƒ } n g  } | o ˆ  j | ƒ } n t	 j
 ƒ  } | o t	 j j | | ƒ } n ˆ  j | ƒ } t	 j j | ƒ \ } } | d d  … d	 k o | d  d … } nB | d
 d  … d k o | d  d
 … } n t	 j j | ƒ d } | d } | } | d } | d } d | } t j j | d ˆ  j ƒt j j | d ˆ  j ƒi  } | | d <| | d <| | d <| | d <t j | d <d | d <g  } g  } xU | | D]I } t	 j j | ƒ \ } } | j | ƒ | | k o | j | ƒ q¥q¥W| | d <| | d <| | | | d <ˆ  j oI t d t	 j ƒ  ƒ x. | j ƒ  D]  \ } } t d | | f ƒ qBWd  St	 j j | | ƒ } t j d | ƒ t | d ƒ } | j d  | d ƒ | j ƒ  ˆ  j o± t	 j j t	 j ƒ  t	 j j | | ƒ ƒ } t | d ƒ } | j d! ƒ xP ˆ  j D]E \ }  } | d  k o | j d" |  ƒ q| j d# |  | f ƒ qW| j ƒ  | | d$ <n t	 j j t	 j ƒ  t	 j j | | ƒ ƒ }! t j d% |! ƒ d d  l  }" |" j! j" | ƒ }# |# j# ƒ  | d& }$ t |! d ƒ } | j |$ ƒ | j ƒ  t	 j j t	 j ƒ  t	 j j | | ƒ ƒ }% t j d' |% ƒ |" j$ |! |% ƒ t j d( ƒ |" j% |% ƒ d  S()   Nu@   Can only make SHARED_LIBRARY or SHARED_OBJECT targets on the Macu(   Runtime library dirs not implemented yeti   u   Need exactly one export symbolc                s$   g  } |  ] } | ˆ  j  | ƒ q
 S(    (   u   _filename_to_abs(   u   .0u   _[1]u   s(   u   self(    u5   /mit/python/lib/python3.0/distutils/mwerkscompiler.pyu
   <listcomp>k   s    c                s$   g  } |  ] } | ˆ  j  | ƒ q
 S(    (   u   _filename_to_abs(   u   .0u   _[1]u   d(   u   self(    u5   /mit/python/lib/python3.0/distutils/mwerkscompiler.pyu
   <listcomp>l   s    c                s$   g  } |  ] } | ˆ  j  | ƒ q
 S(    (   u   _filename_to_abs(   u   .0u   _[1]u   o(   u   self(    u5   /mit/python/lib/python3.0/distutils/mwerkscompiler.pyu
   <listcomp>n   s    iøÿÿÿu   .ppc.slbiõÿÿÿu   .carbon.slbi    u   .mcpu   .xmlu   .mcp.expu   mwerks_%s_config.hu   dry_runu   mac_exportnameu   mac_outputdiru   mac_dllnameu   mac_targetnameu	   sysprefixu   Absoluteu   mac_sysprefixtypeu   sourcesu	   librariesu   extrasearchdirsu   CALLING LINKER INu
   %20.20s %su   	Create export file %su   wu   %s
u$   #include "mwerks_shcarbon_config.h"
u   #define %s
u   #define %s %s
u
   prefixnameu   	Create XML file %su   tmp_projectxmldatau   	Create project file %su   	Build project(&   u   _fix_object_argsu   _fix_lib_argsu   SHARED_LIBRARYu   SHARED_OBJECTu   DistutilsPlatformErroru   lenu   _MWerksCompiler__sourcesu   _MWerksCompiler__include_dirsu   _filename_to_absu   osu   curdiru   pathu   joinu   splitu   stripu	   distutilsu   dir_utilu   mkpathu   dry_runu   sysu   prefixu   appendu   printu   getcwdu   itemsu   logu   debugu   openu   writeu   closeu   _MWerksCompiler__macrosu   Noneu   mkcwprojectu   cwxmlgenu   ProjectBuilderu   generateu   makeprojectu   buildproject(&   u   selfu   target_descu   objectsu   output_filenameu
   output_diru	   librariesu   library_dirsu   runtime_library_dirsu   export_symbolsu   debugu   extra_preargsu   extra_postargsu
   build_tempu   target_langu   sourcesu   include_dirsu   basenameu   projectnameu
   targetnameu   xmlnameu
   exportnameu
   prefixnameu   settingsu   sourcefilenamesu   sourcefiledirsu   filenameu   dirnameu   keyu   valueu   exportfilenameu   fpu   prefixfilenameu   nameu   xmlfilenameu   mkcwprojectu
   xmlbuilderu   xmldatau   projectfilename(    (   u   selfu5   /mit/python/lib/python3.0/distutils/mwerkscompiler.pyu   linkK   s°    








 


 

*
 
*


*c             C   s¥   t  j j | ƒ } t j j | ƒ p% t j ƒ  } t j j | | ƒ } n | j d ƒ } x< t	 d t
 | ƒ ƒ D]% } | | d k o d | | <qo qo Wd j | ƒ S(   Nu   :i   u   ..u    (   u	   distutilsu   utilu   convert_pathu   osu   pathu   isabsu   getcwdu   joinu   splitu   rangeu   len(   u   selfu   filenameu   curdiru
   componentsu   i(    (    u5   /mit/python/lib/python3.0/distutils/mwerkscompiler.pyu   _filename_to_absÊ   s     c             C   s   d S(   uk   Return the compiler option to add 'dir' to the list of
        directories searched for libraries.
        N(    (   u   selfu   dir(    (    u5   /mit/python/lib/python3.0/distutils/mwerkscompiler.pyu   library_dir_optionÛ   s    c             C   s   d S(   us   Return the compiler option to add 'dir' to the list of
        directories searched for runtime libraries.
        N(    (   u   selfu   dir(    (    u5   /mit/python/lib/python3.0/distutils/mwerkscompiler.pyu   runtime_library_dir_optioná   s    c             C   s   d S(   u   Return the compiler option to add 'dir' to the list of libraries
        linked into the shared library or executable.
        N(    (   u   selfu   lib(    (    u5   /mit/python/lib/python3.0/distutils/mwerkscompiler.pyu   library_optionè   s    c             C   s   d S(   uH  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    (    (   u   selfu   dirsu   libu   debug(    (    u5   /mit/python/lib/python3.0/distutils/mwerkscompiler.pyu   find_library_fileî   s    N(   u   __name__u
   __module__u   __doc__u   compiler_typeu   executablesu   _c_extensionsu   _cpp_extensionsu   _rc_extensionsu   _exp_extensionu   src_extensionsu   res_extensionu   obj_extensionu   static_lib_extensionu   shared_lib_extensionu   static_lib_formatu   shared_lib_formatu   exe_extensionu   __init__u   Noneu   compileu   linku   _filename_to_absu   library_dir_optionu   runtime_library_dir_optionu   library_optionu   find_library_file(   u
   __locals__(    (    u5   /mit/python/lib/python3.0/distutils/mwerkscompiler.pyu   MWerksCompiler   sP   
		
r				u   MWerksCompiler(   u   __doc__u   __revision__u   sysu   osu   distutils.errorsu   DistutilsExecErroru   DistutilsPlatformErroru   CompileErroru   LibErroru	   LinkErroru   distutils.ccompileru	   CCompileru   gen_preprocess_optionsu   gen_lib_optionsu   distutils.utilu	   distutilsu   distutils.dir_utilu   logu   MWerksCompiler(    (    (    u5   /mit/python/lib/python3.0/distutils/mwerkscompiler.pyu   <module>   s   (