
ݲk^c           @` s  d  d l  m Z m Z m Z m Z d  d l m Z m Z d  d l m	 Z	 d  d l
 Z
 d  d l m Z m Z m Z m Z d  d l Z d  d l m Z d  d l Z d d l m Z d d	 l m Z m Z m Z m Z m Z m Z m Z m Z m Z m  Z  m! Z! m" Z" m# Z# d d
 l$ m% Z% m& Z& d d l' m( Z( m) Z) m* Z* d d l+ m, Z, d d l- m. Z. d d l/ m0 Z0 m1 Z1 m2 Z2 d d l3 m4 Z4 m5 Z5 m6 Z6 d d l7 m8 Z8 d d l9 m: Z: m; Z; m< Z< m= Z= m> Z> m? Z? d d l@ mA ZA mB ZB mC ZC d d l@ mD ZD mE ZE d d lF mG ZG mH ZH mI ZI mJ ZJ d d lK mL ZL d d lM mN ZN mO ZO mP ZP mQ ZQ mR ZR mS ZS mT ZT mU ZU d d lV mW ZW d d lX mY ZY d d lZ m[ Z[ m\ Z\ m] Z] d d l^ m_ Z_ m` Z` ma Za d d lb mc Zc d d ld me Ze d d lf mg Zg d d lh mi Zi d d  lj mk Zk ml Zl mm Zm e	 en  Zo d!   Zp d"   Zq d#   Zr e d$ d% d& d' d( d) d* f  Zs e d+ d, d- d. d/ d0 d1 d2 d3 d4 f	  Zt e d5 d6 d7 d8 d% f  Zu e d9 d: d; d< d= d> d? d@ dA dB f	  Zv dC ew f dD     YZx dE ey ez dF  Z{ dG   Z| d S(H   i    (   t   absolute_importt   divisiont   print_functiont   unicode_literals(   t   defaultdictt
   namedtuple(   t	   getLoggerN(   t   basenamet   dirnamet   isdirt   join(   t   format_exception_onlyi   (   t   PackageCacheData(   t   CompileMultiPycActiont   CreateNonadminActiont   CreatePrefixRecordActiont   CreatePythonEntryPointActiont   LinkPathActiont   MakeMenuActiont!   RegisterEnvironmentLocationActiont   RemoveLinkedPackageRecordActiont   RemoveMenuActiont   UnlinkPathActiont#   UnregisterEnvironmentLocationActiont   UpdateHistoryActiont   AggregateCompileMultiPycAction(   t
   PrefixDatat   get_python_version_for_prefixi   (   t
   CondaErrort   CondaMultiErrort   conda_signal_handler(   t   first(   t   dals(   t   concatt   concatvt
   interleave(   t   DEFAULTS_CHANNEL_NAMEt   PREFIX_MAGIC_FILEt   SafetyChecks(   t   context(   t   ensure_text_typet	   iteritemst
   itervaluest   odictt   on_wint	   text_type(   t   Spinnert   dashlistt   time_recorder(   t   DummyExecutort   ThreadLimitedThreadPoolExecutor(   t   explode_directoriest   get_all_directoriest   get_major_minor_versiont#   get_python_site_packages_short_path(   t   signal_handler(   t   DisallowedPackageErrort   EnvironmentNotWritableErrort   KnownPackageClobberErrort	   LinkErrort   RemoveErrort   SharedLinkPathClobberErrort   UnknownPackageClobberErrort   maybe_raise(   t   mkdir_p(   t   rm_rf(   t   isfilet   lexistst   read_package_info(   t   hardlink_supportedt   is_conda_environmentt   softlink_supported(   t   subprocess_call(   t   LinkType(   t   VersionOrder(   t	   MatchSpec(   t   ensure_comspec_sett   human_bytest   wrap_subprocess_callc         C` sn   t  |  d d  } t j r" t j St j r2 t j St | |  rH t j St j	 rg t
 | |  rg t j St j S(   Nu   infou
   index.json(   R
   R'   t   always_copyRI   t   copyt   always_softlinkt   softlinkRE   t   hardlinkt   allow_softlinksRG   (   t   extracted_package_dirt   target_prefixt   source_test_file(    (    s.   lib/python2.7/site-packages/conda/core/link.pyt   determine_link_type1   s    		c   
      ` s*  t      f d     j D  } y t   j  } WnW t k
 r y t   j j  } Wq t k
 r d   j   j   j	 f } q Xn Xd d | d f } t
     |  f } t d   | D  } t t | d t d t } t      f d	   | D  }	 t  t | |	 |   S(
   Nc         3` s$   |  ] } t      |  Vq d  S(   N(   R   (   t   .0t   trgt(   t   prefix_recordRV   t   transaction_context(    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>@   s   u   %s-%s-%su   %s/%su
   conda-metau   .jsonc         s` s   |  ] } | j  Vq d  S(   N(   t   target_short_path(   RY   t   axn(    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>S   s    t   already_splitt   reversec         3` s*   |  ]  } t      | t j  Vq d  S(   N(   R   RI   t	   directory(   RY   t   d(   R[   RV   R\   (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>U   s   (   t   tuplet   filesR   RU   t   AttributeErrort   linkt   sourcet   namet   versiont   buildR   R4   t   sortedR3   t   TrueR"   (
   R\   RV   R[   t   unlink_path_actionsRU   t   meta_short_patht   remove_conda_meta_actionst   _all_dt   all_directoriest   directory_remove_actions(    (   R[   RV   R\   s.   lib/python2.7/site-packages/conda/core/link.pyt   make_unlink_actions>   s,    c         ` s   g  t  t |    D] } d  ^ q } x^ | p1 d D]P   t      t   f d   t |   D d   } | d  k	 r2   | | <q2 q2 Wt |  S(   Nc         3` s0   |  ]& \ } } | j  j   j k r | Vq d  S(   N(   t   repodata_recordRh   (   RY   t   qt   pkg_info(   t   spec(    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>i   s    	(    (   t   ranget   lent   NoneRK   t   nextt	   enumerateRc   (   t   packages_info_to_linkt   specst   _t   matched_specst   idx(    (   Rw   s.   lib/python2.7/site-packages/conda/core/link.pyt   match_specs_to_distse   s    %	u   PrefixSetupu   target_prefixu   unlink_precsu
   link_precsu   remove_specsu   update_specsu   neutered_specsu   PrefixActionGroupu   remove_menu_action_groupsu   unlink_action_groupsu   unregister_action_groupsu   link_action_groupsu   register_action_groupsu   compile_action_groupsu   make_menu_action_groupsu   entry_point_action_groupsu   prefix_record_groupsu   ActionGroupu   typeu   pkg_datau   actionsu   ChangeReportu   prefixu   specs_to_removeu   specs_to_addu   removed_precsu	   new_precsu   updated_precsu   downgraded_precsu   superseded_precsu   fetch_precst   UnlinkLinkTransactionc           B` s=  e  Z d    Z e d    Z d   Z d   Z e d  d    Z d   Z	 d   Z
 e d    Z e d	    Z e d
    Z e d    Z d   Z d   Z e d    Z e d    Z e d d   Z e d    Z e d    Z e d    Z e d    Z d   Z d   Z d   Z e d    Z RS(   c         G` s	  t  d   | D  |  _ t    |  _ x\ t |  j  D]K } t j d | j d j d   | j D  d j d   | j	 D   q5 Wd  |  _ t |  _ t |  _ t j s t j d k r t   n t t j  |  _ t j s t j d k r t   n t t j  |  _ d  S(   Nc         s` s   |  ] } | j  | f Vq d  S(   N(   RV   (   RY   t   stp(    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>   s    uh   initializing UnlinkLinkTransaction with
  target_prefix: %s
  unlink_precs:
    %s
  link_precs:
    %s
u   
    c         s` s   |  ] } | j    Vq d  S(   N(   t   dist_str(   RY   t   prec(    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>   s    c         s` s   |  ] } | j    Vq d  S(   N(   R   (   RY   R   (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>   s    i   (   R+   t   prefix_setupst   prefix_action_groupsR*   t   logt   infoRV   R
   t   unlink_precst
   link_precsRz   t   _pfet   Falset	   _preparedt	   _verifiedR'   t   debugt   verify_threadsR1   R2   t   verify_executort   execute_threadst   execute_executor(   t   selft   setupsR   (    (    s.   lib/python2.7/site-packages/conda/core/link.pyt   __init__   s    	!			!!c         C` s=   t  d   t |  j  D  o< t d   t |  j  D  S(   Nc         s` s!   |  ] } | j  p | j Vq d  S(   N(   R   R   (   RY   R   (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>   s    c         s` s   |  ] } t  | j  Vq d  S(   N(   RF   RV   (   RY   R   (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>   s   (   t   anyR*   R   t   all(   R   (    (    s.   lib/python2.7/site-packages/conda/core/link.pyt   nothing_to_do   s     	c         C` s<   |  j  d  k r |  j   n  |  j  j s8 |  j  j   n  d  S(   N(   R   Rz   t   _get_pfet	   _executedt   execute(   R   (    (    s.   lib/python2.7/site-packages/conda/core/link.pyt   download_and_extract   s    c         C` s   |  j  d  k r |  j   n  |  j  j s8 |  j  j   n  |  j rE d  Si  |  _ t d t j	 oe t j
 t j  k xc t |  j  D]R } |  j |  j | j | j | j | j | j | j  } t |   |  j | j <q WWd  QXt |  _ d  S(   Nu   Preparing transaction(   R   Rz   R   R   R   R   R\   R.   R'   t	   verbosityt   quiett   jsonR*   R   t   _prepareRV   R   R   t   remove_specst   update_specst   neutered_specst   PrefixActionGroupR   Rl   (   R   R   t   grps(    (    s.   lib/python2.7/site-packages/conda/core/link.pyt   prepare   s     		 u   unlink_link_prepare_and_verifyc         C` s   |  j  s |  j   n  t j s& t  t j t j k rE t |  _	 d  St
 d t j o\ t j t j  h |  j |  j |  j  } | r y t t |  t  Wn t |  j d    n Xt j |  n  Wd  QXt |  _	 d  S(   Nu   Verifying transactionu   temp_dir(   R   R   R'   t   dry_runt   AssertionErrort   safety_checksR&   t   disabledRl   R   R.   R   R   R   t   _verifyR   R   R?   R   RA   R\   R   R   (   R   t
   exceptions(    (    s.   lib/python2.7/site-packages/conda/core/link.pyt   verify   s"    		c         C` sk   |  j  s |  j   n  t j s& t  z, |  j t t t t	 |  j
      Wd  t |  j d  Xd  S(   Nu   temp_dir(   R   R   R'   R   R   t   _executeRc   R!   R#   R*   R   RA   R\   (   R   (    (    s.   lib/python2.7/site-packages/conda/core/link.pyR      s    	,c         C` s   d d l  m } |  j d  k	 r+ |  j } nW |  j sJ | d  |  _ } n8 t t d   t |  j  D   } | |  |  _ } | S(   Ni   (   t   ProgressiveFetchExtractc         s` s   |  ] } | j  Vq d  S(   N(   R   (   RY   R   (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s    (    (   t   package_cache_dataR   R   Rz   R   t   setR!   R*   (   R   R   t   pfeR   (    (    s.   lib/python2.7/site-packages/conda/core/link.pyR      s    	%c   &      ` s  t    s\ y t   Wq\ t t f k
 rX } t j t |   t d    q\ Xn  t       f d   | D }	 t	 d   |	 D  }	 t	 d   | D  }
 t
 |
  s t  t	 d   t | |
  D  } t	  f d   | D  } |  j  |	 |  } | | d <t |  } | | d <t  d	  | d
 <g  } g  } xa |	 D]Y } | j t d | t |  |     | j t d | t j | |      qRW| rt |   f } t d d  |   g } n d } t | |  } g  } g  } g  } g  } g  } xHt | | |  D]4\ } } } t d | |  j | |  | |    } | j |  t d | |  j | |  | | |    } | j |  t d | |  j | |  | | |    } | j |  t d | t j | |  |    }  | j |   t | j | j | j |  j  }! | j t j | |  | | |!   q(Wt d d  |   g }" t  j |  | | |  }# t! |   f }$ t d d  |$ |#   g }% t" | | | | |% | | | |" 	 S(   NuS   Unable to create prefix directory '%s'.
Check that you have sufficient permissions.c         3` s!   |  ] }   j  | j  Vq d  S(   N(   t   getRh   (   RY   R   (   t   prefix_data(    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s    c         s` s   |  ] } | r | Vq d  S(   N(    (   RY   t   lpd(    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s    c         s` s   |  ] } t  j |  Vq d  S(   N(   R   t   get_entry_to_link(   RY   R   (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s   c         s` s$   |  ] \ } } t  | |  Vq d  S(   N(   RD   (   RY   R   t   pcrec(    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s   c         3` s!   |  ] } t  | j    Vq d  S(   N(   RX   RU   (   RY   Rv   (   RV   (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>"  s   u   target_python_versionu   target_site_packages_short_pathu	   .condatmpu   temp_diru   unlinku   remove_menusu
   unregisteru   linku   entry_pointu   compileu
   make_menusu   recordu   register(    (#   R	   R@   t   IOErrort   OSErrorR   R   t   reprR   R   Rc   R   R   t   zipt   _get_python_versionR6   R
   t   appendt   ActionGroupRs   R   t   create_actionsR   Rz   R   t   _make_link_actionst   _make_entry_point_actionst   _make_compile_actionsR   R"   t   actionst   extendR   R   R   R   (&   t   clsR\   RV   R   R   R   R   R   t   et   prefix_recs_to_unlinkt   pkg_cache_recs_to_linkR}   t
   link_typest   python_versiont   spt   remove_menu_action_groupst   unlink_action_groupst
   prefix_rect   axnst   unregister_action_groupst   matchspecs_for_link_distst   link_action_groupst   entry_point_action_groupst   compile_action_groupst   make_menu_action_groupst   record_axnsRv   t   ltRw   t   link_agt   entry_point_agt
   compile_agt   make_menu_agt   all_link_path_actionst   prefix_record_groupst   history_actionst   register_actionst   register_action_groups(    (   R   RV   s.   lib/python2.7/site-packages/conda/core/link.pyR     s    				

	
									c         C` s   t  d   |  D  } g  } xp | D]h } | j r8 q# n  | j   } | r# d j t t |  |   } t j d | |  | j |  q# q# W| S(   Nc         s` s%   |  ] } | D] } | j  Vq q d  S(   N(   R   (   RY   t   action_groupst   axngroup(    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s   u    u"   Verification error in action %s
%s(	   R!   t   verifiedR   R
   R   t   typeR   R   R   (   t   prefix_action_groupt   all_actionst   error_resultsR^   t   error_resultt   formatted_error(    (    s.   lib/python2.7/site-packages/conda/core/link.pyt   _verify_individual_level  s    		c      	   ` s/  |  \ } } | j  } | j } d     t   f d   | D  } d   | D } g  } t t  } xh| D]`}	 xW|	 j D]L}
 t |
 t  r |
 j } nL t |
 t	  r q| n7 t
 |
 d  s |
 j t j k r |
 j f n t   } x | D]       |  j |	   | k r t t |    r t d   t |  j   D d  f d   } | r| j t  |	 j j j   | j   t   q| j t  |	 j j j   t   q q Wq| Wql WxX t |  D]J \  } t |  d k r| j t  t d	   | D  t   qqW| S(
   Nc         S` s   t  r |  j   S|  S(   N(   R,   t   lower(   t   p(    (    s.   lib/python2.7/site-packages/conda/core/link.pyt   <lambda>  s    c         3` s=   |  ]3 } | j  D]# } t | t  r   | j  Vq q d  S(   N(   R   t
   isinstanceR   R]   (   RY   t   grpR^   (   t   lower_on_win(    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s   c         s` s4   |  ]* } | j  D] } t | t  r | Vq q d  S(   N(   R   R   R   (   RY   R   R^   (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s   u	   link_typec         s` s   |  ] } | Vq d  S(   N(    (   RY   R   (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s    t   keyc         ` s     |  j  k S(   N(   Rd   (   R   (   t   path(    s.   lib/python2.7/site-packages/conda/core/link.pyR     s    i   c         s` s!   |  ] } | j  j j   Vq d  S(   N(   t   package_infoRt   R   (   RY   R^   (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s    (   R   R   R   R   t   listR   R   R   t   target_short_pathsR   t   hasattrt	   link_typeRI   Ra   R]   Rc   R   RC   R
   R   R   t   iter_recordsR:   R   Rt   R   R'   R>   R)   Ry   R=   (   t+   target_prefix_AND_prefix_action_group_tupleRV   R   R   R   t   unlink_pathst   create_lpr_actionsR   t   link_paths_dictR^   t   link_path_actionR   t   colliding_prefix_recR   (    (   R   R   s.   lib/python2.7/site-packages/conda/core/link.pyt   _verify_prefix_level  sX    			
	!				c         #` s   t  t j d d  t j f   t   f d   t |   D  } t d   | D  } t d   | D d  \ } } | r | d  k r t d  Vn  | d  k r t j	 } t
 |  } t d   | j   D  } d } d }	 t d   | j   D d  }
 nx | j } t
 |  } t d	   | j   D  } t d
   | j pFd D  } t d   | j ped D  }	 | j }
 | |  k rxV |
 D]K } t |  j } | | k r| | k s| |	 k rt d |  VqqWn  t d   t j D  } xR t |   D]D } x; | j D]0  t  f d   | D  rt   VqqWqWx t |   D] } t  | j t  } t |  } d  } y) t t |   } t | d  j   Wn> t k
 r| t k rt t |   n  t | j  VqXX| st t |   qX| sXt |  qXqXWd  S(   Nu   envsu   _conda_c         3` s$   |  ] } | j    k r | Vq d  S(   N(   RV   (   RY   t   setup(   t   conda_prefixes(    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s    c         s` s.   |  ]$ } | j  D] } | j d  k Vq q d S(   u   condaN(   R   Rh   (   RY   R  R   (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s   c         s` s:   |  ]0 } | j  D]  } | j d  k r | | f Vq q d S(   u   condaN(   R   Rh   (   RY   R  R   (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s   uT   This operation will remove conda without replacing it with
another version of conda.c         s` s   |  ] } | j  Vq d  S(   N(   Rh   (   RY   t   rec(    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s    c         s` s'   |  ] } | j  d  k r | j Vq d S(   u   condaN(   Rh   t   depends(   RY   t   record(    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s    c         s` s   |  ] } | j  Vq d  S(   N(   Rh   (   RY   R  (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s    c         s` s   |  ] } | j  Vq d  S(   N(   Rh   (   RY   R   (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s    c         s` s   |  ] } | j  Vq d  S(   N(   Rh   (   RY   R   (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>   s    uW   '%s' is a dependency of conda and cannot be removed from
conda's operating environment.c         s` s   |  ] } t  |  Vq d  S(   N(   RK   (   RY   t   s(    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>.  s    c         3` s   |  ] } | j     Vq d  S(   N(   t   match(   RY   Rb   (   R   (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>1  s    u   a(   NN(    (    (    (    (    (   R
   R'   t   root_prefixRc   R*   R   R{   Rz   R<   t   conda_prefixR   R   RV   R   R   R  RK   Rh   t   disallowed_packagesR8   R%   RC   R@   R   t   opent   closet   EnvironmentErrorR   RA   R9   (   R   t   conda_setupst   conda_unlinkedt
   conda_prect   conda_final_setupt   conda_final_prefixt   pdt   pkg_names_already_lnkdt   pkg_names_being_lnkdt   pkg_names_being_unlnkdt   conda_linked_dependst   conda_dependencyt   dep_namet
   disallowedt   prefix_setupt	   test_patht   test_path_existedt   dir_existed(    (   R  R   s.   lib/python2.7/site-packages/conda/core/link.pyt   _verify_transaction_level  sl    	"				c         C` s   t  d   t j |  D  } | r) | Sg  } x< |  j j t j t |   D] } | rN | j |  qN qN Wx< |  j j t j t	 |   D] } | r | j |  q q W| S(   Nc         s` s   |  ] } | r | Vq d  S(   N(    (   RY   t   exc(    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>H  s    (
   Rc   R   R!  R   t   mapR   R*   R   R  R)   (   R   R   R   t   transaction_exceptionsR   R"  (    (    s.   lib/python2.7/site-packages/conda/core/link.pyR   F  s    c         ` s  t  d   | D  } t d   | D  } t d   | D  } t d   | D  } t d   | D  } t d   | D  } t d   | D  } t t  1t d  g  }	 t d	 t j o t j t j	  x| d
 t
 f | d t f f D]d\ }
   } | s3x | D] } t j |  qWn  x] |
 D]U } | j d k } | j } | j } t | rp| n | j | | rd n d |  q:Wx6 |  j j t j |
  D] } | r|	 j |  qqW| rx | D] } t j |  qWn  x3 |
 D]+ } t j |  } | r|	 j |  qqWg  } | r| j |  g  | D] } | j D] } | ^ qVqI} | rt |   } | j t d d  | g | j   qn  x6 |  j j t j |  D] } | r|	 j |  qqWt    f d   | D  } x3 | D]+ } t j |  } | r|	 j |  qqW|	 r:Pn  | r x | D] } t j |  qGWq q WWd  QX|	 r|	 d } | j d } d  | j d k } } | j } | rt j d | rd n d | j   f  n  g  } t j  rTt d t j ot j t j	  D t! t  |   } x* | D]" } t j" |  } | j |  q%WWd  QXn  t# t  t$ t% | t#  r| j d | j d f n | f |     n/ x, | D]$ } x | j D] } | j&   qWqWWd  QXWd  QXd  S(   Nc         s` s$   |  ] } | j  d  k r | Vq d S(   u   unlinkN(   R   (   RY   t   group(    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>[  s    c         s` s$   |  ] } | j  d  k r | Vq d S(   u   linkN(   R   (   RY   R%  (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>]  s    c         s` s$   |  ] } | j  d  k r | Vq d S(   u   compileN(   R   (   RY   R%  (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>^  s    c         s` s$   |  ] } | j  d  k r | Vq d S(   u   entry_pointN(   R   (   RY   R%  (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>_  s    c         s` s$   |  ] } | j  d  k r | Vq d S(   u   recordN(   R   (   RY   R%  (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>a  s    c         s` s$   |  ] } | j  d  k r | Vq d S(   u
   make_menusN(   R   (   RY   R%  (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>b  s    c         s` s$   |  ] } | j  d  k r | Vq d S(   u   remove_menusN(   R   (   RY   R%  (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>d  s    u   unlink_link_executeu   Executing transactionu
   unregisteru   registeru   unlinku
   pre-unlinku   pre-linku   compilec         3` s$   |  ] } | j    k r | Vq d  S(   N(   R   (   RY   R%  (   t   register_group(    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s    i    i   u(   An error occurred while %s package '%s'.u   uninstallingu
   installingu   Rolling back transactioni   ('   Rc   R   R7   R   R0   R.   R'   R   R   R   R   Rl   R   t   _execute_actionsR   RV   t   pkg_datat
   run_scriptRU   R   R#  R   t   _execute_post_link_actionsR   R   R   R   Rz   t   errorsR   t   errorR   t   rollback_enabledt   reversedt   _reverse_actionsR   R"   R   t   cleanup(   R   t   all_action_groupst   unlink_actionst   link_actionst   compile_actionst   entry_point_actionst   record_actionst   make_menu_actionst   remove_menu_actionsR   R%  t   install_sideR   t	   is_unlinkRV   R   R"  t   composite_agt   agR^   t   individual_actionst	   compositeR   R   t   actiont   rollback_excst   reverse_actionst   excs(    (   R&  s.   lib/python2.7/site-packages/conda/core/link.pyR   Y  s     		)
				)c         C` s  |  j  } |  j } t | d  } t |  s: t |  n  y~ |  j d k rh t j d | j   |  n1 |  j d k r t j d | j   | | j	  n  x |  j
 D] } | j   q WWnS t k
 r} d } t j r t j |   } n  t t t | f |  f |    SXd  S(   Nu
   conda-metau   unlinku,   ===> UNLINKING PACKAGE: %s <===
  prefix=%s
u   linku6   ===> LINKING PACKAGE: %s <===
  prefix=%s
  source=%s
(    (   RV   R(  R
   R	   R@   R   R   R   R   RU   R   R   t	   ExceptionR'   R-  R   R/  R   Rc   R"   (   R   RV   R   t   conda_meta_dirR?  R   t   reverse_excs(    (    s.   lib/python2.7/site-packages/conda/core/link.pyR'    s,    						c         C` s   |  j  } |  j d k } |  j } | r y& t | | | r? d n d d t Wq t k
 r } d } t j r t j	 |   } n  t
 t t | f |  f |    SXn  d  S(   Nu   unlinku   post-unlinku	   post-linkt   activate(    (   RV   R   R(  R)  Rl   RC  R'   R-  R   R/  R   Rc   R"   (   R   RV   R:  R   R   RE  (    (    s.   lib/python2.7/site-packages/conda/core/link.pyR*    s    				ic   	      C` s  |  j  } |  j } |  j d k r= t j d | j   |  n+ |  j d k rh t j d | j   |  n  g  } | d k  r |  j } n |  j | d  } xm t t t	 |    D]S \ } } y | j
   Wq t k
 r} t j d | d t | j |  q Xq W| S(	   Nu   unlinku3   ===> REVERSING PACKAGE UNLINK: %s <===
  prefix=%s
u   linku1   ===> REVERSING PACKAGE LINK: %s <===
  prefix=%s
i    i   u#   action.reverse() error in action %rt   exc_info(   RV   R(  R   R   R   R   R   R.  Rc   R|   R`   RC  R   Rl   R   (	   R   t   reverse_from_idxRV   R   R   RA  t   axn_idxR?  R   (    (    s.   lib/python2.7/site-packages/conda/core/link.pyR/  	  s&    				%c         C` s   t  d   | D d   } | rQ | j j } | s7 t  t j d |  t |  St |   } | r d   | D } t  | d   } | d  k r t j d |  | Sn  t j d  d  S(   Nc         s` s'   |  ] } | j  j d  k r | Vq d S(   u   pythonN(   Rt   Rh   (   RY   R   (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>)  s    u.   found in current transaction python version %sc         s` s$   |  ] } | j  d  k r | Vq d S(   u   pythonN(   Rh   (   RY   t   lnkd_pkg_data(    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>6  s    u)   found in current prefix python version %su!   no python version found in prefix(	   R{   Rz   Rt   Ri   R   R   R   R5   R   (   RV   t   pcrecs_to_unlinkR}   t   linking_new_pythont   full_versiont   linked_python_versiont   find_pythont   unlinking_this_python(    (    s.   lib/python2.7/site-packages/conda/core/link.pyR   %  s     	
c   	      C` s[   |  | | | f } t  j |   } t  j d | |  } t j |   } t t | | |   S(   Nt   file_link_actions(   R   t   create_file_link_actionst   create_directory_actionsR   R   Rc   R"   (	   R\   R   RV   t   requested_link_typet   requested_spect   required_quadRQ  RS  t   create_nonadmin_actions(    (    s.   lib/python2.7/site-packages/conda/core/link.pyR   B  s    	c         C` s   |  | | | f } t  j |   S(   N(   R   R   (   R\   R   RV   RT  RU  R   RV  (    (    s.   lib/python2.7/site-packages/conda/core/link.pyR   l  s    c         ` sD   |    | | f } t    f d   | D  } t j d | j |  S(   Nc         3` s$   |  ] } | j    k r | Vq d  S(   N(   R(  (   RY   R<  (   R   (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>v  s    RQ  (   R{   R   R   R   (   R\   R   RV   RT  RU  R   RV  t   link_action_group(    (   R   s.   lib/python2.7/site-packages/conda/core/link.pyR   r  s    	c         ` s!  g  } |  j  d  k r" |  j   n  x t t |  j   D] \ } \ } } t t  } | d k r |  j  j   t	 d   |  j  j
 D    | d j   f d   |  j  j D  n  | j | d <x" | j D] } | d j |  q Wx" | j D] } | d j |  q W| j |  q8 W| S(   Ni    c         s` s   |  ] } | j  Vq d  S(   N(   t   url(   RY   R^   (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s    u   FETCHc         3` s$   |  ] } | j    k r | Vq d  S(   N(   RY  (   RY   R   (   t   download_urls(    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s    u   PREFIXu   UNLINKu   LINK(   R   Rz   R   R|   R)   R   R   R   R   R   t   cache_actionsR   R   RV   R   R   (   R   t   legacy_action_groupsRu   t   prefixR  R   R   (    (   RZ  s.   lib/python2.7/site-packages/conda/core/link.pyt   _make_legacy_action_groupsz  s     (*c         C` s   |  j    } t d   |  j j D  } xu t | t |  j   D][ \ } \ } } |  j | | j | j	 | | j
 | j  } |  j |  } t t |   qA W| S(   Nc         s` s   |  ] } | j  Vq d  S(   N(   RY  (   RY   R^   (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s    (   R^  R   R   R[  R   R)   R   t   _calculate_change_reportR   R   R   R   t   _change_report_strt   printR(   (   R   R\  RZ  R   R]  R   t   change_reportt   change_report_str(    (    s.   lib/python2.7/site-packages/conda/core/link.pyt   print_transaction_summary  s    +	c         ` s  d d g     j  d | j    j  d  | j rv   j  d t t d   | j D  d d    j  d  n  | j r   j  d t t d	   | j D  d d    j  d  n  d
   }  f d   } d    d    | j r  j  d  g  } d } x t | j d  f d   D]k } | j } d t |  } | | 7} | t	 | j
 j   }	 |	 r| d |	 7} n  | j  | | f  q*W  j | |     j  d" d d    j  d d d t |   n  d   }
   f d   }   f d   } | j ro  j  d  xL t | j d  D]2 } | j | }  |  } | | | j    q6Wn  | j r  j  d  xY t | j d  D]? } | j | }   j  d d j | j | j | j f   qWn  | j r^  j  d  xd t | j d  D]J } | j | \ } }  |  } |
 | |  \ } } | | | |  qWn  | j r  j  d  xd t | j d  D]J } | j | \ } }  |  } |
 | |  \ } } | | | |  qWn  | j rX  j  d   xd t | j d  D]J } | j | \ } }  |  } |
 | |  \ } } | | | |  qWn    j  d    j  d  d! j    S(#   Nu    u   ## Package Plan ##
u     environment location: %su     removed specs:%sc         s` s   |  ] } t  |  Vq d  S(   N(   R-   (   RY   R  (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s    t   indenti   u     added / updated specs:%sc         s` s   |  ] } t  |  Vq d  S(   N(   R-   (   RY   R  (    (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>  s    c         S` s6   t  j t k r d St  j d  k r2 |  t k r2 d S|  S(   Nu    (   R'   t   show_channel_urlsR   Rz   R$   (   R  (    (    s.   lib/python2.7/site-packages/conda/core/link.pyt   channel_filt  s
    c         ` s   g  } d } | j  | d  | j  | d d d f  x[ |  D]S \ } } |   | j  d | j | j f } | r | | 7} n  | j  |  q? W| S(	   Nu       %-27s|%17su   packageu   buildu   -i   i   (   u   packageu   buildu   -----------------(   R   t   namekeyRi   Rj   (   t   dists_extrast   linest   fmtR   t   extrat   line(   t   strip_global(    s.   lib/python2.7/site-packages/conda/core/link.pyt   print_dists  s    'c         S` s   |  j  d  r d |  d S|  S(   Nu   global:u   0:i   (   t
   startswith(   t   x(    (    s.   lib/python2.7/site-packages/conda/core/link.pyR     s    c         S` s   |  j  d  r |  d S|  S(   Nu   global:i   (   Rp  (   Rq  (    (    s.   lib/python2.7/site-packages/conda/core/link.pyR     s    u,   
The following packages will be downloaded:
i    R   c         ` s     |  j   S(   N(   Rh  (   Rq  (   t   convert_namekey(    s.   lib/python2.7/site-packages/conda/core/link.pyR     s    u   %15su     u    u   -i<   i+   u   Total: %14sc         S` s  |  j  j | j  j k } |  j | j k } |  j | j k } |  j | j k } g  } g  } | sf | r |  j  j d  k	 r | j |  j  j  n  | j  j d  k	 r | j | j  j  q n  | r | j d |  j  | j d | j  n  | s | r5| s| r5| j d |  j d  | j d | j d  n  | sA| rz| j |  j d |  j  | j | j d | j  n  d j |  d j |  f S(   Nu   /u   ::u   -u    (   t   channelRh   t   subdirRi   Rj   Rz   R   R
   (   t   unlink_prect	   link_prect   channel_changet   subdir_changet   version_changet   build_changet   builder_leftt   builder_right(    (    s.   lib/python2.7/site-packages/conda/core/link.pyt	   diff_strs  s*    c         ` s>   t  |   d k r# |  d  d }  n    j d |  | f  d  S(   Ni   i   u   ~u
     %-18s %s(   Ry   R   (   t   display_keyt   disp_str(   t   builder(    s.   lib/python2.7/site-packages/conda/core/link.pyt
   add_single  s    c         ` sd   t  |   d k r# |  d  d }  n  t  |  d k rF | d  d } n    j d |  | | f  d  S(   Ni   i   u   ~i&   i%   u     %-18s %38s --> %s(   Ry   R   (   R~  t   left_strt	   right_str(   R  (    s.   lib/python2.7/site-packages/conda/core/link.pyt
   add_double  s
    u/   
The following NEW packages will be INSTALLED:
u)   
The following packages will be REMOVED:
u)   
The following packages will be UPDATED:
uI   
The following packages will be SUPERSEDED by a higher-priority channel:
u,   
The following packages will be DOWNGRADED:
u   
u       (   R   R]  t   specs_to_removeR/   Rk   t   specs_to_addt   fetch_precst   sizeRM   R-   Rs  t   canonical_nameR   t	   new_precst	   record_idt   removed_precsR
   Rh   Ri   Rj   t   updated_precst   superseded_precst   downgraded_precs(   R   Rb  Rg  Ro  t   disp_lstt   total_download_bytesR   R  Rl  t   schannelR}  R  R  Rh  Rv  R~  Ru  R  R  (    (   R  Rr  Rn  s.   lib/python2.7/site-packages/conda/core/link.pyR`    s    									
"			$			c      
   ` s  d   | D  d   | D  t    t    } }  f d   | | D }  f d   | | D }	 i  }
 i  } i  } | | @} x | D] }  |  | } } t | j  } t | j  } | j | j k } | | k r | s | | k r| | f |
 | <q | j j | j j k r[| j | j k r[| | k rHq n  | | f | | <q | | f | | <q Wt    f d   | D  } t |  | | | |	 |
 | | | 	 } | S(   Nc         S` s   i  |  ] } | | j   q S(    (   Rh  (   RY   R   (    (    s.   lib/python2.7/site-packages/conda/core/link.pys
   <dictcomp>.  s   	 c         S` s   i  |  ] } | | j   q S(    (   Rh  (   RY   R   (    (    s.   lib/python2.7/site-packages/conda/core/link.pys
   <dictcomp>/  s   	 c         ` s   i  |  ] }   | |  q S(    (    (   RY   Rh  (   t
   unlink_map(    s.   lib/python2.7/site-packages/conda/core/link.pys
   <dictcomp>2  s   	c         ` s   i  |  ] }   | |  q S(    (    (   RY   Rh  (   t   link_map(    s.   lib/python2.7/site-packages/conda/core/link.pys
   <dictcomp>4  s   	c         3` s$   |  ] } | j    k r | Vq d  S(   N(   RY  (   RY   R   (   RZ  (    s.   lib/python2.7/site-packages/conda/core/link.pys	   <genexpr>Q  s    (   R   RJ   Ri   t   build_numberRs  Rh   Rt  t   ChangeReport(   R]  R   R   RZ  R  R  t   unlink_namekeyst   link_namekeysR  R  R  R  R  t   common_namekeysRh  Ru  Rv  t	   unlink_vot   link_vot   build_number_increasesR  Rb  (    (   RZ  R  R  s.   lib/python2.7/site-packages/conda/core/link.pyR_  +  s:    
	(   t   __name__t
   __module__R   t   propertyR   R   R   R0   R   R   R   t   classmethodR   t   staticmethodR   R  R!  R   R   R'  R*  R/  R   R   R   R   R^  Rd  R`  R_  (    (    (    s.   lib/python2.7/site-packages/conda/core/link.pyR      s2   					OU		z"*			u	   post-linkc      	   C` s  t  |  t r d n d d | j | t r- d n d f  } t |  sJ t St j j   } | d k rt } yR t	 |   } t
 | j    }	 Wd QXt r d |	 k s d	 |	 k r t } n  Wn& t k
 r }
 t j |
 d
 t n X|  | d <| st j t d  | j    qn  d } t rt   y t j t d  } Wn+ t k
 rpt j d | | j    t SX| rt t t j |  t j t d | f  \ } } q7| d d | g } n{ d t j k rd n d } | rt t t j |  t j t d | f  \ } } n* d t j k r"d n d } | d | g } t j | d <| pM|  | d <| j | d <| j | d <| j | d <t j  j  t! |  | j" d d  f  | d <t j d | j   | d d j  |   z t# | d | d  t! |  d! t } | j$ d" k rt% |   } | d+ k rd$ | j   k rEd% | | f } n: t d&  | | j   | | pfd' | j& | j' | j$ f } t( |   qt j d( | | j    t Sn t% |   t SWd | d k	 rd) t j k rt) |  qt j* d* j+ |   n  Xd S(,   ue   
    call the post-link (or pre-unlink) script, and return True on success,
    False on failure
    u   Scriptsu   binu	   .%s-%s.%su   batu   shu   pre-linkNu(   %PREFIX%\python.exe %SOURCE_DIR%\link.pyu&   $PREFIX/bin/python $SOURCE_DIR/link.pyRG  u
   SOURCE_DIRu  
            Package %s uses a pre-link script. Pre-link scripts are potentially dangerous.
            This is because pre-link scripts have the ability to change the package contents in the
            package cache, and therefore modify the underlying files for already-created conda
            environments.  Future versions of conda may deprecate and ignore pre-link scripts.
            u   COMSPECu/   failed to run %s for %s due to COMSPEC KeyErroru   @CALLu   /du   /cu   bsdu   bashu   .u   -xu   ROOT_PREFIXu   PREFIXu   PKG_NAMEu   PKG_VERSIONu   PKG_BUILDNUMu   PATHu    u$   for %s at %s, executing script: $ %su    t   envR   t   raise_on_errori    u	   post-linku   opensslu   %s failed for: %suJ  
                    %s script failed for package %s
                    location of failed script: %s
                    ==> script messages <==
                    %s
                    ==> script output <==
                    stdout: %s
                    stderr: %s
                    return code: %s
                    u   <None>uI   %s script failed for package %s
consider notifying the package maintaineru   CONDA_TEST_SAVE_TEMPSu0   CONDA_TEST_SAVE_TEMPS :: retaining run_script {}(   u   pre-linku	   post-link(,   R
   R,   Rh   RB   Rl   t   ost   environRP   R   R  R(   t   readRC  R   R   t   warningst   warnR    R   Rz   RL   t   strt   KeyErrorR   RN   R'   R
  t   devt   syst   platformRi   R  t   pathsepR   R   RH   t   rct   messagest   stdoutt   stderrR;   RA   t   warningt   format(   R]  R   R?  t
   env_prefixRF  R   R  t   is_old_noarcht   ft   script_textR   t   script_callert   comspect   command_argst
   shell_patht   responset   mt   message(    (    s.   lib/python2.7/site-packages/conda/core/link.pyR)  X  s    %
	--.	 $		
c         C` s   t  |  d  } z t |  r t |  f } | j   } t | d  rZ | j d  } n  t | j d  d t j	 r~ t
 j n t
 j | SWd  QXn  Wd  t |  Xd  S(   Nu   .messages.txtu   decodeu   utf-8t   file(   R
   RB   R  R  R   t   decodeRa  t   encodeR'   R   R  R  R  RA   (   R]  R   t   fiR  (    (    s.   lib/python2.7/site-packages/conda/core/link.pyR    s    .(}   t
   __future__R    R   R   R   t   collectionsR   R   t   loggingR   R  t   os.pathR   R   R	   R
   R  t	   tracebackR   R  R   R   t   path_actionsR   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   t    R   R   R   t   _vendor.auxlib.collectionR   t   _vendor.auxlib.ishR    t   _vendor.toolzR!   R"   R#   t   base.constantsR$   R%   R&   t   base.contextR'   t   common.compatR(   R)   R*   R+   R,   R-   t	   common.ioR.   R/   R0   R1   R2   t   common.pathR3   R4   R5   R6   t   common.signalsR7   R   R8   R9   R:   R;   R<   R=   R>   R?   t   gateways.diskR@   t   gateways.disk.deleteRA   t   gateways.disk.readRB   RC   RD   t   gateways.disk.testRE   RF   RG   t   gateways.subprocessRH   t   models.enumsRI   t   models.versionRJ   t   resolveRK   t   utilsRL   RM   RN   R  R   RX   Rs   R   t   PrefixSetupR   R   R  t   objectR   Rz   R   R)  R  (    (    (    s.   lib/python2.7/site-packages/conda/core/link.pyt   <module>   s   ""X.":		'	   i