ó
ß™xTc           @   s½   d  d l  m Z y d  d l Z Wn e k
 r; Z d Z n
 Xe j Z d  d l	 Z	 d  d l
 Z
 d  d l Z d  d l Z d  d l Z e j d „ Z e d k r¹ e j e e j d ƒ ƒ n  d S(   iÿÿÿÿ(   t   divisionNc      
   C   sI  t  j d k r | d IJd St j d d ƒ } d  } } t d  k	 r„ t j j t	 t j
 ƒ d ƒ } t j d d d	 t j j ƒ } n  | j d
 d d d d d d d | ƒ| j d d d d d d d d d  ƒ| j d d d d d d d d | ƒ| j d d d d d d d d t j ƒ  ƒ| j d d d d d d d d t ƒ| j d d d d d d d  d d  ƒ| j |  ƒ \ } }  t |  ƒ d! k rœ| j d" ƒ S| j d  k r¸| j d# ƒ S|  d$ } t	 t j j
 ƒ } t j j | d ƒ } | t j | ƒ k r| d% | | f IJd Sy d$ d  l }	 Wn t k
 rF}
 | d& IJd SX| } | j d  k	 rh| j } n  d' } | j r€d( } n  t j j | ƒ r¢t j | ƒ n  t j | ƒ t j | ƒ t  d) | d* ƒ } | j! d+ t j j | | ƒ | f ƒ | j" ƒ  t  d, d* ƒ } | j! d- ƒ | j" ƒ  t# j$ d. d/ |	 j% j& ƒ } d$ d  l' } t  j( } | j) d  k	 rp| j) } n! t d  k	 r‘t	 t j j* ƒ } n  y= | d0 d1 g }  | j+ |  ƒ } | d! k rÍt, d2 ƒ ‚ n  Wn t, k
 rì| d3 IJd SX| | d4 d) | g }  | j- d  k	 r%|  j. | j- ƒ n  | j+ |  ƒ } | d! k rD| S| d5 d6 g }  | j rl|  j. d7 ƒ n  | j+ |  ƒ } | d! k r‹| St j j/ t j j d8 d9 | ƒ ƒ } t j j | ƒ sÎt0 | ƒ ‚ t j | j1 ƒ t j j d9 | ƒ rt j d9 | ƒ n  t j2 | t j ƒ  ƒ | d: t j j t j ƒ  d9 | ƒ IJd! S(;   Nt   darwins.   This application will only run on Mac systems.i   t   descriptionsu   Utility for creating an iconified Mac launcher for the specified command, which must be present in $LIBTBX_BUILD/bin.t   bint   relative_paths&   gui_resources/icons/custom/phenix.icnst   tests	   --bin_dirt   destt   bin_dirt   actiont   storet   helps'   Directory containing target executable.t   defaults
   --app_namet   app_names   Name of iconified programs   --icont   icons   Path to .icns files   --dests   Destination paths   --alias_buildt   alias_buildt
   store_trues/   Generate alias build without Python interpreters   --python_interpretert   python_interpreters'   Python interpreter to use for final appi    s   Executable name not specified.s$   Executables directory not specified.iÿÿÿÿs"   No program named '%s' found in %s.s   py2app not installed.t
   py2app_tmpt
   py2app_bins   %s.pyt   wsY   
import os
import sys
os.environ["PYTHONPATH"] = ""
os.spawnv(os.P_NOWAIT, "%s", ["%s"])
s	   setup.cfgs   [py2app]
argv-emulation=0s   .pyc$s   .pys   -cs   'import py2app's   oops!s-   py2app not available, aborting .app creation.s   --make-setups   setup.pyt   py2apps   -At   dists   %s.apps
   Created %s(3   t   syst   platformt   optparset   OptionParsert   Nonet
   libtbx_envt   ost   patht   joint   abst
   build_patht   find_in_repositoriest   existst
   add_optiont   getcwdt   Falset
   parse_argst   lent   errorR   t   libtbxt   envt   listdirt   py2app.script_py2applett   ImportErrorR   R   t   isdirt   shutilt   rmtreet   mkdirt   chdirt   opent   writet   closet   ret   subt   script_py2applett   __file__t
   subprocesst
   executableR   t
   python_exet   callt   RuntimeErrorR   t   appendt   abspatht   AssertionErrorR   t   move(   t   argst   outt   parsert   bin_patht	   icns_patht   optionst   program_namet	   build_dirR   R   t   eR   t   py2app_bin_dirt   ft   script_nameR:   R;   t   rct   app_path(    (    sN   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/auto_build/create_mac_app.pyt   run   s¼    
		
	



		 

	 
	%'t   __main__i   (   t
   __future__R    t   libtbx.load_envR)   t	   ExceptionRK   R   R   R*   R   R/   R6   R   R   t   stdoutRQ   t   __name__t   exitt   argv(    (    (    sN   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/auto_build/create_mac_app.pyt   <module>   s   
	d