B
    l‚z]@ú  ã            
   @   s€  d dl 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Zd dlmZmZmZmZmZmZmZ d dlZd dl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$m%Z%m&Z&m'Z'm(Z(m)Z) d	d
l*m+Z, d	dl-m.Z. d	dl/m0Z0m1Z1 d	dl2m3Z3 d	dl4m5Z5 d	dl6m7Z7 d	dl8m9Z9m:Z:m;Z; d	dl<m=Z=m>Z>m?Z?m@Z@mAZAmBZB d	dlCmDZDmEZEmFZFmGZGmHZHmIZI d	dlJmKZK d	dlLmMZMmNZN d	dlOmPZPmQZQmRZR d	dlSmTZT d	dl*mUZU ye V¡  W nD eWeXfk
r  ZY z eYjekrîe Zej[¡ n‚ W ddZY[YX Y nX e
e\ƒZ]ddddddœZ^dddd hZ_d!d"d#œZ`eed$ƒƒZaeej[d%ƒZbd&d'„ Zcd(d)„ Zdd*d+„ Zed,d-„ Zfd.d/„ ZgG d0d1„ d1eDƒZhd2d3„ Zie&dfd4d5„ZjG d6d7„ d7ekƒZlG d8d9„ d9ekƒZmemƒ Zne&dfd:d;„ZodQd<d=„Zpde&dfd>d?„ZqdRd@dA„ZrerZse0dBdC„ ƒZtdDdE„ ZudSdFdG„ZvdTdHdI„ZwdJdK„ ZxdUdMdN„ZyyehdOdƒazW n@ eEk
rz ZY z e{e|eYƒej}dP e ~d¡ W ddZY[YX Y nX dS )Vé    )Úabsolute_importÚdivisionÚprint_functionÚunicode_literals)ÚOrderedDict)ÚENOENT)Ú	getLoggerN)ÚabspathÚbasenameÚ
expanduserÚisdirÚisfileÚjoinÚsplité   )ÚAPP_NAMEÚChannelPriorityÚDEFAULTS_CHANNEL_NAMEÚREPODATA_FNÚ"DEFAULT_AGGRESSIVE_UPDATE_PACKAGESÚDEFAULT_CHANNELSÚDEFAULT_CHANNEL_ALIASÚDEFAULT_CUSTOM_CHANNELSÚDepsModifierÚERROR_UPLOAD_URLÚPLATFORM_DIRECTORIESÚPREFIX_MAGIC_FILEÚPathConflictÚROOT_ENV_NAMEÚSEARCH_PATHÚSafetyChecksÚSatSolverChoiceÚUpdateModifieré   )Ú__version__)Úuser_data_dir)ÚmemoizeÚmemoizedproperty)Údals)Ú
IndexedSet)Ú
frozendict)ÚconcatÚconcatvÚunique)ÚNoneTypeÚ	iteritemsÚ
itervaluesÚodictÚon_winÚstring_types)ÚConfigurationÚConfigurationLoadErrorÚMapParameterÚPrimitiveParameterÚSequenceParameterÚValidationError)Úlinux_get_libc_version)ÚexpandÚpaths_equal)Ú
has_schemeÚpath_to_urlÚsplit_scheme_auth_token)Úenv_override)ÚCONDA_PACKAGE_ROOTÚlinuxZosxÚwinÚzos)Zlinux2rB   ÚdarwinZwin32rD   Zarmv6lZarmv7lZaarch64Zppc64leZx86Zx86_64)é    é@   z
~/.condarcz.condarcc             C   sh   | rt |dƒt dddƒf}nt dddƒt |dƒf}trL|t tttƒdƒf7 }ttdd„ t||ƒD ƒƒƒS )NÚenvsú~z.condac             s   s   | ]}t |ƒV  qd S )N)r;   )Ú.0Úp© rL   ú1lib/python3.7/site-packages/conda/base/context.pyú	<genexpr>T   s    z-mockable_context_envs_dirs.<locals>.<genexpr>)r   r2   r%   r   Útupler)   r,   )Úroot_writableÚroot_prefixÚ
_envs_dirsÚ
fixed_dirsrL   rL   rM   Úmockable_context_envs_dirsG   s    
rT   c             C   s   | rt | ƒsd|  S dS )Nz3channel_alias value '%s' must have scheme/protocol.T)r=   )ÚvaluerL   rL   rM   Úchannel_alias_validationW   s    rV   c              C   s   t j} d| j| jf S )Nz%d.%d)ÚsysÚversion_infoÚmajorÚminor)ZverrL   rL   rM   Údefault_python_default]   s    r[   c             C   sh   | r\t | ƒdkr`| d dkr`y(t| ƒ} d|   kr:dk rBn ndS W q` tk
rX   Y q`X ndS d|  S )Né   r   Ú.g       @g      @Tz<default_python value '%s' not of the form '[23].[0-9]' or '')ÚlenÚfloatÚ
ValueError)rU   rL   rL   rM   Údefault_python_validationb   s    ra   c             C   s&   t | tƒr"t| ƒs"t| ƒs"d|  S dS )NzŽssl_verify value '%s' must be a boolean, a path to a certificate bundle file, or a path to a directory containing certificates of trusted CAs.T)Ú
isinstancer3   r   r   )rU   rL   rL   rM   Ússl_verify_validationr   s
    
rc   c                   sr  e Zd ZedƒZedƒZedƒZedƒZedddZedƒZ	edƒZ
edƒZedƒZedƒZeeƒZeeƒ eef edZedƒZedƒZedƒZedƒZedƒZededd	Zeded
d	Zededd	Zededd	ZeeeddZ ee!j"ƒZ#edƒZ$ee%jƒZ&eeddZ'eedddZ(edƒZ)eeƒZ*edƒZ+edƒZ,edddZ-eede.j/ddZ0eedddZ1edddZ2eeddZ3ede4efdZ5edee4f de6ddZ7eddeef dd Z8edd!eef dd Z9e:eef dd"Z;ed#ƒZ<ed$ƒZ=ed%ƒZ>edd&dZ?edƒZ@eeAd'eBd(ZCeeDjEƒZFeeeGfd)dd*ZHe:eeId+ddZJe:eKd,ddZLeeeMd-ddZNeed.dZOe:edd"ZPedƒZQede4efdZRedƒZSeedd"ZTedƒZUeed/eVfƒZWede4efd0d	ZXedd1dZYedd2dZZedd3e4efd4Z[edƒZ\edƒZ]edƒZ^ee_ƒZ`edƒZaedƒZbedƒZcedƒZdedƒZeede4efdZfedƒZgedd5ed4ZheeijjƒZkeeljmƒZneeojpƒZqedƒZredƒZsedƒZtedƒZuedƒZvedƒZwedd6e4efd4Zxedd7dZye:ed8dZzd¥‡ fd9d:„	Z{d;d<„ Z|e}d=d>„ ƒZ~e}d?d@„ ƒZe}dAdB„ ƒZ€e}dCdD„ ƒZe}dEdF„ ƒZ‚e}dGdH„ ƒZƒe}dIdJ„ ƒZ„e}dKdL„ ƒZ…e}dMdN„ ƒZ†e}dOdP„ ƒZ‡e}dQdR„ ƒZˆe}dSdT„ ƒZ‰e}dUdV„ ƒZŠe}dWdX„ ƒZ‹eŒdYdZ„ ƒZe}d[d\„ ƒZŽe}d]d^„ ƒZe}d_d`„ ƒZe}dadb„ ƒZ‘e}dcdd„ ƒZ’eŒdedf„ ƒZ“e}dgdh„ ƒZ”e}didj„ ƒZ•e}dkdl„ ƒZ–e}dmdn„ ƒZ—e}dodp„ ƒZ˜eŒdqdr„ ƒZ™e}dsdt„ ƒZše}dudv„ ƒZ›e}dwdx„ ƒZœeŒdydz„ ƒZe}d{d|„ ƒZže}d}d~„ ƒZŸeŒdd€„ ƒZ eŒdd‚„ ƒZ¡eŒdƒd„„ ƒZ¢e}d…d†„ ƒZ£e}d‡dˆ„ ƒZ¤e}d‰dŠ„ ƒZ¥e}d‹dŒ„ ƒZ¦eŒddŽ„ ƒZ§eŒdd„ ƒZ¨eŒd‘d’„ ƒZ©eŒd“d”„ ƒZªeŒd•d–„ ƒZ«eŒd—d˜„ ƒZ¬eŒd™dš„ ƒZ­eŒe®d›ddœddž„ ƒƒZ¯e}dŸd „ ƒZ°d¡d¢„ Z±eŒd£d¤„ ƒZ²‡  Z³S )¦ÚContextTF)Zself_update)Úaliasesz({default_env}) )Úelement_typeÚ
validationr   )Údefault_threads)rf   re   )Úrepodata_threads)Úverify_threads)Úexecute_threads)Úaggressive_update_packagesú&)Ústring_delimiter)Zdisallow)re   rn   Ú )Úroot_dirrQ   )Ú	envs_dirsZ	envs_path)re   rn   Ú
expandvars)Ú	pkgs_dirs)re   rr   )Úsubdir)Úsubdirsr   )rf   )Z
verify_ssl)rf   re   rg   rr   N)Zclient_cert)re   rf   rr   )Zclient_cert_key)rr   gÍÌÌÌÌL"@g      N@r\   )Zadd_binstar_token)Úchannel_alias)re   rg   )ÚchannelsÚchannel)Údefaultre   rr   )Úcustom_channels)Úcustom_multichannels)Údefault_channels)Úmigrated_channel_aliaseszcurrent_repodata.json)Úuse_only_tar_bz2)Zsoftlink)Úcopy)Zyes)re   rf   )ÚverboseÚ	verbosity)Úbinstar_upload)Úcroot)zconda-buildÚconda_buildc                sž   |d krt }|r„d|kr|jp d dd¡d }|dkr„d|krR|jrR|jtjd< n2d	|kr„|jr„tt|ƒ}|tj	kr„tt|ƒtjd< t
t| ƒj|t|d
 d S )NÚfuncro   r]   r   éÿÿÿÿ)ZcreateZinstallÚupdateÚremoveZ	uninstallZupgradeÚprefixÚCONDA_PREFIXÚname)Úsearch_pathZapp_nameÚargparse_args)r   r…   Úrsplitr‰   ÚosÚenvironr‹   Údetermine_target_prefixÚcontextrQ   Úsuperrd   Ú__init__r   )ÚselfrŒ   r   Z	func_nameÚtarget_prefix)Ú	__class__rL   rM   r”     s    

zContext.__init__c             C   sT   g }| j r*| js*td| jddƒ}| |¡ | jrP| jrPtd| jddƒ}| |¡ |S )NÚclient_ssl_certz
<<merged>>zC'client_ssl_cert' is required when 'client_ssl_cert_key' is definedÚalways_copyzZ'always_copy' and 'always_softlink' are mutually exclusive. Only one can be set to 'True'.)Úclient_ssl_cert_keyr˜   r9   Úappendr™   Úalways_softlink)r•   ÚerrorsÚerrorrL   rL   rM   Úpost_build_validation2  s    



zContext.post_build_validationc          
   C   s>   t tdd„ dd„ | j| j| j d¡t| jdƒdfD ƒD ƒƒƒS )Nc             s   s   | ]}t |ƒr|V  qd S )N)r   )rJ   Ú	full_pathrL   rL   rM   rN   C  s    z2Context.conda_build_local_paths.<locals>.<genexpr>c             s   s   | ]}|rt |ƒV  qd S )N)r;   )rJ   ÚdrL   rL   rM   rN   D  s    zroot-dirz	conda-bldz~/conda-bld)rO   r-   Ú_crootÚbld_pathr„   Úgetr   rQ   )r•   rL   rL   rM   Úconda_build_local_paths@  s    


zContext.conda_build_local_pathsc             C   s   t dd„ | jD ƒƒS )Nc             s   s   | ]}t |ƒV  qd S )N)r>   )rJ   rK   rL   rL   rM   rN   O  s    z1Context.conda_build_local_urls.<locals>.<genexpr>)rO   r¥   )r•   rL   rL   rM   Úconda_build_local_urlsM  s    zContext.conda_build_local_urlsc             C   sb   | j rtt| j ƒƒS | jr(tt| jƒƒS d| jkrDtt| jd ƒƒS | jrVt| jdƒS tdƒS dS )z1This is where source caches and work folders livezroot-dirz	conda-bldz~/conda-bldN)	r¢   r	   r   r£   r„   rP   r   rQ   r;   )r•   rL   rL   rM   rƒ   Q  s    
zContext.crootc             C   s   | j S )N)rƒ   )r•   rL   rL   rM   Úlocal_build_root_  s    zContext.local_build_rootc             C   s0   y| j S  tk
r*   t| jƒ | _ }|S X d S )N)Ú_Context__conda_buildÚAttributeErrorÚdictÚ_conda_build)r•   r¨   rL   rL   rM   r„   c  s
    zContext.conda_buildc             C   s,   t  ¡ }| j dkr|tkr|S t| j S d S )NrB   )ÚplatformÚmachineÚnon_x86_linux_machinesÚ_arch_namesÚbits)r•   ÚmrL   rL   rM   Ú	arch_namel  s    zContext.arch_namec             C   s   t ƒ S )N)Úconda_in_private_env)r•   rL   rL   rM   Úconda_privatet  s    zContext.conda_privatec             C   s   t  tjd¡S )NÚunknown)Ú_platform_mapr¤   rW   r¬   )r•   rL   rL   rM   r¬   x  s    zContext.platformc             C   s   | j r| j S d S )N)Ú_default_threads)r•   rL   rL   rM   rh   |  s    zContext.default_threadsc             C   s   | j r| j S | jS )N)Ú_repodata_threadsrh   )r•   rL   rL   rM   ri   €  s    zContext.repodata_threadsc             C   s$   | j r| j }n| jr| j}nd}|S )Nr   )Ú_verify_threadsrh   )r•   ÚthreadsrL   rL   rM   rj   „  s    zContext.verify_threadsc             C   s$   | j r| j }n| jr| j}nd}|S )Nr   )Ú_execute_threadsrh   )r•   rº   rL   rL   rM   rk   Ž  s    zContext.execute_threadsc             C   sF   | j r| j S t ¡ }|tkr$d| S | jdkr2dS d| j| jf S d S )Nzlinux-%srD   zzos-zz%s-%d)Ú_subdirr¬   r­   r®   r°   )r•   r±   rL   rL   rM   rt   ˜  s    
zContext.subdirc             C   s   | j r| j S | jdfS )NZnoarch)Ú_subdirsrt   )r•   rL   rL   rM   ru   ¤  s    zContext.subdirsc             C   s   t tt| jƒƒS )N)Ú	frozensetr,   r   ru   )r•   rL   rL   rM   Úknown_subdirs¨  s    zContext.known_subdirsc             C   s   | j r
dS dtj S d S )NrF   é   )Úforce_32bitrO   Ú__itemsize__)r•   rL   rL   rM   r°   ¬  s    zContext.bitsc             C   s   | j S )N)rQ   )r•   rL   rL   rM   rp   ³  s    zContext.root_dirc          
   C   sd   t | jtƒ}t|ƒr`yt|dƒ}W n0 ttfk
rR } zt |¡ dS d }~X Y nX | 	¡  dS dS )Nza+FT)
r   rQ   r   r   ÚopenÚIOErrorÚOSErrorÚlogÚdebugÚclose)r•   ÚpathZfhÚerL   rL   rM   rP   ¹  s    
zContext.root_writablec             C   s   t | j| j| jƒS )N)rT   rP   rQ   rR   )r•   rL   rL   rM   rq   É  s    zContext.envs_dirsc                sn   | j rttdd„ | j D ƒƒƒS tjr(dnd‰ | jtddƒf}trP|tt	t	ƒf7 }tt‡ fdd„|D ƒƒƒS d S )Nc             s   s   | ]}t |ƒV  qd S )N)r;   )rJ   rK   rL   rL   rM   rN   Ð  s    z$Context.pkgs_dirs.<locals>.<genexpr>Zpkgs32ZpkgsrI   z.condac             3   s   | ]}t t|ˆ ƒƒV  qd S )N)r;   r   )rJ   rK   )Úcache_dir_namerL   rM   rN   Ù  s    )
Ú
_pkgs_dirsrO   r)   r’   rÁ   rQ   r   r2   r%   r   )r•   rS   rL   )rË   rM   rs   Í  s    zContext.pkgs_dirsc             C   s8   ddl m} | ¡ j}t|dƒ}ddlm} ||ƒ |S )Nr#   )ÚPackageCacheDataz.trash)Úmkdir_p)Zcore.package_cache_datarÍ   Zfirst_writableÚpkgs_dirr   Úgateways.disk.createrÎ   )r•   rÍ   rÏ   Ú	trash_dirrÎ   rL   rL   rM   rÑ   Û  s    

zContext.trash_dirc             C   sr   | j r| j S t d¡}|d tdfkr*| jS tj|kr<t|ƒS x$| jD ]}t||ƒ}t	|ƒrD|S qDW t| jd |ƒS )NZCONDA_DEFAULT_ENVÚrootr   )
Úactive_prefixr   Úgetenvr   rQ   Úsepr	   rq   r   r   )r•   Z_default_envÚenvs_dirÚdefault_prefixrL   rL   rM   r×   å  s    


zContext.default_prefixc             C   s
   t  d¡S )NrŠ   )r   rÔ   )r•   rL   rL   rM   rÓ   õ  s    zContext.active_prefixc             C   s   t t dd¡ƒS )NZCONDA_SHLVLr†   )Úintr   rÔ   )r•   rL   rL   rM   Úshlvlù  s    zContext.shlvlc                s$   ddl m‰  t‡ fdd„| jD ƒƒS )Nr#   )Ú	MatchSpecc             3   s   | ]}ˆ |ƒV  qd S )NrL   )rJ   Ús)rÚ   rL   rM   rN      s    z5Context.aggressive_update_packages.<locals>.<genexpr>)Zmodels.match_specrÚ   rO   Ú_aggressive_update_packages)r•   rL   )rÚ   rM   rl   ý  s    z"Context.aggressive_update_packagesc             C   s   t | ƒS )N)r‘   )r•   rL   rL   rM   r–     s    zContext.target_prefixc             C   s6   | j rtt| j ƒƒS tƒ r,tt| jddƒƒS | jS d S )Nz..)Ú_root_prefixr	   r   r³   r   Úconda_prefix)r•   rL   rL   rM   rQ     s
    zContext.root_prefixc             C   s
   t tjƒS )N)r	   rW   r‰   )r•   rL   rL   rM   rÞ     s    zContext.conda_prefixc             C   s&   t rdnd}t rdnd}t| j||ƒS )NÚScriptsÚbinz	conda.exeÚconda)r2   r   rÞ   )r•   Úbin_dirÚexerL   rL   rM   Ú	conda_exe  s    zContext.conda_exec             C   sŒ   t jrHtdtjfdtj t¡d 	tj
tj dd¡¡ fdddtjfgƒS trPdnd	}tr\d
nd}tdtj tj||¡fdddtjfgƒS dS )zo
        An OrderedDict so the vars can refer to each other if necessary.
        None means unset it.
        Z	CONDA_EXEZ
PYTHONPATHz{}{}ro   )Ú_CE_Mz-m)Ú	_CE_CONDArá   ZCONDA_PYTHON_EXErß   rà   z	conda.exerá   )rå   ro   )ræ   ro   N)r’   Údevr   rW   Ú
executabler   rÉ   ÚdirnamerA   ÚformatÚpathsepr   r¤   r2   r   r‰   )r•   râ   rã   rL   rL   rM   Úconda_exe_vars_dict  s    
zContext.conda_exe_vars_dictc             C   s.   ddl m} t| jƒ\}}}}|||||dS )Nr#   )ÚChannel)ÚschemeÚauthÚlocationÚtoken)Úmodels.channelrí   r?   Ú_channel_alias)r•   rí   rð   rî   rï   rñ   rL   rL   rM   rv   4  s    zContext.channel_aliasc                s.   ddl m‰  t‡ fdd„dd„ | jD ƒD ƒƒS )Nr#   )rí   c             3   s&   | ]\}}}}ˆ ||||d V  qdS ))rî   rï   rð   rñ   NrL   )rJ   rð   rî   rï   rñ   )rí   rL   rM   rN   =  s   z3Context.migrated_channel_aliases.<locals>.<genexpr>c             s   s   | ]}t |ƒV  qd S )N)r?   )rJ   ÚcrL   rL   rM   rN   ?  s    )rò   rí   rO   Ú_migrated_channel_aliases)r•   rL   )rí   rM   r}   :  s    z Context.migrated_channel_aliasesc             C   s    | j  d¡d k	p| j  d¡d k	S )Nr‰   r‹   )Ú_argparse_argsr¤   )r•   rL   rL   rM   Úprefix_specifiedA  s    zContext.prefix_specifiedc             C   s
   | j t S )N)r{   r   )r•   rL   rL   rM   r|   F  s    zContext.default_channelsc                sœ   ddl m‰  tˆjƒ}ˆjr(| dd¡ tt|fdˆjffƒ}t‡ ‡fdd„t	|ƒD ƒƒ}t‡ ‡fdd„t	ˆj
ƒD ƒƒ}td	d„ ttt	||fƒƒD ƒƒ}|S )
Nr#   )rí   r   z#https://repo.anaconda.com/pkgs/freeÚlocalc             3   s.   | ]&\}}|t ‡ ‡fd d„|D ƒƒfV  qdS )c             3   s   | ]}ˆ   ˆj|¡V  qd S )N)Úmake_simple_channelrv   )rJ   Úurl)rí   r•   rL   rM   rN   [  s    z9Context.custom_multichannels.<locals>.<genexpr>.<genexpr>N)rO   )rJ   r‹   Úurls)rí   r•   rL   rM   rN   Z  s   z/Context.custom_multichannels.<locals>.<genexpr>c             3   s.   | ]&\}}|t ‡ ‡fd d„|D ƒƒfV  qdS )c             3   s   | ]}ˆ   ˆj|¡V  qd S )N)rù   rv   )rJ   rú   )rí   r•   rL   rM   rN   `  s    z9Context.custom_multichannels.<locals>.<genexpr>.<genexpr>N)rO   )rJ   r‹   rû   )rí   r•   rL   rM   rN   _  s   c             s   s   | ]\}}||fV  qd S )NrL   )rJ   r‹   rw   rL   rL   rM   rN   d  s   )rò   rí   ÚlistÚ_default_channelsÚrestore_free_channelÚinsertr1   r   r¦   r/   Ú_custom_multichannelsr+   Úmap)r•   r|   Zreserved_multichannel_urlsZreserved_multichannelsr{   Zall_multichannelsrL   )rí   r•   rM   r{   M  s&    
zContext.custom_multichannelsc                sd   ddl m‰  ‡ ‡fdd„tˆjƒD ƒ}tdd„ tˆjƒD ƒƒ}tdd„ dd„ t||ƒD ƒD ƒƒ}|S )Nr#   )rí   c             3   s"   | ]\}}ˆ   ˆj||¡V  qd S )N)rù   rv   )rJ   r‹   rú   )rí   r•   rL   rM   rN   o  s   z*Context.custom_channels.<locals>.<genexpr>c             s   s   | ]
}|V  qd S )NrL   )rJ   rx   rL   rL   rM   rN   q  s    c             s   s   | ]}|j |fV  qd S )N)r‹   )rJ   ÚxrL   rL   rM   rN   s  s    c             s   s   | ]
}|V  qd S )NrL   )rJ   ZchrL   rL   rM   rN   s  s    )	rò   rí   r/   Ú_custom_channelsr+   r0   r{   r1   r,   )r•   rz   Zchannels_from_multichannelsZall_channelsrL   )rí   r•   rM   rz   l  s    zContext.custom_channelsc             C   sî   | j r
dnd}| jr”d| jkr”| jd r”| jsHddlm} |tdƒƒ‚nL| jrbd| jkrb| jd s|ddlm} |td	ƒƒ‚nttt	|| jd ƒƒƒS | jrÚd| jkrÚt| jd p²dƒ}|rÚ|| j
krÚttt	||tfƒƒƒS ttt	|| j
ƒƒƒS )
N)rø   rL   Zoverride_channelsr#   )ÚOperationNotAllowedzH
                Overriding channels has been disabled.
                rx   )ÚCommandArgumentErrorzs
                At least one -c / --channel flag must be supplied when using --override-channels.
                )Ú	use_localrö   Úoverride_channels_enabledÚ
exceptionsr  r(   r  rO   r)   r,   Ú	_channelsr   )r•   Z	local_addr  r  Zargparse_channelsrL   rL   rM   rw   y  s&    




zContext.channelsc             C   s”   ddl m} dd l}d}| jd krtydd l}||jƒ|dƒk }W n tk
rT   Y nX | jrtd| jkrt|| jd M }t|j	dƒrŠ|j	j
 p’| jp’|S )Nr#   )ÚVersionOrderr   Fz3.18.3r~   Úlibarchive_enabled)Zmodels.versionr
  Zconda_package_handling.apiÚ_use_only_tar_bz2r„   r$   ÚImportErrorrö   ÚhasattrZapir  )r•   r
  Zconda_package_handlingr~   r„   rL   rL   rM   r~   •  s    

zContext.use_only_tar_bz2c             C   s   | j S )N)Úanaconda_upload)r•   rL   rL   rM   r‚   ª  s    zContext.binstar_uploadc             C   s   | j r
dS | jS )Nr#   )rÇ   Ú
_verbosity)r•   rL   rL   rM   r   ¯  s    zContext.verbosityc             C   sd   dt | jf g}| d| j ¡ | d| j ¡ | d| j ¡ | jd rZ| d| j ¡ d |¡S )Nzconda/%s requests/%sz%s/%sr   ú )ÚCONDA_VERSIONÚrequests_versionr›   Ú"python_implementation_name_versionÚplatform_system_releaseÚos_distribution_name_versionÚlibc_family_versionr   )r•   ÚbuilderrL   rL   rM   Ú
user_agent³  s    
zContext.user_agentc             C   sT   yddl m} W n> tk
rN   yddlm} W n tk
rH   d}Y nX Y nX |S )Nr   )r$   rµ   )Zrequestsr$   r  Zpip._vendor.requests)r•   ZREQUESTS_VERSIONrL   rL   rM   r  ½  s    zContext.requests_versionc             C   s   t  ¡ t  ¡ fS )N)r¬   Zpython_implementationZpython_version)r•   rL   rL   rM   r  È  s    z*Context.python_implementation_name_versionc             C   s   t  ¡ t  ¡ fS )N)r¬   ÚsystemÚrelease)r•   rL   rL   rM   r  Î  s    	zContext.platform_system_releasec          
   C   s´   | j d }|dkr‚ddlm}m} y|ƒ |ddf}W n6 tk
rl } ztjd|dd d	}W d d }~X Y nX |d |d
  }}n*|dkrœd}t ¡ d }nt 	¡ }t ¡ }||fS )Nr   ÚLinuxr#   )ÚidÚversionT)Zbestz%r)Úexc_info)r  rµ   r   ZDarwinZOSX)
r  Z_vendor.distror  r  Ú	ExceptionrÆ   rÇ   r¬   Zmac_verr  )r•   Zplatform_namer  r  ZdistinforÊ   Zdistribution_nameZdistribution_versionrL   rL   rM   r  Ù  s    
z$Context.os_distribution_name_versionc             C   s   t ƒ \}}||fS )N)r:   )r•   Zlibc_familyZlibc_versionrL   rL   rM   r  ñ  s    
zContext.libc_family_versionc             C   s   t ƒ }|d S )NÚflags)Ú_get_cpu_info)r•   ÚinforL   rL   rM   Ú	cpu_flagsø  s    zContext.cpu_flagsZCONDA_OVERRIDE_CUDA)Zconvert_empty_to_nonec             C   s   ddl m} |ƒ S )Nr   )Úcuda_detect)Zconda.common.cudar%  )r•   r%  rL   rL   rM   Úcuda_versionþ  s    zContext.cuda_versionc             C   s   t dƒS )N)	)zChannel Configuration)rw   rv   r|   r  Úwhitelist_channelsrz   r{   r}   Úmigrated_custom_channelsÚadd_anaconda_tokenÚallow_non_channel_urlsrþ   Úrepodata_fnsr~   ri   )zBasic Conda Configuration)rq   rs   rh   )zNetwork Configuration)	r˜   rš   Úlocal_repodata_ttlÚofflineÚproxy_serversÚremote_connect_timeout_secsÚremote_max_retriesÚremote_read_timeout_secsÚ
ssl_verify)zSolver Configuration)	rl   Úauto_update_condaÚchannel_priorityÚcreate_default_packagesÚdisallowed_packagesÚforce_reinstallÚpinned_packagesÚpip_interop_enabledÚtrack_features)z.Package Linking and Install-time Configuration)Úallow_softlinksr™   rœ   Úpath_conflictÚrollback_enabledÚsafety_checksÚextra_safety_checksÚ	shortcutsÚnon_admin_enabledÚseparate_format_cacherj   rk   )zConda-build Configuration)r£   rƒ   r  r„   )z.Output, Prompt, and Flow Control Configuration)Ú
always_yesÚauto_activate_baseÚ	changeps1Ú
env_promptÚjsonÚnotify_outdated_condaÚquietÚreport_errorsÚshow_channel_urlsr   Úunsatisfiable_hints)zCLI-only)
Údeps_modifierÚupdate_modifierÚforceÚforce_removeÚclobberÚdry_runÚdownload_onlyÚignore_pinnedÚuse_index_cacher  )zHidden and Undocumented)Úallow_cyclesÚallow_conda_downgradesÚadd_pip_as_python_dependencyrÇ   rç   Údefault_pythonÚenable_private_envsÚerror_upload_urlrÁ   rQ   Ú
sat_solverÚsolver_ignore_timestampsrt   ru   Útarget_prefix_override)r1   )r•   rL   rL   rM   Úcategory_map  s    zContext.category_mapc             C   s   | j S )N)Údescription_map)r•   rL   rL   rM   Úget_descriptionsx  s    zContext.get_descriptionsc          C   C   s  t tdƒtdƒtdƒtdƒtdƒtdƒtdƒtdƒtd	ƒtd
ƒtdƒtdƒtdƒtdƒtdƒtdƒtdƒtdƒtdƒtdƒtdƒtdƒtdƒtdƒtdƒtdƒtdƒtdƒtdƒtdƒtdƒtd ƒtd!ƒtd"ƒtd#ƒtd$ƒtd%ƒtd&ƒtd'ƒtd(ƒtd)ƒtd*ƒtd+ƒtd,ƒtd-ƒtd.ƒtd/ƒtd0ƒtd1ƒtd2ƒtd3ƒtd4ƒtd5ƒtd6ƒtd7ƒtd8ƒtd9ƒtd:ƒtd;ƒtd<ƒtd=ƒtd>ƒtd?ƒtd@ƒtdAƒdBœAƒS )CNag  
                In conjunction with the anaconda command-line client (installed with
                `conda install anaconda-client`), and following logging into an Anaconda
                Server API site using `anaconda login`, automatically apply a matching
                private token to enable access to private packages and channels.
                z‹
                A list of packages that, if installed, are always updated to the latest possible
                version.
                zq
                Warn, but do not fail, when conda detects a channel url is not a valid channel.
                a}  
                When allow_softlinks is True, conda uses hard-links when possible, and soft-links
                (symlinks) when hard-links are not possible, such as when installing on a
                different filesystem than the one that the package cache is on. When
                allow_softlinks is False, conda still uses hard-links when possible, but when it
                is not possible, conda copies files. Individual packages can override
                this setting, specifying that certain files should never be soft-linked (see the
                no_link option in the build recipe documentation).
                z’
                Register a preference that files be copied into a prefix during install rather
                than hard-linked.
                aU  
                Register a preference that files be soft-linked (symlinked) into a prefix during
                install rather than hard-linked. The link source is the 'pkgs_dir' package cache
                from where the package is being linked. WARNING: Using this option can result in
                corruption of long-lived conda environments. Package caches are *caches*, which
                means there is some churn and invalidation. With this option, the contents of
                environments can be switched out (or erased) via operations on other environments.
                z¯
                Automatically choose the 'yes' option whenever asked to proceed with a conda
                operation, such as when running `conda install`.
                zg
                Automatically upload packages built with conda build to anaconda.org.
                zj
                Automatically activate the base environment during shell initialization.
                zq
                Automatically update conda when a newer or higher priority version is detected.
                zõ
                The location where conda-build will put built packages. Same as 'croot', but
                'croot' takes precedence when both are defined. Also used in construction of the
                'local' multichannel.
                z
                When using activate, change the command prompt ($PS1) to include the
                activated environment.
                z]
                The prepended url location to associate with channel names.
                a,  
                Accepts values of 'strict', 'flexible', and 'disabled'. The default value
                is 'flexible'. With strict channel priority, packages in lower priority channels
                are not considered if a package with the same name appears in a higher
                priority channel. With flexible channel priority, the solver may reach into
                lower priority channels to fulfill dependencies, rather than raising an
                unsatisfiable error. With channel priority disabled, package version takes
                precedence, and the configured priority of channels is used only to break ties.
                In previous versions of conda, this parameter was configured as either True or
                False. True is now an alias to 'flexible'.
                z`
                The list of conda channels to include for relevant operations.
                zò
                A path to a single file containing a private key and certificate (e.g. .pem
                file). Alternately, use client_ssl_cert_key in conjuction with client_ssl_cert
                for individual files.
                zc
                Used in conjunction with client_ssl_cert for a matching key file.
                zS
                General configuration parameters for conda-build.
                ze
                Packages that are by default added to a newly created environments.
                zø
                The location where conda-build will put built packages. Same as 'bld_path', but
                'croot' takes precedence when both are defined. Also used in construction of the
                'local' multichannel.
                aQ  
                A map of key-value pairs where the key is a channel name and the value is
                a channel location. Channels defined here override the default
                'channel_alias' value. The channel name (key) is not included in the channel
                location (value).  For example, to override the location of the 'conda-forge'
                channel where the url to repodata is
                https://anaconda-repo.dev/packages/conda-forge/linux-64/repodata.json, add an
                entry 'conda-forge: https://anaconda-repo.dev/packages'.
                ah  
                A multichannel is a metachannel composed of multiple channels. The two reserved
                multichannels are 'defaults' and 'local'. The 'defaults' multichannel is
                customized using the 'default_channels' parameter. The 'local'
                multichannel is a list of file:// channel locations where conda-build stashes
                successfully-built packages.  Other multichannels can be defined with
                custom_multichannels, where the key is the multichannel name and the value is
                a list of channel names and/or channel urls.
                zm
                The list of channel names and/or urls used for the 'defaults' multichannel.
                aæ  
                Threads to use by default for parallel operations.  Default is None,
                which allows operations to choose themselves.  For more specific
                control, see the other *_threads parameters:
                    * repodata_threads - for fetching/loading repodata
                    * verify_threads - for verifying package contents in transactions
                    * execute_threads - for carrying out the unlinking and linking steps
            z†
                Package specifications to disallow installing. The default is to allow
                all packages.
                z°
                Solve an environment and ensure package caches are populated, but exit
                prior to unlinking and linking packages into the prefix
                zá
                The list of directories to search for named environments. When creating a new
                named environment, the environment will be placed in the first writable
                location.
                aY  
                Template for prompt modification based on the active environment. Currently
                supported template variables are '{prefix}', '{name}', and '{default_env}'.
                '{prefix}' is the absolute path to the active environment. '{name}' is the
                basename of the active environment prefix. '{default_env}' holds the value
                of '{name}' if the active environment is a conda named environment ('-n'
                flag), or otherwise holds the value of '{prefix}'. Templating uses python's
                str.format() method.
                zé
                Threads to use when performing the unlink/link transaction.  When not set,
                defaults to 1.  This step is pretty strongly I/O limited, and you may not
                see much benefit here.
            zÊ
                Ensure that any user-requested package for the current operation is uninstalled
                and reinstalled, even if that package already exists in the environment.
                zY
                Ensure all output written to stdout is structured json.
                ax  
                For a value of False or 0, always fetch remote repodata (HTTP 304 responses
                respected). For a value of True or 1, respect the HTTP Cache-Control max-age
                header. Any other positive integer values is the number of seconds to locally
                cache repodata before checking the remote server for an update.
                z¨
                A list of previously-used channel_alias values. Useful when switching between
                different Anaconda Repository instances.
                z¡
                A map of key-value pairs where the key is a channel name and the value is
                the previous location of the channel.
                z¸
                Allows completion of conda's create, install, update, and remove operations, for
                non-privileged (non-root or non-administrator) users.
                z—
                Notify if a newer version of conda is detected during a create, install, update,
                or remove operation.
                zc
                Restrict conda to cached download content and file:// based urls.
                zY
                Permit use of the --overide-channels command-line flag.
                aj  
                The method by which conda handle's conflicting/overlapping paths during a
                create, install, or update operation. The value must be one of 'clobber',
                'warn', or 'prevent'. The '--clobber' command-line flag or clobber
                configuration parameter overrides path_conflict set to 'prevent'.
                z¾
                A list of package specs to pin for every environment resolution.
                This parameter is in BETA, and its behavior may change in a future release.
                zn
                Allow the conda solver to interact with non-conda-installed python packages.
                zú
                The list of directories where locally-available packages are linked from at
                install time. Packages not locally available are downloaded and extracted
                into the first writable directory.
                aÿ  
                A mapping to enable proxy settings. Keys can be either (1) a scheme://hostname
                form, which will match any request to the given scheme and exact hostname, or
                (2) just a scheme, which will match requests to that scheme. Values are are
                the actual proxy server, and are of the form
                'scheme://[user:password@]host[:port]'. The optional 'user:password' inclusion
                enables HTTP Basic Auth with your proxy.
                zP
                Disable progress bar display and other output.
                z˜
                The number seconds conda will wait for your client to establish a connection
                to a remote url resource.
                zd
                The maximum number of retries each HTTP connection should attempt.
                zæ
                Once conda has connected to a remote resource and sent an HTTP request, the
                read timeout is the number of seconds conda will wait for the server to send
                a response.
                z¸
                Threads to use when downloading and reading repodata.  When not set,
                defaults to None, which uses the default ThreadPoolExecutor behavior.
            zö
                Opt in, or opt out, of automatic error reporting to core maintainers. Error
                reports are anonymous, with only the error stack trace and information given
                by `conda info` being sent.
                zË"
                Add the "free" channel back into defaults, behind "main" in priority. The "free"
                channel was removed from the collection of default channels in conda 4.7.0.
            z¬
                Should any error occur during an unlink/link transaction, revert any disk
                mutations made to that point in the transaction.
                z­
                Enforce available safety guarantees during package installation.
                The value must be one of 'enabled', 'warn', or 'disabled'.
                a¬  
                Treat .tar.bz2 files as different from .conda packages when
                filenames are otherwise similar. This defaults to False, so
                that your package cache doesn't churn when rolling out the new
                package format. If you'd rather not assume that a .tar.bz2 and
                .conda from the same place represent the same content, set this
                to True.
            z»
                Spend extra time validating package contents.  Currently, runs sha256 verification
                on every file within each package during installation.
                z’
                Allow packages to create OS-specific shortcuts (e.g. in the Windows Start
                Menu) at install time.
                zc
                Show channel URLs when displaying what is going to be downloaded.
                a  
                Conda verifies SSL certificates for HTTPS requests, just like a web
                browser. By default, SSL verification is enabled, and conda operations will
                fail if a required url's certificate cannot be verified. Setting ssl_verify to
                False disables certification verification. The value for ssl_verify can also
                be (1) a path to a CA bundle file, or (2) a path to a directory containing
                certificates of trusted CA.
                z²
                A list of features that are tracked by default. An entry here is similar to
                adding an entry to the create_default_packages list.
                a¤  
                Specify filenames for repodata fetching. The default is ('current_repodata.json',
                'repodata.json'), which tries a subset of the full index containing only the
                latest version for each package, then falls back to repodata.json.  You may
                want to specify something else to use an alternate index that has been reduced
                somehow.
                z[
                Use cache of channel index files, even if it has expired.
                a'  
                A boolean indicating that only .tar.bz2 conda packages should be downloaded.
                This is forced to True if conda-build is installed and older than 3.18.3,
                because older versions of conda break when conda feeds it the new file format.
                zf
                Sets output log level. 0 is warn. 1 is info. 2 is debug. 3 is trace.
                z
                Threads to use when performing the transaction verification step.  When not set,
                defaults to 1.
            a²  
                The exclusive list of channels allowed to be used on the system. Use of any
                other channels will result in an error. If conda-build channels are to be
                allowed, along with the --use-local command line flag, be sure to include the
                'local' channel in the list. If the list is empty or left undefined, no
                channel exclusions will be enforced.
                z“
                A boolean to determine if conda should find conflicting packages in the case
                of a failed install.
                )Ar)  rl   r*  r;  r™   rœ   rC  r  rD  r3  r£   rE  rv   r4  rw   r˜   rš   r„   r5  rƒ   rz   r{   r|   rh   r6  rS  rq   rF  rk   r7  rG  r,  r}   r(  rA  rH  r-  r  r<  r8  r9  rs   r.  rI  r/  r0  r1  ri   rJ  rþ   r=  r>  rB  r?  r@  rK  r2  r:  r+  rU  r~   r   rj   r'  rL  )r*   r(   )r•   rL   rL   rM   r`  {  s   
zContext.description_map)NN)´Ú__name__Ú
__module__Ú__qualname__r7   rX  rW  rV  r;  r3  rD  rH  rQ  rE  rF  r8   r3   r5  r[   r.   ra   rY  rS  rZ  rÁ   rA  r9  rØ   r·   r¸   r¹   r»   r   rÜ   r    Úwarnr>  r?  r   r<  r8  r6  r=  r:  rU  rB  rÝ   r   rë   rR   rÌ   r¼   r½   Úboolr,  rc   r2  r˜   rš   r6   r.  r/  r1  r0  r)  r*  r   rV   ró   r   ZFLEXIBLEr4  r   r	  r   r  rü   r   r   rý   rõ   r(  r  rK  r  r'  rþ   r   r+  r  rœ   r™   rC  rÇ   rç   rR  r   r[  rO  rG  r-  rI  rT  rJ  r@  r  r   ZNOT_SETrM  r"   ZUPDATE_SPECSrN  r!   ZPYCOSATr\  r]  rP  r7  r^  rL  r£   r  r¢   r«   r”   rŸ   Úpropertyr¥   r¦   rƒ   r§   r„   r²   r´   r¬   rh   ri   rj   rk   rt   ru   r'   r¿   r°   rp   rP   rq   rs   rÑ   r×   rÓ   rÙ   rl   r–   rQ   rÞ   rä   rì   rv   r}   r÷   r|   r{   rz   rw   r~   r‚   r   r  r  r  r  r  r  r$  r@   r&  r_  ra  r`  Ú__classcell__rL   rL   )r—   rM   rd   {   s\  







	


	
trd   c              C   s"   t tjƒ\} }|dko t| ƒdkS )NZ_conda_rH   )Ú
path_splitrW   r‰   r
   )rÖ   Úenv_namerL   rL   rM   r³   Õ  s    r³   c             C   s2   t  | |¡ t j dd ¡ ddlm} | ¡  t S )Nr¨   r#   )rí   )r’   r”   Ú__dict__Úpoprò   rí   Z_reset_state)rŒ   r   rí   rL   rL   rM   Úreset_contextÛ  s
    rm  c               @   s0   e Zd Zedfdd„Zedfdd„Zdd„ ZdS )ÚContextStackObjectNc             C   s   |   ||¡ d S )N)Ú	set_value)r•   rŒ   r   rL   rL   rM   r”   ç  s    zContextStackObject.__init__c             C   s   || _ || _d S )N)rŒ   r   )r•   rŒ   r   rL   rL   rM   ro  ê  s    zContextStackObject.set_valuec             C   s   t | j| jƒ d S )N)rm  rŒ   r   )r•   rL   rL   rM   Úapplyî  s    zContextStackObject.apply)rb  rc  rd  r   r”   ro  rp  rL   rL   rL   rM   rn  å  s   rn  c               @   s4   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ ZdS )ÚContextStackc             C   s*   dd„ t dƒD ƒ| _d| _d | _d | _d S )Nc             S   s   g | ]
}t ƒ ‘qS rL   )rn  )rJ   Ú_rL   rL   rM   ú
<listcomp>õ  s    z)ContextStack.__init__.<locals>.<listcomp>r\   r   )ÚrangeÚ_stackÚ
_stack_idxÚ_last_search_pathÚ_last_argparse_args)r•   rL   rL   rM   r”   ô  s    zContextStack.__init__c             C   s\   |  j d7  _ t| jƒ}| j |kr<| j dd„ t|ƒD ƒ¡ | j| j   ||¡ |  ¡  d S )Nr   c             S   s   g | ]
}t ƒ ‘qS rL   )rn  )rJ   rr  rL   rL   rM   rs  þ  s    z%ContextStack.push.<locals>.<listcomp>)rv  r^   ru  Úextendrt  ro  rp  )r•   rŒ   r   Zold_lenrL   rL   rM   Úpushú  s    

zContextStack.pushc             C   s\   | j | j| j jks(| j| j| j jkrX| j| j  ¡  | j| j j| _ | j| j j| _d S )N)rw  ru  rv  rŒ   rx  r   rp  )r•   rL   rL   rM   rp    s
    zContextStack.applyc             C   s"   |  j d8  _ | j| j   ¡  d S )Nr   )rv  ru  rp  )r•   rL   rL   rM   rl  
  s    zContextStack.popc             C   s(   | j | j  ||¡ | j | j  ¡  d S )N)ru  rv  ro  rp  )r•   rŒ   r   rL   rL   rM   Úreplace  s    zContextStack.replaceN)rb  rc  rd  r”   rz  rp  rl  r{  rL   rL   rL   rM   rq  ò  s
   rq  c             C   s   | rt  ||¡ nt  ¡  d S )N)Úcontext_stackrz  rl  )ÚpushingrŒ   r   rL   rL   rM   Ústack_context  s    r~  c             C   s   t | d|dS )NrL   )rŒ   r   )r~  )r}  r   rL   rL   rM   Ústack_context_default"  s    r  c             C   s   t  ||¡S )N)r|  r{  )r}  rŒ   r   rL   rL   rM   Úreplace_context&  s    r€  c             C   s   t jd|dS )NrL   )rŒ   r   )r|  r{  )r}  r   rL   rL   rM   Úreplace_context_default+  s    r  c              C   s   ddl m}  t| ƒ ƒS )Nr#   )Úget_cpu_info)Z_vendor.cpuinfor‚  r*   )r‚  rL   rL   rM   r"  7  s    r"  c             C   sF   | sd S t | tjƒrtS t| ƒ\}}xtjD ]}t ||ƒr,|S q,W | S )N)r<   r’   rQ   r   ri  rq   )r‰   Zmaybe_envs_dirZ
maybe_namerÖ   rL   rL   rM   rj  >  s    
rj  c             C   sr   | st ‚| tdfkrtjS |dkr(tj}x0|D ](}t|ƒs<q.t|| ƒ}t|ƒr.t|ƒS q.W ddlm	} || ƒ‚dS )zsFind the location of a prefix given a conda env name.  If the location does not exist, an
    error is raised.
    rÒ   Nr#   )ÚEnvironmentNameNotFound)
ÚAssertionErrorr   r’   rQ   rq   r   r   r	   r  rƒ  )r‹   rq   rÖ   r‰   rƒ  rL   rL   rM   Úlocate_prefix_by_nameK  s    

r…  c       	         s`  |p| j }y
|j‰ W n tk
r,   d‰ Y nX y
|j}W n tk
rP   d}Y nX ˆ dk	rvˆ  ¡ svddlm} |dƒ‚|dk	rš| ¡ sšddlm} |dƒ‚ˆ dkr°|dkr°| jS |dk	rÀt|ƒS d}t	‡ fdd„|D ƒƒrdd	lm
} d
ˆ  d g}| d |¡¡ |d |¡ƒ‚ˆ tdfkr(| jS ddlm} ytˆ ƒS  |k
rZ   ttƒ ˆ ƒS X dS )a   Get the prefix to operate in.  The prefix may not yet exist.

    Args:
        ctx: the context of conda
        args: the argparse args from the command line

    Returns: the prefix
    Raises: CondaEnvironmentNotFoundError if the prefix is invalid
    Nr#   )ÚArgumentErrorz!Argument --name requires a value.z#Argument --prefix requires a value.)ú/r  ú:ú#c             3   s   | ]}|ˆ kV  qd S )NrL   )rJ   rr  )Úprefix_namerL   rM   rN   ‚  s    z*determine_target_prefix.<locals>.<genexpr>)ÚCondaValueErrorzInvalid environment name: 'ú'z  Characters not allowed: {}Ú
rÒ   )rƒ  )rö   r‹   r©   r‰   Ústripr  r†  r×   r;   Úanyr‹  r›   rê   r   r   rQ   rƒ  r…  Ú_first_writable_envs_dir)	ÚctxÚargsr   Zprefix_pathr†  Zdisallowed_charsr‹  r  rƒ  rL   )rŠ  rM   r‘   _  s@    




r‘   c           
   C   sž   x‚t jD ]x} | tjkrqt| dƒ}t|ƒrdyt|dƒ ¡  | S  tt	fk
r`   t
 d| ¡ Y q€X qddlm} || ƒ}|r| S qW ddlm} |t jƒ‚d S )Nz.conda_envs_dir_testÚaz#Tried envs_dir but not writable: %sr#   )Úcreate_envs_directory)ÚNoWritableEnvsDirError)r’   rq   r   Údevnullr   r   rÃ   rÈ   rÄ   rÅ   rÆ   ZtracerÐ   r”  r  r•  )rÖ   Zenvs_dir_magic_filer”  Zwas_createdr•  rL   rL   rM   r  ‘  s     

r  Tc             C   s   t | pt|ƒS )N)r‘   r’   )r‘  r’  ÚsearchrL   rL   rM   Ú
get_prefix¯  s    r˜  rL   )Úfile)N)NN)N)N)T)Z
__future__r   r   r   r   Úcollectionsr   Úerrnor   Zloggingr   r   Úos.pathr	   r
   r   r   r   r   r   ri  r¬   rW   Z	constantsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   ro   r$   r  Z_vendor.appdirsr%   Z_vendor.auxlib.decoratorsr&   r'   Z_vendor.auxlib.ishr(   Z_vendor.boltons.setutilsr)   Z_vendor.frozendictr*   Z_vendor.toolzr+   r,   r-   Zcommon.compatr.   r/   r0   r1   r2   r3   Zcommon.configurationr4   r5   r6   r7   r8   r9   Zcommon._os.linuxr:   Zcommon.pathr;   r<   Z
common.urlr=   r>   r?   Zcommon.decoratorsr@   rA   ÚgetcwdrÄ   rÅ   rÊ   Úchdirr‰   rb  rÆ   r¶   r®   r¯   Zuser_rc_pathZsys_rc_pathrT   rV   r[   ra   rc   rd   r³   rm  Úobjectrn  rq  r|  r~  r  r€  r  Zconda_tests_ctxt_mgmt_def_polr"  rj  r…  r‘   r  r˜  r’   ÚprintÚreprÚstderrÚexitrL   rL   rL   rM   Ú<module>   sš   $P  	        b
!




2
