ó
	xTc           @   s   d  d l  Z  d  d l Z d  d l Z d  d l m Z d  d l m Z m Z d   Z d   Z	 e
 d k r| e	 e  j d  n  d S(   i˙˙˙˙N(   t   easy_run(   t   Sorryt   Usagec         C   sT  d } t  j d k r d } n  t j j d d |  } t  j j |  se t j j d d |  } n  t  j j |  s} t  | j d  d k  s t  d	 t  j	 k rß d
 t  j	 k rĹ t
 d   n  d t  j	 d
 | f } n d | d } g  } x> |  D]6 } | j d  d k  st  | j d | d  qú Wt j d | d j |  f  S(   Nt    t   nts   .exet   paths   phaser/exe/phasers
   exe/phasert   "i    t   LIBTBX__VALGRIND_FLAG__t   LIBTBX_VALGRINDs&   LIBTBX_VALGRIND not defined - exiting.s   %s "%s"s   %s %st    (   t   ost   namet   libtbxt   envt   under_buildR   t   isfilet   AssertionErrort   findt   environR   t   appendR    t   callt   join(   t   argst   exet   phaser_patht   cmdt   qargst   arg(    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/phaser/command_line/main.pyt
   run_binary	   s$     	c         C   s  t  } d } t |   d k r3 t |   } t } n¸ d |  k rT t |   } t } n d |  k sx d |  k sx d |  k r t  } nj d |  k rł d d l m } | j j   t } n8 t |   d k rë d d l m } | j |   t } n  | s t	 d	   n  t
 j |  d  S(
   Ni    s	   --versions   --helps	   --optionss   --usages   --show-defaultsi˙˙˙˙(   t   drivers:  
phenix.phaser is a multi-function command: it can launch either the binary
version, which accepts CCP4-style keyword input, or the Python version, which
uses the standard Phenix configuration file syntax.  If called with no
arguments or the recognized command-line flags, the binary will be launched;
if a valid Phenix configuration file is provided on the command line, it
will run the Python version.

CCP4 style:
  phenix.phaser
  phenix.phaser [--version]

Phenix style:
  phenix.phaser [params.eff] [<param_name>=<param_value> ...]
  phenix.phaser --show-defaults
(   t   Falset   lenR   t   Truet   phaser.phenix_interfaceR   t   master_philt   showt   runR   t   syst   exit(   R   t   started_phasert	   exit_codeR   (    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/phaser/command_line/main.pyt   phaser_wrapper   s,    		$			t   __main__i   (   R%   R
   t   libtbx.load_envR   R    t   libtbx.utilsR   R   R   R)   t   __name__t   argv(    (    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/phaser/command_line/main.pyt   <module>   s   		&