ó
à™xTc           @   s½   d  d l  m Z y d  d l Z e j Z Wn e k
 rD Z d Z n Xd  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   s‹  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 t j ƒ  } | 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 |  ƒ \ } }  t |  ƒ d k rƒ| j d ƒ S| j d  k rŸ| j d  ƒ S|  d! } | j } t j | ƒ }	 d  }
 x` |	 D]X } t j j | ƒ \ } } | | k rÎ| d" k r| }
 Pq&| d# k r&| }
 q&qÎqÎW|
 d  k rN| d$ | | f IJd S| } | j d  k	 ro| j } n  t j j d% ƒ r‘t j d% ƒ n  t j d% ƒ t j d% ƒ t d& | d' ƒ } | j d( t j j | |
 ƒ ƒ | j ƒ  d) } | j rd } d  } n  d* } | j  d  k	 r+d+ | j  } n  t d, d' ƒ } | j d- | | | f ƒ | j ƒ  d! d  l! } | j" t  j# d, d. g ƒ } | d k r•| St j j t j ƒ  d/ ƒ } t j | ƒ } t j j | d0 | ƒ } t j j$ | ƒ sðt% ‚ t j | j& ƒ | d* IJxz | D]r } t j j | ƒ r=| d1 | IJqn  | d2 | IJt j' t j j | | ƒ t j ƒ  ƒ t j( | t) j* ƒ qWd S(3   Nt   win32s2   This application will only run on Windows systems.i   t   descriptionsz   Utility for creating an iconified Windows launcher for the specified command, which must be present in %LIBTBX_BUILD%\bin.t   bint   relative_paths(   gui_resources/icons/custom/WinPhenix.icot   tests	   --bin_dirt   destt   bin_dirt   actiont   storet   helps7   Directory containing target executable or batch script.t   defaults
   --exe_namet   exe_names   Name of iconified programs   --icont   icons   Path to .ico files   --dests   Destination paths   --bundle_allt
   bundle_allt
   store_trues)   Bundle Python interpreter, etc. into .exei    s   Executable name not specified.s$   Executables directory not specified.iÿÿÿÿs   .bats   .exes"   No program named '%s' found in %s.t
   py2exe_tmps   %s.pyt   ws*   
import subprocess
subprocess.call(r"%s")
i   t    s   'icon_resources':[(0,r'%s')],s   setup.pys  
from distutils.core import setup
import py2exe
setup(
  console=[
    {
      'script':'%s.py',
      %s
    },
  ],
  zipfile=None,
  options={
    'py2exe': {
       'includes': ['subprocess'],
       'dll_excludes' : ['w9xpopen.exe'],
       'bundle_files': %d,
    },
  })
t   py2exet   dists   %s.exes   WARNING: %s already existss   moving %s...(+   t   syst   platformt   optparset   OptionParsert   Nonet
   libtbx_envt   ost   patht   joint   abst
   build_patht   find_in_repositoriest   existst   getcwdt
   add_optiont   Falset
   parse_argst   lent   errorR   t   listdirt   splitextR   t   isdirt   shutilt   rmtreet   mkdirt   chdirt   opent   writet   closeR   R   t
   subprocesst   callt
   executablet   isfilet   AssertionErrorR   t   movet   chmodt   statt   S_IWRITE(   t   argst   outt   parsert   bin_patht	   icns_patht   ico_patht   optionst   program_nameR   t	   bin_filest   program_cmd_filet	   file_namet   baset   extR   t   ft   bundle_filest   zip_filet	   icon_rsrct   f2R2   t   rct	   dist_patht
   dist_filest   exe_file(    (    sR   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/auto_build/create_windows_exe.pyt   run   s¨    
		
	
	


		

%t   __main__i   (   t
   __future__R    t   libtbx.load_envt   libtbxt   envR   t   ImportErrort   eR   R   R+   R9   R   R   t   stdoutRQ   t   __name__t   exitt   argv(    (    (    sR   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/auto_build/create_windows_exe.pyt   <module>   s   
v