ó
à™xTc           @   sy   d  d l  m Z d  d l Z d  d l Z d Z d „  Z d „  Z d d „ Z	 d „  Z
 e d k ru e
 e j d	 ƒ n  d S(
   iÿÿÿÿ(   t   divisionNi@B c         C   s6   x/ |  j  t ƒ } | d k r" Pn  | j | ƒ q d  S(   Nt    (   t   readt   buf_sizet   write(   t   srct   destt   buf(    (    sQ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/command_line/create_unzipsfx.pyt   copy   s
     c          C   sC   x< d D]4 }  t  j j d |  d d g ƒ } | d  k	 r | Sq Wd  S(   Ns   unzipsfx_autorun_yes.exes   unzipsfx_autorun.exes   unzipsfx.exet   commandt   search_firstt   .(   s   unzipsfx_autorun_yes.exes   unzipsfx_autorun.exes   unzipsfx.exe(   t   libtbxt   patht   full_command_patht   None(   R	   t   path_cmd(    (    sQ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/command_line/create_unzipsfx.pyt   find_unzipsfx   s     
 c         C   sŸ   | d  k r t ƒ  } n  | d  k r3 t d ƒ ‚ n  |  j d ƒ sH t ‚ |  d  d } t | d ƒ } t t | d ƒ | ƒ t t |  d ƒ | ƒ | j ƒ  d  S(   Ns%   Fatal: unzipsfx executable not found.s   .zipiüÿÿÿs   .exet   wbt   rb(   R   R   t   RuntimeErrort   endswitht   AssertionErrort   openR   t   close(   t   zip_file_namet   path_unzipsfx_exet   exe_file_namet   exe_file(    (    sQ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/command_line/create_unzipsfx.pyt   create   s    c         C   s{   t  |  ƒ d	 k s* d |  k s* d |  k r6 t j GHd St  |  ƒ d k r\ t d |  d ƒ n t d |  d d |  d ƒ d S(
   s?   usage: libtbx.create_unzipsfx [path_unzipsfx_exe] zip_file_namei   i   s   -hs   --helpNR   i    R   (   i   i   (   t   lent   runt   __doc__R   (   t   args(    (    sQ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/command_line/create_unzipsfx.pyR   "   s    *t   __main__i   (   t
   __future__R    t   libtbx.pathR   t   sysR   R   R   R   R   R   t   __name__t   argv(    (    (    sQ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/command_line/create_unzipsfx.pyt   <module>   s   				
