ó
Ý²k^c           @  s  d  d l  m Z 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 d  d l m Z m Z m Z d  d l 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 m Z d Z d Z d „  Z d „  Z  d S(   iÿÿÿÿ(   t   print_function(   t   RawDescriptionHelpFormatterN(   t   expand(   t   install(   t   add_parser_jsont   add_parser_prefixt   add_parser_networking(   t   rm_rf(   t   touch_nonadmini   (   t
   get_prefixt   print_resulti   (   t
   exceptionst   specs(   t   InvalidInstallert   get_installers4   
Create an environment based on an environment file
s%  
examples:
    conda env create
    conda env create -n name
    conda env create vader/deathstar
    conda env create -f=/path/to/environment.yml
    conda env create -f=/path/to/requirements.txt -n deathstar
    conda env create -f=/path/to/requirements.txt -p /home/user/software/deathstar
c      
   C  s¿   |  j  d d t d t d t d t ƒ} | j d d d d	 d d
 d d ƒt | ƒ t | ƒ | j d d d d d	 d d  d d ƒ| j d d d d d d t ƒt	 | ƒ | j
 d d ƒ d  S(   Nt   createt   formatter_classt   descriptiont   helpt   epilogs   -fs   --filet   actiont   stores6   environment definition file (default: environment.yml)t   defaults   environment.ymlt   remote_definitions0   remote environment definition / IPython notebookt   nargst   ?s   --forces\   force creation of environment (removing a previously existing environment of the same name).t
   store_truet   funcs   .main_create.execute(   t
   add_parserR   R   t   examplet   add_argumentR   R   t   Nonet   FalseR   t   set_defaults(   t   sub_parserst   p(    (    s8   lib/python2.7/site-packages/conda_env/cli/main_create.pyt   configure_parser#   s4    		


c         C  s  d d l  m } |  j p |  j } yg t j d | d t |  j ƒ d t j	 ƒ  ƒ } | j
 } |  j d  k rˆ |  j d  k rˆ | j |  _ n  Wn t j k
 r¢ ‚  n Xt |  d t ƒ} |  j rì | | j k rì t j j | ƒ rì t | ƒ n  t j | d |  j ƒi d  d 6d  d	 6} t | j j ƒ  ƒ d
 k rhd } g  }	 t | ƒ }
 |
 j | |	 |  | ƒ | | <n‰ x† | j j ƒ  D]u \ } }	 y, t | ƒ }
 |
 j | |	 |  | ƒ | | <Wqxt k
 rìt j  j! t" j# d ƒ j$ ƒ  j% | ƒ ƒ d SXqxWt& | ƒ t' |  | | ƒ d  S(   Niÿÿÿÿ(   t   contextt   namet   filenamet	   directoryt   searcht   jsont   condat   pipi    sQ  
                    Unable to install package for {0}.

                    Please double check and ensure your dependencies file has
                    the correct spelling.  You might also try installing the
                    conda-env-{0} package to see if provides the required
                    installer.
                    ((   t   conda.base.contextR%   R   R&   R   t   detectR   t   filet   ost   getcwdt   environmentt   prefixR   R   t   SpecNotFoundR	   R    t   forcet   root_prefixt   patht   existsR   t   cli_installt   check_prefixR*   t   lent   dependenciest   itemsR   R   R   t   syst   stderrt   writet   textwrapt   dedentt   lstript   formatR   R
   (   t   argst   parserR%   R&   t   spect   envR3   t   resultt   installer_typet	   pkg_specst	   installer(    (    s8   lib/python2.7/site-packages/conda_env/cli/main_create.pyt   executeJ   s<    	* 	
(!   t
   __future__R    t   argparseR   R0   R>   RA   t   conda._vendor.auxlib.pathR   t	   conda.cliR   R9   t   conda.cli.conda_argparseR   R   R   t   conda.gateways.disk.deleteR   t
   conda.miscR   t   commonR	   R
   t    R   R   t   installers.baseR   R   R   R   R$   RM   (    (    (    s8   lib/python2.7/site-packages/conda_env/cli/main_create.pyt   <module>   s    
	'