ó
Ý²k^c           @   sÞ   d  d l  m Z 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  d l
 m Z d d l m Z m Z d d	 l m Z m Z d d
 l m Z d d l m Z m Z d Z d Z d „  Z d „  Z d S(   iÿÿÿÿ(   t   RawDescriptionHelpFormatterN(   t   expand(   t   add_parser_jsont   add_parser_prefix(   t   touch_nonadmini   (   t
   get_prefixt   print_resulti   (   t
   exceptionst   specs(   t   CondaEnvException(   t   InvalidInstallert   get_installers:   
Update the current environment based on environment file
sÉ   
examples:
    conda env update
    conda env update -n=foo
    conda env update -f=/path/to/environment.yml
    conda env update --name=foo --file=environment.yml
    conda env update vader/deathstar
c      
   C   sµ   |  j  d d t d t d t d t ƒ} t | ƒ | j d d d d	 d d
 d d ƒ| j d d d d t d d ƒ| j d d d d d	 d d  d d ƒt | ƒ | j	 d d ƒ d  S(   Nt   updatet   formatter_classt   descriptiont   helpt   epilogs   -fs   --filet   actiont   stores1   environment definition (default: environment.yml)t   defaults   environment.ymls   --prunet
   store_trues8   remove installed packages not defined in environment.ymlt   remote_definitions0   remote environment definition / IPython notebookt   nargst   ?t   funcs   .main_update.execute(
   t
   add_parserR    R   t   exampleR   t   add_argumentt   Falset   NoneR   t   set_defaults(   t   sub_parserst   p(    (    s8   lib/python2.7/site-packages/conda_env/cli/main_update.pyt   configure_parser   s2    	
	
c         C   sÑ  |  j  p |  j } y: t j d | d t |  j ƒ d t j ƒ  ƒ } | j } Wn t	 j
 k
 re ‚  n X|  j pu |  j sÜ | j sÍ t j j d t ƒ } | sÍ d } | t j d ƒ j ƒ  7} t | ƒ ‚ qÍ n  | j |  _ n  t |  d t ƒ} i  } xb | j D]W } y t | ƒ | | <Wqþ t k
 rTt j j t j d ƒ j ƒ  j | ƒ ƒ d	 SXqþ Wi d  d
 6d  d 6}	 xC | j j ƒ  D]2 \ } }
 | | } | j | |
 |  | ƒ |	 | <q}Wt | ƒ t |  | |	 ƒ d  S(   Nt   namet   filenamet	   directoryt   CONDA_DEFAULT_ENVs!   Unable to determine environment

sç   
                    Please re-run this command with one of the following options:

                    * Provide an environment name via --name or -n
                    * Re-run this command inside an activated conda environment.t   searchs8  
                Unable to install package for {0}.

                Please double check and ensure you dependencies file has
                the correct spelling.  You might also try installing the
                conda-env-{0} package to see if provides the required
                installer.
                iÿÿÿÿt   condat   pip(    R   R"   t   install_specst   detectR   t   filet   ost   getcwdt   environmentR   t   SpecNotFoundt   prefixt   environt   getR   t   textwrapt   dedentt   lstripR	   R   t   dependenciesR   R
   t   syst   stderrt   writet   formatR   t   itemst   installR   R   (   t   argst   parserR"   t   spect   envt   msgR0   t
   installerst   installer_typet   resultR   t	   installer(    (    s8   lib/python2.7/site-packages/conda_env/cli/main_update.pyt   execute?   s>    			
 
(   t   argparseR    R,   R7   R3   t   conda._vendor.auxlib.pathR   t   conda.cli.conda_argparseR   R   t
   conda.miscR   t   commonR   R   t    R   R   R)   R	   t   installers.baseR
   R   R   R   R!   RF   (    (    (    s8   lib/python2.7/site-packages/conda_env/cli/main_update.pyt   <module>   s   		 