ó
!Æ^c           @   sL  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 m	 Z	 m
 Z
 m Z d Z e	 d d ƒ d „  ƒ Z e d	 „  ƒ Z d
 „  Z e	 d d ƒ e
 d ƒ d „  ƒ ƒ Z e	 d d ƒ e
 d ƒ d „  ƒ ƒ Z e	 d d ƒ e d d ƒ d „  ƒ ƒ Z d d d g Z d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d S(   s   
MacOSX related tools
iÿÿÿÿN(   t   Taskt   Utils(   t   taskgen_methodt   featuret   after_methodt   before_methodsÜ  
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleGetInfoString</key>
	<string>Created by Waf</string>
	<key>CFBundleSignature</key>
	<string>????</string>
	<key>NOTE</key>
	<string>THIS IS A GENERATED FILE, DO NOT MODIFY</string>
	<key>CFBundleExecutable</key>
	<string>{app_name}</string>
</dict>
</plist>
t   ct   cxxc         C   sz   |  j  j r" |  j  j t j d <nT d t j k rv t j ƒ  d k rv d j t j ƒ  d j	 d ƒ d  ƒ t j d <qv n  d S(   sM   
	see WAF issue 285 and also and also http://trac.macports.org/ticket/17059
	t   MACOSX_DEPLOYMENT_TARGETt   darwint   .i    i   N(
   t   envR   t   ost   environR   t   unversioned_sys_platformt   joint   platformt   mac_vert   split(   t   self(    (    s5   /git_repos/PolyLV2/poly_mclk_in/waflib/Tools/c_osx.pyt   set_macosx_deployment_target#   s
    c         C   s?   | j  j | ƒ } | j ƒ  | j d d g ƒ } | j ƒ  | S(   se   
	Creates bundle folders, used by :py:func:`create_task_macplist` and :py:func:`create_task_macapp`
	t   Contentst   MacOS(   t   parentt   find_or_declaret   mkdir(   R   t   namet   outt   dirt   macos(    (    s5   /git_repos/PolyLV2/poly_mclk_in/waflib/Tools/c_osx.pyt   create_bundle_dirs.   s
    

c         C   sC   |  j  } | j d ƒ } | d k r5 | |  d } n
 | d } | S(   NR
   i    s   .app(   R   t   rfind(   R   R   t   k(    (    s5   /git_repos/PolyLV2/poly_mclk_in/waflib/Tools/c_osx.pyt   bundle_name_for_output9   s    	
t   cprogramt
   cxxprogramt
   apply_linkc   
      C   sü  |  j  j s t |  d t ƒ rø|  j j d } t | ƒ } |  j | | ƒ } | j d d | j	 g ƒ } |  j
 d |  j j | ƒ |  _ t |  d d ƒ d | } |  j d	 | d
 | d t j ƒ t |  d d ƒ rÎt |  d d ƒ } t | t ƒ r&|  j j | ƒ } | s&|  j j d |  j ƒ q&n  | j j j d ƒ } t |  d d ƒ d | } xv |  j |  j ƒ D]_ } | j | p€| j ƒ }	 |  j
 d | | j |	 ƒ ƒ |  j d	 t j j | |	 ƒ d
 | ƒ qhWn  t |  j d d ƒ røt j  |  j! _" qøn  d S(   sA  
	To compile an executable into a Mac application (a .app), set its *mac_app* attribute::

		def build(bld):
			bld.shlib(source='a.c', target='foo', mac_app=True)

	To force *all* executables to be transformed into Mac applications::

		def build(bld):
			bld.env.MACAPP = True
			bld.shlib(source='a.c', target='foo')
	t   mac_appi    R   R   t   macappt   install_paths   /Applicationss   /%s/Contents/MacOS/t
   install_tot   install_fromt   chmodt	   mac_filest   mac_files_roots   Invalid mac_files_root %rt	   Resourcess   /%s/Resourcest
   is_installN(#   R   t   MACAPPt   getattrt   Falset	   link_taskt   outputsR!   R   R   R   t   create_taskt   apptaskt   add_install_filesR   t   O755t   Nonet
   isinstancet   strt   patht	   find_nodet   bldt   fatalR,   R   t	   make_nodet   to_nodesR+   t	   path_fromt   add_install_asR   R   R    t   SKIP_MEt   install_taskt   hasrun(
   R   R   R   R   t   n1t   inst_toR,   t   res_dirt   nodet   relpath(    (    s5   /git_repos/PolyLV2/poly_mclk_in/waflib/Tools/c_osx.pyt   create_task_macappB   s,    ,c   	      C   s^  |  j  j s t |  d t ƒ rZ|  j j d } t | ƒ } |  j | | ƒ } | j d d g ƒ } |  j	 d g  | ƒ |  _
 } i |  j j d j d 6|  j  d 6| _ t |  d d ƒ } | rÏ | j j | ƒ n  t |  d	 t ƒ r|  j j |  j ƒ } | r| j j | ƒ q'|  j | _ n	 t | _ t |  d
 d ƒ d | } |  j d | d | ƒ n  d S(   s?   
	Creates a :py:class:`waflib.Tools.c_osx.macplist` instance.
	R%   i    R   s
   Info.plistt   macplistt   app_nameR   t   plist_contextt	   mac_plistR'   s   /Applicationss   /%s/Contents/R(   R)   N(   R   R/   R0   R1   R2   R3   R!   R   R   R4   t	   plisttaskR   t   contextR8   t   updateR;   t   find_resourceRO   t   inputst   appendt   codet   app_infoR6   (	   R   R   R   R   RF   RP   t	   plist_ctxRI   RG   (    (    s5   /git_repos/PolyLV2/poly_mclk_in/waflib/Tools/c_osx.pyt   create_task_macplisto   s(    	t   cshlibt   cxxshlibt   propagate_uselib_varsc         C   s•   |  j  j s t |  d t ƒ r‘ g  |  j  _ |  j  _ |  j  j |  j  _ |  j  _ |  j	 t |  d g  ƒ ƒ } |  _
 d | k r‘ | j d ƒ q‘ n  d S(   s;  
	To make a bundled shared library (a ``.bundle``), set the *mac_bundle* attribute::

		def build(bld):
			bld.shlib(source='a.c', target='foo', mac_bundle = True)

	To force *all* executables to be transformed into bundles::

		def build(bld):
			bld.env.MACBUNDLE = True
			bld.shlib(source='a.c', target='foo')
	t
   mac_bundlet   uset	   MACBUNDLEN(   R   R_   R0   R1   t   LINKFLAGS_cshlibt   LINKFLAGS_cxxshlibt   macbundle_PATTERNt   cshlib_PATTERNt   cxxshlib_PATTERNt   to_listR^   RU   (   R   R^   (    (    s5   /git_repos/PolyLV2/poly_mclk_in/waflib/Tools/c_osx.pyt   apply_bundle’   s    "R   s   Contents/MacOSs   Contents/ResourcesR&   c           B   s   e  Z d  Z d Z d „  Z RS(   s   
	Creates mac applications
	t   PINKc         C   sB   |  j  d j j ƒ  t j |  j d j ƒ  |  j  d j ƒ  ƒ d  S(   Ni    (   R3   R   R   t   shutilt   copy2RT   t   srcpatht   abspath(   R   (    (    s5   /git_repos/PolyLV2/poly_mclk_in/waflib/Tools/c_osx.pyt   run¯   s    (   t   __name__t
   __module__t   __doc__t   colorRl   (    (    (    s5   /git_repos/PolyLV2/poly_mclk_in/waflib/Tools/c_osx.pyR&   ª   s   RL   c           B   s&   e  Z d  Z d Z d g Z d „  Z RS(   s   
	Creates plist files
	Rg   s   .binc         C   sj   t  |  d d  ƒ r |  j } n |  j d j ƒ  } t  |  d i  ƒ } | j | �  } |  j d j | ƒ d  S(   NRV   i    RQ   (   R0   R8   RV   RT   t   readt   formatR3   t   write(   R   t   txtRQ   (    (    s5   /git_repos/PolyLV2/poly_mclk_in/waflib/Tools/c_osx.pyRl   ¹   s    (   Rm   Rn   Ro   Rp   t   ext_inRl   (    (    (    s5   /git_repos/PolyLV2/poly_mclk_in/waflib/Tools/c_osx.pyRL   ³   s   	(   Ro   R   Rh   R   t   waflibR    R   t   waflib.TaskGenR   R   R   R   RW   R   R   R!   RK   RY   Rf   t   app_dirsR&   RL   (    (    (    s5   /git_repos/PolyLV2/poly_mclk_in/waflib/Tools/c_osx.pyt   <module>   s    $"		,"	