ó
Ý²k^c           @` sF  d  d l  m Z m Z m Z m Z d  d l m Z d  d l m Z m	 Z	 d  d l
 m Z m Z m Z m Z m Z d  d l m Z d d l m Z d d l m Z d d	 l m Z m Z d
 d l m Z d
 d l m Z d
 d l m Z d
 d l m  Z  d
 d l! m" Z" e e# ƒ Z$ d „  Z% e d „  ƒ Z& e d „  ƒ Z' d „  Z( d S(   i    (   t   absolute_importt   divisiont   print_functiont   unicode_literals(   t	   getLogger(   t   W_OKt   access(   t   basenamet   dirnamet   isdirt   isfilet   join(   t   uuid4i   (   t   create_link(   t   rm_rf(   t   islinkt   lexistsi   (   t   memoize(   t   PREFIX_MAGIC_FILE(   t	   text_type(   t   expand(   t   LinkTypec         C` s¬   t  |  ƒ }  t j d |  ƒ t t |  ƒ ƒ r› t |  ƒ } y t |  d ƒ } Wn' t t f k
 rv } t j	 | ƒ t
 SX| j ƒ  | s” t |  ƒ n  t Sn t |  t ƒ Sd  S(   Nu   checking path is writable %su   a+(   R   t   logt   traceR	   R   R   t   opent   IOErrort   OSErrort   debugt   Falset   closeR   t   TrueR   R   (   t   patht   path_existedt   fht   e(    (    s7   lib/python2.7/site-packages/conda/gateways/disk/test.pyt   file_path_is_writable   s    
c         C` s/  t  | d t |  ƒ t t ƒ  ƒ d  f ƒ } t |  ƒ sD t |  ƒ ‚ t | ƒ s\ t | ƒ ‚ t | ƒ ru t | ƒ n  t | ƒ sŽ t | ƒ ‚ z y] t	 |  | t
 j d t ƒt | ƒ } | rÖ t j d |  | ƒ n t j d |  | ƒ | SWn+ t t f k
 rt j d |  | ƒ t SXWd  t | ƒ Xd  S(   Nu
   .tmp.%s.%si   t   forceu    hard link supported for %s => %su'   hard link IS NOT supported for %s => %s(   R   R   R   R   R
   t   AssertionErrorR	   R   R   R   R   t   hardlinkR   R   R   R   R   R   R   (   t   source_filet   dest_dirt	   test_filet   is_supported(    (    s7   lib/python2.7/site-packages/conda/gateways/disk/test.pyt   hardlink_supported+   s$    , 	c         C` sÍ   t  j d |  | ƒ t | d t |  ƒ ƒ } t |  ƒ sD t |  ƒ ‚ t | ƒ s\ t | ƒ ‚ t | ƒ su t | ƒ ‚ zF y' t |  | t	 j
 d t ƒt | ƒ SWn t t f k
 r¹ t SXWd  t | ƒ Xd  S(   Nu*   checking soft link capability for %s => %su   .tmp.R$   (   R   R   R   R   R
   R%   R	   R   R   R   t   softlinkR   R   R   R   R   R   (   R'   R(   t	   test_path(    (    s7   lib/python2.7/site-packages/conda/gateways/disk/test.pyt   softlink_supportedD   s     	c         C` s   t  t |  t ƒ ƒ S(   N(   R
   R   R   (   t   prefix(    (    s7   lib/python2.7/site-packages/conda/gateways/disk/test.pyt   is_conda_environmentV   s    N()   t
   __future__R    R   R   R   t   loggingR   t   osR   R   t   os.pathR   R   R	   R
   R   t   uuidR   t   createR   t   deleteR   t   linkR   R   t   _vendor.auxlib.decoratorsR   t   base.constantsR   t   common.compatR   t   common.pathR   t   models.enumsR   t   __name__R   R#   R+   R.   R0   (    (    (    s7   lib/python2.7/site-packages/conda/gateways/disk/test.pyt   <module>   s"   "(	