
lz]c           @` sO  d  d l  m Z m Z m Z m Z y d  d l m Z Wn! e k
 rY d  d l	 m Z n Xd  d l
 Z
 d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d d l m Z e Z d d l m Z e   d d l m Z e Z d d l m Z e Z d d	 l m Z m Z m Z d d
 l m Z m Z e e Z Z e e Z Z e Z d d l m Z e Z d d l  m! Z" e" Z! d d l# m$ Z$ m% Z% m& Z& m' Z' m( Z( m) Z) m* Z* m+ Z+ e$ e% e& e' e) e* f \ Z$ Z% Z& Z' Z) Z* d d l, m- Z- e- Z- d d l. m/ Z/ e/ Z/ d d l0 m1 Z1 e1 Z1 d d l2 m3 Z3 e3 Z3 d d l4 m5 Z5 m6 Z7 e5 Z5 d   Z8 d d l9 m: Z: e: Z: d d l; m< Z< m= Z= e< e= Z< Z= d d l> m? Z? m@ Z@ e? e@ Z? Z@ d d lA mB ZB mC ZC mD ZD mE ZE eB eD ZB ZD eE ZE eC ZF ZG d d lH mI ZI mJ ZJ mK ZK mL ZL d d lM mN ZN eI eJ ZI ZJ eK ZK eN eL ZN ZL d d lO mP ZP eP ZQ d d lR mS ZS mT ZT eS eT ZS ZT d d lU mV ZV eV ZV d  d lW ZX d d l mY ZY mZ ZZ m Z m[ Z[ eZ e[ ZZ Z[ eY ZY e Z d d l\ m] Z] e] Z] d d l^ m_ Z_ m` Z` ma Za e_ e` ea Z_ Z` Za d    Zb d d! l^ mc Zd ed Zc Ze eX jf jg jg jh Zh eX jf jg jg ji Zj eX jf jg jg jk Zk eX jf jg jg jl Zl eX jf jg jg jm Zm eX jf jg jg jn Zn eX jf jg jg jo Zo eX jf jg jg jp Zp eX jf jg jg jq Zr eX jf jg jg js Zs eX jf jg jg jt Zt eX jf jg jg ju Zu eX jf jg jg jv Zv d d" lU mw Zw d#   Zx d$   Zy d%   Zz d d& l{ m| Z| m} Z} m~ Z~ m Z e| Z| e} Z} e~ Z~ e Z Z d d' l2 m Z e Z d d( l m Z e Z d d) l m Z e Z d d* l m Z e Z Z d d+ l m Z e Z d d, l m Z m Z e e Z Z d d- l m Z e Z d d. l9 m Z e Z d d/ l{ m Z m Z d d0 l{ m Z e e Z Z e Z d1 e f d2     YZ d3 e f d4     YZ d5 e f d6     YZ d d7 l; m Z d d8 l m Z d9 e d:  Z d Z d Z d;   Z d<   Z d d= l m Z m Z m Z m Z e e Z Z e e Z Z d d> l m Z d dL dM d?  Z d d+ l m Z d d@ l m Z m Z m Z e Z dN e d e e d d dA  Z e d dB  Z dC   Z d dD  Z dE   Z e( rdF   Z n  e dG  Z e dH  Z dI   Z d d e dJ d d dK  Z6 d S(O   i    (   t   absolute_importt   divisiont   print_functiont   unicode_literals(   t   HashableNi   (   t
   CondaError(   t   reset_context(   t   plan(   t   Solver(   t   specs_from_argst   spec_from_linet   specs_from_url(   t   add_parser_prefixt   add_parser_channels(   t   ArgumentParser(   t   compat(   t   PY3t   StringIOt   inputt	   iteritemst   on_wint   string_typest	   text_typet
   itervalues(   t   CondaSession(   t   TemporaryDirectory(   t	   _toposort(   t   lchmod(   t   TmpDownloadt   downloadc         C` s   t  j d  S(   Nu<   handle_proxy_407 is deprecated. Now handled by CondaSession.(   t	   _warningst   warn(   t   xt   y(    (    s,   lib/python2.7/site-packages/conda/exports.pyt   <lambda>:   t    (   t
   rm_fetched(   t   delete_trasht   move_to_trash(   t	   untrackedt   walk_prefix(   t	   MatchSpect   ResolvePackageNotFoundt   Resolvet   Unsatisfiable(   t   hashsum_filet   human_bytest   unix_path_to_wint   url_path(   t   win_path_to_unix(   t   compute_md5sum(   t   VersionOrdert   normalized_version(   t   Channel(   t
   get_prefixt   non_x86_linux_machinesR   t   sys_rc_path(   t   EntityEncoder(   t   DEFAULT_CHANNELSt   DEFAULT_CHANNELS_WINt   DEFAULT_CHANNELS_UNIXc           C` s   t  S(   N(   R:   (    (    (    s,   lib/python2.7/site-packages/conda/exports.pyR"   c   R#   (   t   PREFIX_PLACEHOLDER(   t   get_conda_build_local_urlc           C` s   t  t j j j j  S(   N(   t   listt   condat   baset   contextt   channels(    (    (    s,   lib/python2.7/site-packages/conda/exports.pyR"   u   R#   c           C` s   t  t    p g  S(   N(   R?   R>   (    (    (    s,   lib/python2.7/site-packages/conda/exports.pyR"   v   R#   c         C` s   t  j j j |  g  S(   N(   R@   RA   RB   R   (   t   fn(    (    s,   lib/python2.7/site-packages/conda/exports.pyR"   w   R#   (   t   PaddingErrort	   LinkErrort   CondaOSErrort   PathNotFoundError(   t   CrossPlatformStLink(   t   FileMode(   t   PathType(   t   PackageRecord(   t   Dist(   t   ACTIVE_SUBPROCESSESt   subprocess_call(   t   cache_fn_url(   t   ProgressiveFetchExtract(   t   CondaHTTPErrort	   LockError(   t   UnsatisfiableErrort	   Completerc           B` s#   e  Z d    Z d   Z d   Z RS(   c         C` s
   |  j    S(   N(   t
   _get_items(   t   self(    (    s,   lib/python2.7/site-packages/conda/exports.pyt	   get_items   s    c         C` s   t  S(   N(   t   True(   RW   t   item(    (    s,   lib/python2.7/site-packages/conda/exports.pyt   __contains__   s    c         C` s   t  |  j    S(   N(   t   iterRX   (   RW   (    (    s,   lib/python2.7/site-packages/conda/exports.pyt   __iter__   s    (   t   __name__t
   __module__RX   R[   R]   (    (    (    s,   lib/python2.7/site-packages/conda/exports.pyRU      s   		t   InstalledPackagesc           B` s   e  Z RS(    (   R^   R_   (    (    (    s,   lib/python2.7/site-packages/conda/exports.pyR`      s   t   memoizedc           B` s    e  Z d  Z d   Z d   Z RS(   u   Decorator. Caches a function's return value each time it is called.
    If called later with the same arguments, the cached value is returned
    (not reevaluated).
    c         C` s%   | |  _  i  |  _ t j   |  _ d  S(   N(   t   funct   cachet	   threadingt   Lockt   lock(   RW   Rb   (    (    s,   lib/python2.7/site-packages/conda/exports.pyt   __init__   s    		c         O` s   g  } x_ | D]W } t  | t  r8 | j t |   q t  | t  sW |  j | |   S| j |  q Wt |  } | t t | j     f } |  j	 B | |  j
 k r |  j
 | S|  j | |   } | |  j
 | <| SWd  QXd  S(   N(   t
   isinstanceR?   t   appendt   tuplet	   _HashableRb   t	   frozensett   sortedt   itemsRf   Rc   (   RW   t   argst   kwt   newargst   argt   keyt   value(    (    s,   lib/python2.7/site-packages/conda/exports.pyt   __call__   s    
(   R^   R_   t   __doc__Rg   Ru   (    (    (    s,   lib/python2.7/site-packages/conda/exports.pyRa      s   	(   t   rm_rf(   t   delete_prefix_from_linked_datai   c         C` s   t  |  | |  t |   d  S(   N(   t   _rm_rfRx   (   t   patht   max_retriest   trash(    (    s,   lib/python2.7/site-packages/conda/exports.pyRw      s    c         C` s   d  S(   N(   t   None(   t   _(    (    s,   lib/python2.7/site-packages/conda/exports.pyt	   hash_file   s    c         C` s   t  S(   N(   t   False(   R~   (    (    s,   lib/python2.7/site-packages/conda/exports.pyt   verify   s    (   t   execute_actionst   execute_instructionst   execute_plant   install_actions(   t   display_actionsc         C` s   d |  k r4 g  |  d D] } | | ^ q |  d <n  d |  k rh g  |  d D] } | | ^ qK |  d <n  d |  k r g  |  d D] } | | ^ q |  d <n  d   t  |  D } t |  | | | |  S(   Nu   FETCHu   LINKu   UNLINKc         S` s   i  |  ] } | |  q S(    (    (   t   .0t   prec(    (    s,   lib/python2.7/site-packages/conda/exports.pys
   <dictcomp>   s   	 (   R   t   _display_actions(   t   actionst   indext   show_channel_urlst   specs_to_removet   specs_to_addt   d(    (    s,   lib/python2.7/site-packages/conda/exports.pyR      s    ((((   t   dist_str_in_indext   fetch_indext	   get_indexc         C` s2   t  |  | | | | | |  } d   t |  D S(   Nc         S` s   i  |  ] } | t  |   q S(    (   RM   (   R   R   (    (    s,   lib/python2.7/site-packages/conda/exports.pys
   <dictcomp>   s   	 (   t
   _get_indexR   (   t   channel_urlst   prependt   platformt	   use_localt	   use_cachet   unknownt   prefixR   (    (    s,   lib/python2.7/site-packages/conda/exports.pyR      s    c         C` s&   t  |  | |  } d   t |  D S(   Nc         S` s   i  |  ] } | t  |   q S(    (   RM   (   R   R   (    (    s,   lib/python2.7/site-packages/conda/exports.pys
   <dictcomp>   s   	 (   t   _fetch_indexR   (   R   R   R   (    (    s,   lib/python2.7/site-packages/conda/exports.pyR      s    c          ` s3   d d l  m   d t f   f d     Y}  |    S(   Ni   (   t   PackageCacheDatat   package_cachec           ` s5   e  Z   f d    Z   f d   Z   f d   Z RS(   c         ` s(   t    j   j t |  j   d    S(   N(   t   boolt   first_writablet   getRM   t   to_package_refR}   (   RW   t   dist(   R   (    s,   lib/python2.7/site-packages/conda/exports.pyR[     s    c         ` s   d   t    j    D S(   Nc         s` s   |  ] } t  |  Vq d  S(   N(   RM   (   R   t   v(    (    s,   lib/python2.7/site-packages/conda/exports.pys	   <genexpr>  s    (   R   R   (   RW   (   R   (    s,   lib/python2.7/site-packages/conda/exports.pyt   keys  s    c         ` s#     j    j t |  j    d  S(   N(   R   t   removeRM   R   (   RW   R   (   R   (    s,   lib/python2.7/site-packages/conda/exports.pyt   __delitem__  s    (   R^   R_   R[   R   R   (    (   R   (    s,   lib/python2.7/site-packages/conda/exports.pyR     s   (   t   core.package_cache_dataR   t   object(   R   (    (   R   s,   lib/python2.7/site-packages/conda/exports.pyR     s    c         C` s   t  d d t j t j j t j j |    t j j t j j |   k rS d  St rw d } t j	 t
 d | } n d } t j } t j j t j j |  |   s t j t j j |  |   n  t |  | | |  d  S(   Nu'   WARNING: symlink_conda() is deprecated.t   fileu   condabint   shellu   bin(   t   printt   syst   stderrt   osRz   t   normcaset   normpathR   t	   functoolst   partialt   win_conda_bat_redirectt   symlinkt   isdirt   joint   makedirst   _symlink_conda_hlp(   R   t   root_dirR   t   wheret
   symlink_fn(    (    s,   lib/python2.7/site-packages/conda/exports.pyt   symlink_conda  s    <	!c   
      C` s(  d d d g } t  j j |  |  } t  j j |  sF t  j |  n  x | D] } t  j j | | |  } t  j j | |  } yE t  j j |  r t |  n  t  j j |  s | | |  n  WqM t t f k
 r}	 t  j j |  r|	 j	 t	 j
 t	 j t	 j t	 j f k rq   qM XqM Wd  S(   Nu   condau   activateu
   deactivate(   R   Rz   R   R   R   t   lexistsRw   t   IOErrort   OSErrort   errnot   EPERMt   EACCESt   EROFSt   EEXIST(
   R   R   R   R   t   scriptst   prefix_wheret   ft	   root_filet   prefix_filet   e(    (    s,   lib/python2.7/site-packages/conda/exports.pyR   %  s"    !c      
   C` s  d d l  m } y t j t j j |   WnI t k
 rx } | j t j k rr t j j	 t j j |   rr qy   n Xt j j
 | d  s t | d d   } | j d |   Wd QXn  | s d } n  t j j
 |  st | d  h } | j d  |  j d	  r4| j d
 | | d |  d   n | j d | | d |    Wd QXt j |  j } | | d @d ?O} t j | |  n  d S(   u-  Special function for Windows XP where the `CreateSymbolicLink`
        function is not available.

        Simply creates a `.bat` file at `dst` which calls `src` together with
        all command line arguments.

        Works of course only with callable files, e.g. `.bat` or `.exe` files.
        i   (   t   shellsu   .batu   wu   @echo off
call "%s" %%*
Nu   bash.exeu   #!/usr/bin/env bash 
u   condau   %s "$@"u   path_tou   .exeu   source %s "$@"i$  i   (   t   utilsR   R   R   Rz   t   dirnameR   R   R   R   t   isfilet   opent   writet   endswitht   statt   st_modet   chmod(   t   srct   dstR   R   t   excR   t   mode(    (    s,   lib/python2.7/site-packages/conda/exports.pyR   ?  s*    	0	&%c         ` sI   d d l  m } d d l m   | |   }   f d   t | j  D S(   u?   
    Return a dictionary of the linked packages in prefix.
    i   (   t
   PrefixData(   RM   c         ` s   i  |  ] } |   |   q S(    (    (   R   t   prefix_record(   RM   (    s,   lib/python2.7/site-packages/conda/exports.pys
   <dictcomp>s  s   	 (   t   core.prefix_dataR   t   models.distRM   R   t   _prefix_records(   R   t   ignore_channelsR   t   pd(    (   RM   s,   lib/python2.7/site-packages/conda/exports.pyt   linked_datal  s    c         ` sN   d d l  m } | j     t t |  d |  } t   f d   | D  S(   u8   
    Return the Dists of linked packages in prefix.
    i   (   t   PackageTypeR   c         3` s*   |  ]  \ } } | j    k r | Vq d  S(   N(   t   package_type(   R   R   t
   prefix_rec(   t   conda_package_types(    s,   lib/python2.7/site-packages/conda/exports.pys	   <genexpr>}  s    (   t   models.enumsR   R   R   R   t   set(   R   R   R   t   ld(    (   R   s,   lib/python2.7/site-packages/conda/exports.pyt   linkedv  s    c         C` sb   d d l  m } | |   } | j | j d  } | d k rA d St |  j |  rZ | Sd Sd S(   u   
    Return the install metadata for a linked package in a prefix, or None
    if the package is not linked in the prefix.
    i   (   R   N(   R   R   R   t   nameR}   R)   t   match(   R   R   R   R   R   (    (    s,   lib/python2.7/site-packages/conda/exports.pyt	   is_linked  s    i   c      	   C` s   t  |  | d | d | d | S(   Nt   md5t   sha256t   size(   t	   _download(   t   urlt   dst_patht   sessiont   md5sumt   urlstxtt   retriesR   R   (    (    s,   lib/python2.7/site-packages/conda/exports.pyR     s    (    (    (    (   t
   __future__R    R   R   R   t   collections.abcR   Rk   t   ImportErrort   collectionsR   R   R   R   Rd   t   warningsR   R#   R   t   base.contextR   R   t
   core.solveR   t
   cli.commonR	   R
   R   t   cli.conda_argparseR   R   R   t   commonR   t   _compatt   common.compatR   R   R   R   R   R   R   R   t   gateways.connection.sessionR   t   gateways.disk.createR   t   common.toposortR   t   gateways.disk.linkR   t   gateways.connection.downloadR   R   R   t   handle_proxy_407R   R$   t   gateways.disk.deleteR%   R&   t   miscR'   R(   t   resolveR)   R*   R+   R,   t   NoPackagesFoundt   NoPackagesFoundErrorR   R-   R.   R/   R0   t   common.pathR1   t   gateways.disk.readR2   t   md5_filet   models.versionR3   R4   t   models.channelR5   t   conda.base.contextR@   R6   R7   R8   t   _vendor.auxlib.entityR9   t   base.constantsR:   R;   R<   t   get_default_urlsR=   t   _PREFIX_PLACEHOLDERt   prefix_placeholderRA   RB   t	   arch_namet   anaconda_uploadt   binstar_uploadt   bitst   default_prefixt   default_pythont	   envs_dirst	   pkgs_dirsR   t   root_prefixR   t   root_writablet   subdirt   conda_privatet   conda_buildR>   t   get_rc_urlst   get_local_urlst   load_condarct
   exceptionsRE   RF   RG   RH   t   CondaFileNotFoundErrorRI   R   RJ   RK   t   models.recordsRL   t   IndexRecordR   RM   t   gateways.subprocessRN   RO   t   core.subdir_dataRP   RQ   RR   RS   RT   R   RU   R`   Ra   Rw   Ry   R   Rx   RY   R}   t   KEYSt   KEYS_DIRR   R   R   R   R   R   R   R   t
   core.indexR   R   R   R   R   R   R   R   R   R   R   R   R   (    (    (    s,   lib/python2.7/site-packages/conda/exports.pyt   <module>   s$  ":*	"
""	
			"

 		"			-
	