
    <Bh9                    N   S r SSKrSSKrSSKrSSKrSSKrSSKJr  SSKJ	r	  SSK
J
r
  SSKJr  SSKJr  SSKJrJrJrJrJrJrJrJr  SS	KJr  SS
KJr  SSKJr  SSKJrJ r   SSKJ!r"  SSK#J$r$J%r%J&r&J'r'J(r(  SSK)J*r*  SSK+J,r,  SSK-J.r.  SSK/J0r0J1r1J2r2J3r3J4r4J5r5  SSK6J7r7J8r8J9r9J:r:J;r;  SSK<J=r=  SSK>J?r?J@r@  SSKAJBrB  SSKCJDrD  SSKEJFrF  SSKGJHrH  SSKIJJrJ  SSKKJLrL  \4(       a  SSKMrMSSKNJOrOJPrP  SSKQJRrR  \" \S5      rTS rUS!rV " S" S#5      rW\S$   rXS% rY SbS& jrZScS' jr[S( r\S) r]SbS* jr^S+ r_ SbS, jr`SbS- jraS. rbS/ rcS0 rdS1 reSdS2 jrfS3 rgS4 rhS5 riS6 rjS7 rkS8 rlS9 rmS: rnS; roS< rpS= rqS> rrS? rsS@ rtSA ruSB rvSC rwSD rxSE rySF rzSG r{SH r|SI r}  SeSJ\X4SK jjr~SL rSM r  SeSJ\X4SN jjrSO rSP r  SeSJ\X4SQ jjr  SeSJ\X4SR jjrSS rST rSbSU jrSbSV jrSW rSX rSY r  SeSJ\X4SZ jjrS[ rS\ rS] rS^ rS_ rS` r\SSa:X  a(  \4(       a  \GR(                  S   r\e" \5        g\d" 5         gg)fa  Backend logic for `conda init`.

Sections in this module are

  1. top-level functions
  2. plan creators
  3. plan runners
  4. individual operations
  5. helper functions

The top-level functions compose and execute full plans.

A plan is created by composing various individual operations.  The plan data structure is a
list of dicts, where each dict represents an individual operation.  The dict contains two
keys--`function` and `kwargs`--where function is the name of the individual operation function
within this module.

Each individual operation must

  a) return a `Result` (i.e. NEEDS_SUDO, MODIFIED, or NO_CHANGE)
  b) have no side effects if context.dry_run is True
  c) be verbose and descriptive about the changes being made or proposed is context.verbose

The plan runner functions take the plan (list of dicts) as an argument, and then coordinate the
execution of each individual operation.  The docstring for `run_plan_elevated()` has details on
how that strategy is implemented.

    N)unified_diff)ENOENT)glob)chain)	getLogger)abspathbasenamedirnameexists
expanduserisdirisfilejoin)Path)randint)Literal   )CONDA_PACKAGE_ROOT
CondaError)__version__)CshActivatorFishActivatorPosixActivatorPowerShellActivatorXonshActivator)Utf8NamedTemporaryFile)dals)context)ensure_binaryensure_text_typeensure_utf8_encodingon_macon_win	open_utf8)BIN_DIRECTORYexpandget_python_short_path#get_python_site_packages_short_pathwin_path_ok)CondaValueError)copymkdir_p)rm_rf)lexists)make_executable)compute_sum)subprocess_call   ) generate_shebang_for_entry_point)FOLDERIDget_folder_path)create_shortcutzV^# >>> conda initialize >>>(?:\n|\r\n)([\s\S]*?)# <<< conda initialize <<<(?:\n|\r\n)?zD^#region conda initialize(?:\n|\r\n)([\s\S]*?)#endregion(?:\n|\r\n)?c                        \ rS rSrSrSrSrSrg)Resulti   z
needs sudomodifiedz	no change N)__name__
__module____qualname____firstlineno__
NEEDS_SUDOMODIFIED	NO_CHANGE__static_attributes__r;       5lib/python3.13/site-packages/conda/core/initialize.pyr8   r8   i   s    JHIrD   r8   )
initializeadd_condabin_to_pathc                     [        U 5      n[        U5        [        R                  (       d  [	        S U5       5      (       a   e[        U5        g)Nc              3   L   #    U  H  oS    [         R                  :H  v   M     g7fresultNr8   r@   .0steps     rE   	<genexpr>install.<locals>.<genexpr>z   s     LttH~):)::t   "$r   )make_install_planrun_planr   dry_runanyprint_plan_results)conda_prefixplans     rE   installrZ   v   s<    \*DTN??LtLLLLLtrD   c           	         / n[         R                  " S5      S:X  a6  [        U 5      n[        U5        [        R
                  (       d  [        U5        [        XX#XES9n[        U5        [        R
                  (       d  [        U5        Xg-   n[        U5        [        S U5       5      (       a  [        S[        R                  S9  gg )NCONDA_PIP_UNINITIALIZEDtruereversec              3   L   #    U  H  oS    [         R                  :H  v   M     g7frJ   rL   rM   s     rE   rP   initialize.<locals>.<genexpr>        
@44>V...4rR   Operation failed.filer2   )osgetenvrS   rT   r   rU   run_plan_elevatedmake_initialize_planrW   rV   printsysstderr)	rX   shellsfor_user
for_systemanaconda_promptr_   plan1plan2rY   s	            rE   rF   rF      s     E	yy*+v5!,/e$ hOE UO??% =Dt

@4
@@@!

3 ArD   c           	      V   [        U=(       d    [        R                  5      n[        U=(       d    [        R                  " 5       5      n[        U5      u  pEn[        [        USS5      5      (       d  [        SU 35      e[        U5      nUR                  [        R                  SU0S.5        UR                  [        R                  [        US5      US.S.5        UR                  [        R                  [        US5      US.S.5        UR                  [        R                  S[        US	5      0S.5        [!        U5        ["        R$                  (       d  ["        R&                  (       a  [)        U[        R*                  5        [-        S
 U5       5      (       a  [/        S5      e[1        SS5      US   [2        (       a  SOSS.nSn	U S:X  a%  [5        SR                  [7        X8U	5      5      5        gU S:X  a  [9        X8U	5      n
["        R$                  (       d5  [;        SS5       nUR=                  SR                  U
5      5        S S S 5        ["        R&                  (       a  [5        SR                  U
5      5        [5        S5        g[?        5       e! , (       d  f       NS= f)Ncondaz__main__.pyz&Directory is not a conda source root: target_pathfunctionkwargsconda.egg-link)ru   conda_source_rootzeasy-install.pthzconda.egg-infoc              3   L   #    U  H  oS    [         R                  :H  v   M     g7frJ   rL   rM   s     rE   rP   !initialize_dev.<locals>.<genexpr>   rb   rR   zGOperation failed. Privileged install disallowed for 'conda init --dev'.r   l        winunix)PYTHONHASHSEEDPYTHON_MAJOR_VERSIONTEST_PLATFORM)
CONDA_DEFAULT_ENV	CONDA_EXE_CE_M	_CE_CONDACONDA_PREFIXCONDA_PREFIX_1CONDA_PREFIX_2CONDA_PYTHON_EXECONDA_PROMPT_MODIFIERCONDA_SHLVLbash
cmd.exezdev-init.batwznow run  > .\dev-init.bat) r&   rk   prefixrf   getcwd_get_python_infor   r   r*   rS   appendremove_conda_in_sp_dirr<   make_conda_egg_linkmodify_easy_install_pthmake_dev_egg_info_filerT   r   rU   verboserW   rl   rV   r   r   r#   rj   _initialize_dev_bash_initialize_dev_cmdexer$   writeNotImplementedError)shelldev_env_prefixrz   r   
python_exepython_versionsite_packages_dirrY   env_varsunset_env_varsscriptfhs               rE   initialize_devr      s@    N0cjj1F0?BIIK@4DV4L1J 1$('=ABB45F4GH
 	
 V$DKK.770	
 	KK+44#$57GH%6	
 	KK/88#$57IJ%6	
 	KK.77t$57GH	
 TN'//4,

@4
@@@U
 	

 "!Z0 .q 1"(&fH
N dii,V~NOP  
)	'.I>3/26*+ 0??$))F#$*+  "## 0/s   ,!J
J(c              #   "  #    [        [        R                  5      n[        (       a  SU S3nS U5        S h  vN   S [	        UR                  5       5      5        S h  vN   SU S3v   [        R                  (       a	  SU  S3v   g g  NR N-7f)	Nz$(cygpath 'z')c              3   ,   #    U  H
  nS U 3v   M     g7f)zunset Nr;   rN   envvars     rE   rP   '_initialize_dev_bash.<locals>.<genexpr>   s     ?f&!s   c              3   8   #    U  H  u  pS U SU S3v   M     g7f)zexport z=''Nr;   rN   r   values      rE   rP   r      s%      :R'&E7!$:R   z	eval "$("z" -m conda shell.bash hook)"zconda activate 'r   )r   rk   
executabler#   sorteditemsr   auto_activate)r   r   r   sys_executables       rE   r   r      s     S^^,Nv&~&6b9 @???:@AQ:R  
 n%%A
BB  **  @s!   6BB&BB ,BBc              #   L  #    Sn[         R                  (       a  Sn[        U S5      nSv   S U5        S h  vN   S [        UR	                  5       5      5        S h  vN   SUS-   S	U 3v   S
v   [         R
                  (       a  SUS-   SU SU  S3v   S
v   g g  Nh NC7f)N z--devcondabinzo@IF NOT "%CONDA_PROMPT_MODIFIER%" == "" @CALL SET "PROMPT=%%PROMPT:%CONDA_PROMPT_MODIFIER%=%_empty_not_set_%%%"c              3   .   #    U  H  nS U S3v   M     g7f)z@SET =Nr;   r   s     rE   rP   )_initialize_dev_cmdexe.<locals>.<genexpr>  s     ?f%xq!s   c              3   8   #    U  H  u  pS U SU S3v   M     g7f)z@SET "r   "Nr;   r   s      rE   rP   r     s%      8P}v&%"8Pr   z@CALL "conda_hook.batz" z,@IF %ERRORLEVEL% NEQ 0 @EXIT /B %ERRORLEVEL%	conda.batz" activate z "r   )r   devr   r   r   r   )r   r   r   dev_argr   s        rE   r   r     s     G{{FJ'H	R @???8>x~~?O8P  
 H//07)
<<
88 ;./{7)2fXQOO<<  @s"   5B$B &B$B"AB$"B$c                     [        XX#US9n[        U5        [        R                  (       d  [	        U5        [        U5        [        S U5       5      (       a  [        S[        R                  S9  gg )Nr^   c              3   L   #    U  H  oS    [         R                  :H  v   M     g7frJ   rL   rM   s     rE   rP   'add_condabin_to_path.<locals>.<genexpr>-  rb   rR   rc   rd   r2   )
make_condabin_planrT   r   rU   rh   rW   rV   rj   rk   rl   )rX   rm   rn   ro   r_   rY   s         rE   rG   rG   #  s\    hGD TN??$t

@4
@@@!

3 ArD   c           
      p	    [        U 5      u  pn/ n[        (       a{  [        U SS5      n[        U SS5      nUR	                  [
        R                  [        U SS5      U S.S.5        UR	                  [
        R                  [        U SS5      U S.S.5        OLUR	                  [        R                  [        U S	S
5      U SSS.S.5        [        U SS
5      n[        U SS5      nUR	                  [        R                  UU SSS.S.5        UR	                  [        R                  UU SSS.S.5        [        (       Ga  UR	                  [        R                  [        U S	S5      U S.S.5        UR	                  [        R                  [        U SSS5      U S.S.5        UR	                  [        R                  [        U S	S5      U S.S.5        UR	                  [        R                  [        U S	S5      U S.S.5        UR	                  [        R                  [        U S	S5      U S.S.5        UR	                  [        R                  [        U S	S5      U S.S.5        UR	                  [        R                  [        U SS5      U S.S.5        UR	                  [        R                  [        U S	S5      U S.S.5        UR	                  [         R                  [        U S	S5      U S.S.5        UR	                  ["        R                  [        U [$        S5      U S.S.5        UR	                  [&        R                  [        U [$        S5      U S.S.5        UR	                  [(        R                  [        U SSS5      U S.S.5        UR	                  [*        R                  [        U SSSS 5      U S.S.5        UR	                  [,        R                  [        U S!S	S"5      U S.S.5        UR	                  [.        R                  [        U S!S	S#5      U S.S.5        U(       a1  UR	                  [0        R                  [        US$S%5      U S.S.5        O[3        S&U  3[4        R6                  S'9  UR	                  [8        R                  [        U SSS(5      U S.S.5        U$ ! [         a	    Su  pn GNf = f))N)NNNScriptszconda-script.pyzconda-env-script.py	conda.exe)ru   rX   rv   zconda-env.exer   rt   	conda.climain)ru   rX   modulefuncbinz	conda-envzconda_env.cli.mainr   Library_conda_activate.batrename_tmp.batconda_auto_activate.batr   activate.batdeactivate.batactivate
deactivateetcz	profile.dzconda.shfishzconf.dz
conda.fishr   
Conda.psm1zconda-hook.ps1xontribz	conda.xshzNWARNING: Cannot install xonsh wrapper without a python interpreter in prefix: rd   z	conda.csh)r   OSErrorr#   r   r   make_entry_point_exer<   make_entry_pointinstall_condabin_conda_batinstall_library_bin_conda_bat#install_condabin_conda_activate_batinstall_condabin_rename_tmp_bat(install_condabin_conda_auto_activate_batinstall_condabin_hook_batinstall_Scripts_activate_batinstall_activate_batinstall_deactivate_batinstall_activater%   install_deactivateinstall_conda_shinstall_conda_fishinstall_conda_psm1install_conda_hook_ps1install_conda_xshrj   rk   rl   install_conda_csh)rX   r   r   r   rY   conda_exe_pathconda_env_exe_paths          rE   rS   rS   7  s   I8H8V5
$5 D
 vlI7HI!,	;PQ099#'i#M$0	
 	099#'i#Q$0	
 	,55#'j'#J$0)"	
	
 lE7;!,{CKK(11- ,%		

 	KK(111 ,.		
  v6??#'j+#N$0	
 	9BB#'i#T$0	
 	?HH#'$j2G$ %1	
	
 	;DD#'jBR#S$0	
 	DMM#'$j2K$ %1	
	
 	5>>#'jBR#S$0	
 	8AA#'i#P$0	
 	099#'j.#Q$0	
 	2;;#'jBR#S$0	
 	KK(11#L-L ,	
 	KK*33#L-N ,	
 	KK(11#L%jQ ,	
 	KK*33# %<  !-		

 	KK*33#L':|T ,	
 	KK.77# ':7G  !-		

 -66#'(99k#R$0	
 	\n	

 	KK)22#L%kR ,	
 Kg  I8H5
$5Is   R" "R54R5c                 `  ^ [        U 5      n[        U5      nUSS1-  (       Ga  SU;   a[  U(       aT  [        [        S[        (       d  [
        (       a  SOS5      5      nUR                  [        R                  UU SUS.S.5        SU;   am  U(       af  S[        R                  ;   a  [        [        S	S
5      5      nO[        [        SS
5      5      nUR                  [        R                  UU SUS.S.5        U(       a&  UR                  [        R                  SU US.S.5        SU;   a  U(       a=  [        [        SSSS5      5      n	UR                  [        R                  U	U US.S.5        U(       a=  [        [        SSSS5      5      n	UR                  [        R                  U	U US.S.5        SU;   a  U(       a;  [        [        SS5      5      n
UR                  [        R                  U
U US.S.5        U(       aJ  [
        (       a  [        [        SSS5      5      n
OSn
UR                  [        R                  U
U US.S.5        SU;   aC  U(       a<  [        [        SS5      5      nUR                  [        R                  UU SUS.S.5        SU;   a_  U(       a  SmU(       a  SmU4S jn[        U" SSS5      5      nU H.  nUc  M  UR                  [        R                  UU US.S.5        M0     SU;   Ga,  U(       a&  UR                  [        R                  SU US.S.5        U(       aJ  UR                  [        R                  SU US.S.5        UR                  [         R                  S S!0S.5        U(       a  UR                  ["        R                  [        U S"S#5      U US.S.5        [
        (       a&  [%        [&        R(                  5      u  nnU(       a   eO[        [+        S5      S$5      nUR                  ["        R                  [        US#5      U US.S.5        U$ )%a  
Creates a plan for initializing conda in shells.

Bash:
On Linux, when opening the terminal, .bashrc is sourced (because it is an interactive shell).
On macOS on the other hand, the .bash_profile gets sourced by default when executing it in
Terminal.app. Some other programs do the same on macOS so that's why we're initializing conda
in .bash_profile.
On Windows, there are multiple ways to open bash depending on how it was installed. Git Bash,
Cygwin, and MSYS2 all use .bash_profile by default.

PowerShell:
There's several places PowerShell can store its path, depending on if it's Windows PowerShell,
PowerShell Core on Windows, or PowerShell Core on macOS/Linux. The easiest way to resolve it
is to just ask different possible installations of PowerShell where their profiles are.
r   zsh~.bash_profile.bashrc)ru   rX   r   r_   rv   ZDOTDIR$ZDOTDIR.zshrc/etc/profile.d/conda.shru   rX   r_   r   .configconfig.fishxonsh.xonshrc%ALLUSERSPROFILE%xonshrc/etc/xonshrctcsh.tcshrc
powershell$PROFILE.CurrentUserAllHosts$PROFILE.AllUsersAllHostsc               7      >#    U  H-  n [        USST45      R                  R                  5       v   M/     g ! [         a     M?  f = f7fNz
-NoProfilez-Commandr1   stdoutstrip	Exception	exe_namesexe_nameprofiles     rE   find_powershell_paths3make_initialize_plan.<locals>.find_powershell_paths  L     %)!<WEfUUW% &
 ! %   A	)8A	
AA	AA	pwshpwsh-previewr   z>HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRunz?HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRunru   OHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabledr   Anaconda Prompt.lnkDesktop)rS   setr&   r   r"   r#   r   init_sh_userr<   rf   environinit_sh_systeminit_fish_userinit_xonsh_userinit_powershell_userinit_cmd_exe_registryinit_long_pathinstall_anaconda_promptr5   r4   r  r   )rX   rm   rn   ro   rp   r_   rY   bashrc_path
zshrc_pathconfig_fish_pathconfig_xonsh_pathtcshrc_pathr  config_powershell_pathsconfig_pathdesktop_dir	exceptionr  s                    @rE   ri   ri   0  s&   & \*D[FV Sff/YOK KK , 5 5'2(4!'#*	
 F?xBJJ&#DX$>?
#Dh$78
KK , 5 5'1(4!&#*	
 KK . 7 7'@(4#*	 %d3	6=&QRKK . 7 7'7(4#*	 %d3	6=&QRKK . 7 7'7(4#*	 & &tC'< =KK / 8 8'8(4#*	 v$*,gyA%! %3!KK / 8 8'8(4#*	 HT#y12(11#.$0#&	
	
 v4G1G	 #&!,G#
 3K&$8$A$A+6,8'.#	 3 FKK 5 > >(5(4#*	
 KK 5 > >(5(4#*	
 KK . 7 7% (7 KK 7 @ @'+(*6K( )5#*	 v)89I9I)J&Y$$}9":c?I>KK 7 @ @'+K9N'O(4#*	 KrD   c           	        ^ / n[        U5      nUSS1-  (       Ga  SU;   a\  U(       aU  [        [        S[        (       d  [        (       a  SOS5      5      nUR                  [        R                  UU SUSS.S.5        SU;   an  U(       ag  S	[        R                  ;   a  [        [        S
S5      5      nO[        [        SS5      5      nUR                  [        R                  UU SUSS.S.5        U(       a'  UR                  [        R                  SU USS.S.5        SU;   a  U(       a>  [        [        SSSS5      5      nUR                  [        R                  UU USS.S.5        U(       a>  [        [        SSSS5      5      nUR                  [        R                  UU USS.S.5        SU;   a  U(       a<  [        [        SS5      5      n	UR                  [        R                  U	U USS.S.5        U(       aK  [        (       a  [        [        SSS5      5      n	OSn	UR                  [        R                  U	U USS.S.5        SU;   aD  U(       a=  [        [        SS5      5      n
UR                  [        R                  U
U SUSS.S.5        SU;   a`  U(       a  SmU(       a  SmU4S jn[        U" SSS5      5      nU H/  nUc  M  UR                  [        R                  UU USS.S.5        M1     SU;   a~  U(       a&  UR                  [        R                  SU US .S.5        U(       aJ  UR                  [        R                  S!U US .S.5        UR                  [        R                  S"S#0S.5        U$ )$z2
Creates a plan to add $PREFIX/condabin to $PATH.
r   r   r   r   r   rG   )ru   rX   r   r_   content_typerv   r   r   r   r   )ru   rX   r_   r-  r   r   r   r   r   r   r   r   r  r  r  r  r  c               7      >#    U  H-  n [        USST45      R                  R                  5       v   M/     g ! [         a     M?  f = f7fr  r  r  s     rE   r  1make_condabin_plan.<locals>.find_powershell_paths  r  r  r  r  r   z"HKEY_CURRENT_USER\Environment\PATHr   zTHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PATHru   r  )r  r&   r   r"   r#   r   r  r<   rf   r  r  r  r  r  add_condabin_to_path_registryr!  )rX   rm   rn   ro   r_   rY   r#  r$  r%  r&  r'  r  r(  r)  r  s                 @rE   r   r   !  s    D[FV Sff/YOK KK , 5 5'2(4!'#*(>	 F?xBJJ&#DX$>?
#Dh$78
KK , 5 5'1(4!&#*(>	 KK . 7 7'@(4#*(>	
 %d3	6=&QRKK . 7 7'7(4#*(>	
 %d3	6=&QRKK . 7 7'7(4#*(>	
 & &tC'< =KK / 8 8'8(4#*(>	
 v$*,gyA%! %3!KK / 8 8'8(4#*(>	
 HT#y12(11#.$0#&$:		
 v4G1G	 #&!,G#
 3K&$8$A$A+6,8'.,B	#
 3 FKK = F F'M(4#*	 KK = F F(=(4#*	
 KK . 7 7% (7 KrD   c           	      |   U  Hv  nUR                  SS 5      nU[        R                  [        R                  4;   a  M;   [	        5       US      " UR                  SS5      0 UR                  S0 5      D6nX1S'   Mx     g ! [
         a3  n[        R                  SUS   USS9  [        R                  n S nANAS nAff = f)	NrK   rw   argsr;   rx   z%s: %rT)exc_info)	getr8   rA   rB   globalsr   loginfor@   )rY   rO   previous_resultrK   es        rE   rT   rT     s    ((8T2v0@0@AA	'YtJ/0&"%)-(B)?F  X   	'HHXtJ/THB&&F	's   6A>>
B;)B66B;c           	      p   [        S U 5       5      (       Ga  [        (       Ga   SSKJn  Sn [	        SSSS9 nUR                  [        R                  " U SS	 S
95        UR                  nSSS5        S[        [        R                  5       S3nU" USSSU S345      u  pVUb  [        SU 3[        R                  S9  [        U5       n[        R                  " [!        UR#                  5       5      5      nSSS5        U(       a  [%        U5      (       a  ['        U5        O[        R                  " U SS S
9n	[)        S[        R                   S30 [*        R,                  " 5       U	S9n
U
R                  R/                  5       nU(       a  [        U[        R                  S9  [        R                  " U
R0                  R/                  5       5      nU SS2	 U R3                  W5        gg! , (       d  f       GN= f! , (       d  f       GN= f! U(       a  [%        U5      (       a  ['        U5        f f f = f)a  
The strategy of this function differs between unix and Windows.  Both strategies use a
subprocess call, where the subprocess is run with elevated privileges.  The executable
invoked with the subprocess is `python -m conda.core.initialize`, so see the
`if __name__ == "__main__"` at the bottom of this module.

For unix platforms, we convert the plan list to json, and then call this module with
`sudo python -m conda.core.initialize` while piping the plan json to stdin.  We collect json
from stdout for the results of the plan execution with elevated privileges.

For Windows, we create a temporary file that holds the json content of the plan.  The
subprocess reads the content of the file, modifies the content of the file with updated
execution status, and then closes the file.  This process then reads the content of that file
for the individual operation execution results, and then deletes the file.
c              3   L   #    U  H  oS    [         R                  :H  v   M     g7frJ   rL   rM   s     rE   rP   $run_plan_elevated.<locals>.<genexpr>  rb   rR   r   )run_as_adminNzw+z.jsonF)suffixdeletec                     U R                   $ N__dict__xs    rE   <lambda>#run_plan_elevated.<locals>.<lambda>   s    

rD   )ensure_asciidefaultr   z-mzconda.core.initializez'ERROR during elevated execution.
  rc: rd   c                     U R                   $ rA  rB  rD  s    rE   rF  rG  6  s    1::rD   zsudo z -m conda.core.initialize)envpathstdin)rV   r#   common._os.windowsr=  r   r   jsondumpsnamer   rk   r   rj   rl   r$   loadsr    readr.   r-   r1   rf   r   r
  r	  extend)rY   r=  	temp_pathtfr   	hinstance
error_coder   _planrM  rK   rl   s               rE   rh   rh     s     
@4
@@@69I%+DOSUHH

 u>R
 !#I P  !!8 9;
(4'>!I;a@PQ)%	 )B:,O ZZ
 y)R JJ'7	'BCE * !3!3)$ JJt%AUVE$''@AYY[	F ]]((*Ff3::.JJv}}2245EGE[ A PO$ *) !3!3)$ "49s;   H 3G++A H .G=9H +
G:5H =
HH &H5c                     [         R                  R                  5       R                  5       n [        R
                  " U 5      n[        U5        [         R                  R                  [        R                  " U5      5        g rA  )
rk   rM  rS  r
  rO  rR  rT   r	  r   rP  )rM  rY   s     rE   run_plan_from_stdinr[  F  sK    IINN""$E::eDTNJJTZZ%&rD   c           
      d   [        U 5       n[        R                  " [        UR	                  5       5      5      nS S S 5        [        W5        [        U S5       nUR                  [        [        R                  " USS95      5        S S S 5        g ! , (       d  f       N\= f! , (       d  f       g = f)Nzw+bF)rH  )	r$   rO  rR  r    rS  rT   r   r   rP  )rU  r   rY   s      rE   run_plan_from_temp_filer]  M  st    	9	zz*277956 
TN	9e	$
tzz$UCDE 
%	$ 
	 
%	$s   .B.B!
B!
B/c                     U(       d  [         R                  nU  H)  n[        UR                  S5      <S US   S   < 3US9  M+     [	        S U 5       5      nU(       a  [        SUS9  g [        SUS9  g )	NrK   14rx   ru   rd   c              3   d   #    U  H&  oR                  S 5      [        R                  :H  v   M(     g7frJ   )r4  r8   rA   rM   s     rE   rP   %print_plan_results.<locals>.<genexpr>]  s      IDD((8$7Ds   .0zK
==> For changes to take effect, close and re-open your current shell. <==
zNo action taken.)rk   r	  rj   r4  rV   )rY   streamrO   changeds       rE   rW   rW   U  sm    (+T(^M-JKRX	
 
 IDIIG[	

 	 v.rD   c                    U n[        U5      (       a%  [        U5       nUR                  5       nS S S 5        OSn[        (       a  SnO[	        U[        5       5      n[        USS9n[        S5      n	U[        S5      US:X  a  U	OSUUS.-  -  nUW:w  a  [        R                  (       a*  [        S5        [        U 5        [        [        Xg5      5        [        R                  (       dP  [        [        U5      5        [        US	5       n
U
R                  U5        S S S 5        [        (       d  [!        U5        ["        R$                  $ ["        R&                  $ ! , (       d  f       GN-= f! , (       d  f       NV= f)
Nr   T)with_usr_bin_enva  
    # Before any more imports, leave cwd out of sys.path for internal 'conda shell.*' commands.
    # see https://github.com/conda/conda/issues/6549
    if len(sys.argv) > 1 and sys.argv[1].startswith('shell.') and sys.path and sys.path[0] == '':
        # The standard first entry in sys.path is an empty string,
        # and os.path.abspath('') expands to os.getcwd().
        del sys.path[0]
    z
    # -*- coding: utf-8 -*-
    import sys
    %(extra)s
    if __name__ == '__main__':
        from %(module)s import %(func)s
        sys.exit(%(func)s())
    r   )extrar   r   r   r   )r   r$   rS  r#   r   r'   r3   r   r   r   rj   	make_diffrU   r,   r
   r   r/   r8   rA   rB   )ru   rX   r   r   conda_ep_pathr   original_ep_contentnew_ep_contentpython_pathconda_extrafdsts              rE   r   r   l  sA     Mm}%"$'') &% !v<)>)@A9$
 		K d		 !'+ 52	 N ,,??$K+)/@AGM*+=#.$

>* /6.k &%^ /.s   EE*
E'*
E8c                    U nS[         R                  " S5      -  n[        [        SSU-  5      n[	        U5      (       a*  [        US5      [        US5      :X  a  [        R                  $ [        R                  (       d8  [        [        U5      5      (       d  [        [        U5      5        [        XB5        [        R                  $ )N   Pr   z
cli-%d.exemd5)structcalcsizer   r   r   r0   r8   rB   r   rU   r   r
   r,   r+   rA   )ru   rX   exe_pathbitssource_exe_paths        rE   r   r     s    Hvs##D-wt8KLOhx';+NN###??WX&''GH%& 	_'??rD   c           
      &   [        [        SS5      n[        [        R                  S   SS5      nSSR	                  [        USS	5      [        USS
5      5      4n[
        R                  n[        R                  (       dA  [        SSSU -   SR                  U5      S[        S5      -   SU-   5        [
        R                  nU(       aJ  [        R                  R                  U5      (       a&  [        R                  " U5        [
        R                  nU$ )Nr   zconda_icon.icoHOMEPATHr  r  z/Kz""{}" && "{}""r   r   r   z%windir%\System32\cmd.exezAnconda Promptr    r   )r   r   rf   r  formatr8   rB   r   rU   r6   r   rA   rL  r   remove)ru   rX   r_   	icon_pathtargetr2  rK   s          rE   r"  r"    s     '2BCI"**Z()5JKF 	z+;<z+DE	
D F??)HHTNC N	
 77>>&!!IIf__FMrD   c                 ^   [        U 5      (       a%  [        U 5       nUR                  5       nS S S 5        OSnUnUW:w  a  [        R                  (       a*  [        S5        [        U 5        [        [        X45      5        [        R                  (       dJ  [        [        U 5      5        [        U S5       nUR                  U5        S S S 5        [        R                  $ [        R                  $ [        R                  $ ! , (       d  f       N= f! , (       d  f       [        R                  $ = f)Nr   r   r   )r   r$   rS  r   r   rj   rg  rU   r,   r
   r   r8   rA   rB   )ru   file_contentr   original_contentnew_contentrm  s         rE   _install_filer    s    k{#r!wwy $# K&&??$K+),:;GK();,

;' -v% $# -,s   C>4D>
D
D,c                 F    [        5       R                  SS9n[        X5      $ NF)r   )r   hookr  ru   rX   r  s      rE   r   r     #    !#((u(=L33rD   c                     [        [        SSS5      n[        U5       nUR                  5       nS S S 5        [	        U W5      $ ! , (       d  f       N= f)Nr   r   r   r   r   r$   rS  r  ru   rX   src_pathfsrcr  s        rE   r   r     sC    &NKH	8	yy{ 
l33 
	   A
Ac                     [        [        SSS5      n[        U5       nUR                  5       nS S S 5        [	        U W5      $ ! , (       d  f       N= f)Nr   r   r   r  r  s        rE   r   r     sC    &^LH	8	yy{ 
l33 
	r  c                     [        [        SSS5      n[        U5       nUR                  5       nS S S 5        [	        U W5      $ ! , (       d  f       N= f)Nr   r   r   r  r  s        rE   r   r     sD    &=MNH	8	yy{ 
l33 
	r  c                     [        [        SSS5      nSU S3n[        U5       nX4R                  5       -  nS S S 5        [	        X5      $ ! , (       d  f       N= f)Nr   r   r   #!/bin/sh
_CONDA_ROOT=""
r  ru   rX   r  r  r  s        rE   r   r     sR    &
CH-l^3?L	8			# 
33 
	   A


Ac                     [        [        SSS5      nSU S3n[        U5       nX4R                  5       -  nS S S 5        [	        X5      $ ! , (       d  f       N= f)Nr   r   r   r  r  r  r  s        rE   r   r     sR    &EH-l^3?L	8			# 
33 
	r  c                     [        [        SSS5      n[        U5       nUR                  5       nS S S 5        [	        U W5      $ ! , (       d  f       N= f)Nr   r   r   r  ru   rX   conda_bat_src_pathr  r  s        rE   r   r   %  sE    0':{S	%	&$yy{ 
'l33 
'	&r  c                     [        [        SSSS5      n[        U5       nUR                  5       nS S S 5        [	        U W5      $ ! , (       d  f       N= f)Nr   r   r   r   r  r  s        rE   r   r   -  sK    GY{ 
%	&$yy{ 
'l33 
'	&s   A
Ac                     [        [        SSS5      n[        U5       nUR                  5       nS S S 5        [	        U W5      $ ! , (       d  f       N= f)Nr   r   r   r  r  s        rE   r   r   7  sJ    GZ1F 
%	&$yy{ 
'l33 
'	&r  c                     [        [        SSS5      n[        U5       nUR                  5       nS S S 5        [	        U W5      $ ! , (       d  f       N= f)Nr   r   r   r  r  s        rE   r   r   A  F    0':GWX	%	&$yy{ 
'l33 
'	&r  c                     [        [        SSS5      n[        U5       nUR                  5       nS S S 5        [	        U W5      $ ! , (       d  f       N= f)Nr   r   r   r  r  s        rE   r   r   I  sJ    GZ1J 
%	&$yy{ 
'l33 
'	&r  c                     [        [        SSS5      n[        U5       nUR                  5       nS S S 5        [	        U W5      $ ! , (       d  f       N= f)Nr   r   r   r  r  s        rE   r   r   S  r  r  c                 F    [        5       R                  SS9n[        X5      $ r  )r   r  r  r  s      rE   r   r   [  s"     ?''e'<L33rD   c                     [        [        SSS5      n[        U5       nUR                  5       nS S S 5        [	        U W5      $ ! , (       d  f       N= f)Nr   r   r   r  )ru   rX   conda_psm1_pathr  r  s        rE   r   r   a  sC    -w
LQO	?	#tyy{ 
$l33 
$	#r  c                 F    [        5       R                  SS9n[        X5      $ r  )r   r  r  r  s      rE   r   r   i  s#    &(--E-BL33rD   c                 F    [        5       R                  SS9n[        X5      $ r  )r   r  r  r  s      rE   r   r   o  r  rD   c                 F    [        5       R                  SS9n[        X5      $ r  )r   r  r  r  s      rE   r   r   u  s"    >&&U&;L33rD   c                     [        U [        [        (       a  SOS5      n[        (       a  SSKJn  U" U5      n[        S5      UU S.-  nU$ )Nr   rt   r   native_path_to_unixa  
        # >>> conda initialize >>>
        # !! Contents within this block are managed by 'conda init' !!
        if test -f %(conda_exe)s
            eval %(conda_exe)s "shell.fish" "hook" $argv | source
        else
            if test -f "%(conda_prefix)s/etc/fish/conf.d/conda.fish"
                . "%(conda_prefix)s/etc/fish/conf.d/conda.fish"
            else
                set -x PATH "%(conda_prefix)s/bin" $PATH
            end
        end
        # <<< conda initialize <<<
        )	conda_exerX   )r   r%   r#   r   r  r   rX   r  r  conda_initialize_contents       rE   _config_fish_contentr  {  sR    \=+WUIv2'	2	#	   $	 & $#rD   c                 n    [        U S5      n[        (       a  SSKJn  U" U5      n[	        SU S35      nU$ )Nr   r   win_path_to_unixz
        # >>> conda initialize >>>
        # !! Contents within this block are managed by 'conda init' !!
        set -x PATH "z3" $PATH
        # <<< conda initialize <<<
        r   r#   common.pathr  r   )rX   condabin_dirr  r  s       rE   ,_config_fish_content_to_add_condabin_to_pathr    sI    j1Lv2'5# #^ $		  $#rD   r-  c                    U n [        U5       nUR                  5       nS S S 5        WnSnUS:X  a  [        U5      n	O!US:X  a  [	        U5      n	O[        SU S35      eU(       af  [        R                  " SU 3SU[        R                  S	9n[        R                  " S
[        -   SU[        R                  [        R                  -  S	9nO[        (       d5  [        R                  " S[        U5       S3SU 3U[        R                  S	9n[        R                  " SSU SU 3U[        R                  S	9n[        R                  " SSU 3U[        R                  S	9nSn
[        R                  " [        U
U[        R                  S	9nUR                  X5      nSU;  a	  USU	 S3-  nXg:w  a  [        R                  (       a*  [!        S5        [!        U 5        [!        [#        Xv5      5        [        R$                  (       dc  ['        [)        U5      5      (       d  [+        [)        U5      5        [        US5       nUR-                  U5        S S S 5        [.        R0                  $ [.        R0                  $ [.        R2                  $ ! , (       d  f       GNm= f! [         a    Sn GN  e = f! , (       d  f       [.        R0                  $ = f)Nr   ## commented out by conda initializerF   rG   Unknown content_type='.'. Use 'initialize' or 'add_condabin_to_path'.#\s(.*?)\s*\1flags^\s*z"^[ \t]*?(set -gx PATH ([\'\"]?).*?z\/bin\2 [^\n]*?\$PATH)# \1  z^^[ \t]*[^#\n]?[ \t]*((?:source|\.) .*etc\/fish\/conf\.d\/conda\.fish.*?)\n(conda activate.*?)$\n# \2  zJ^[ \t]*[^#\n]?[ \t]*((?:source|\.) .*etc\/fish\/conda\.d\/conda\.fish.*?)$__CONDA_REPLACE_ME_123__# >>> conda initialize >>>r   r   )r$   rS  FileNotFoundErrorr  r  
ValueErrorresub	MULTILINECONDA_INITIALIZE_RE_BLOCKDOTALLr#   r	   replacer   r   rj   rg  rU   r   r
   r,   r   r8   rA   rB   ru   rX   r_   r-  user_rc_pathr   
rc_contentrc_original_contentconda_init_commentr  replace_strs              rE   r  r    s    L|$J % %>|##7#E 	/	/#O$
  $\N2`a
 	
 VV-./,,	

 VV//))bll*	

 v5h|6L5M N ,-.llJ VV$()2D1EF,,

 VVY()*,,	

 1VV%,,	

  ''N
'z9B78;;J(??$K+)/<=',/00-.<-$ .vm %$ 
Z .-s9   J JJ <J,
JJ J J)'J),
K	c                     [        U [        [        (       a  SOS5      n[        (       a  SSKJn  U" U5      n[        S5      R                  US9nU$ )Nr   rt   r   r  a~  
    # >>> conda initialize >>>
    # !! Contents within this block are managed by 'conda init' !!
    if !(test -f "{conda_exe}"):
        import sys as _sys
        from types import ModuleType as _ModuleType
        _mod = _ModuleType("xontrib.conda",
                        "Autogenerated from $({conda_exe} shell.xonsh hook)")
        __xonsh__.execer.exec($("{conda_exe}" "shell.xonsh" "hook"),
                            glbs=_mod.__dict__,
                            filename="$({conda_exe} shell.xonsh hook)")
        _sys.modules["xontrib.conda"] = _mod
        del _sys, _mod, _ModuleType
    # <<< conda initialize <<<
    )r  )r   r%   r#   r   r  r   rz  r  s       rE   _config_xonsh_contentr    sP    \=+WUIv2'	2	#	   fyf!! " $#rD   c                 j    [        U S5      n[        (       a  SSKJn  U" U5      n[	        SU S35      $ )Nr   r   r  z
        # >>> conda initialize >>>
        # !! Contents within this block are managed by 'conda init' !!
        $PATH.insert(0, "z.")
        # <<< conda initialize <<<
        r  )rX   condabin_pathr  s      rE   -_config_xonsh_content_to_add_condabin_to_pathr  %  sC    z2Mv2(7 ( )		 rD   c                 r   U n [        U5       nUR                  5       nS S S 5        WnSnUS:X  a  [        U5      n	O!US:X  a  [	        U5      n	O[        SU S35      eU(       af  [        R                  " SU 3SU[        R                  S	9n[        R                  " S
[        -   SU[        R                  [        R                  -  S	9nOKSn
[        R                  " [        U
U[        R                  S	9nUR                  X5      nSU;  a	  USU	 S3-  nXg:w  a  [        R                  (       a*  [        S5        [        U 5        [        [        Xv5      5        [        R                   (       dc  [#        [%        U5      5      (       d  ['        [%        U5      5        [        US5       nUR)                  U5        S S S 5        [*        R,                  $ [*        R,                  $ [*        R.                  $ ! , (       d  f       GN= f! [         a    Sn GN  e = f! , (       d  f       [*        R,                  $ = f)Nr   r  rF   rG   r  r  r  r  r  r  r  r  r   r   )r$   rS  r  r  r  r  r  r  r  r  r  r  r   r   rj   rg  rU   r   r
   r,   r   r8   rA   rB   r  s              rE   r  r  5  s    L|$J % %>|##8#F 	/	/#P$
  $\N2`a
 	
 VV-./,,	

 VV//))bll*	

 1VV%,,	

  ''N
'z9B78;;J(??$K+)/<=',/00-.<-$ .v %$ 
l .-s9   H G3H )H3
H=H H HH
H6c                    [        U [        [        (       a  SOS5      n[        (       a!  SSKJn  U" U5      n[        S5      UUS.-  nU$ US;   a  [        S5      UU[        U5      U S	.-  nU$ [        S
5      UU[        U5      U S	.-  nU$ )Nr   rt   r   r  a  
        # >>> conda initialize >>>
        # !! Contents within this block are managed by 'conda init' !!
        if [ -f '%(conda_exe)s' ]; then
            eval "$('%(conda_exe)s' 'shell.%(shell)s' 'hook')"
        fi
        # <<< conda initialize <<<
        )r  r   cshr  a  
            # >>> conda initialize >>>
            # !! Contents within this block are managed by 'conda init' !!
            if ( -f "%(conda_prefix)s/etc/profile.d/conda.csh" ) then
                source "%(conda_prefix)s/etc/profile.d/conda.csh"
            else
                setenv PATH "%(conda_bin)s:$PATH"
            endif
            # <<< conda initialize <<<
            )r  r   	conda_binrX   ak  
            # >>> conda initialize >>>
            # !! Contents within this block are managed by 'conda init' !!
            __conda_setup="$('%(conda_exe)s' 'shell.%(shell)s' 'hook' 2> /dev/null)"
            if [ $? -eq 0 ]; then
                eval "$__conda_setup"
            else
                if [ -f "%(conda_prefix)s/etc/profile.d/conda.sh" ]; then
                    . "%(conda_prefix)s/etc/profile.d/conda.sh"
                else
                    export PATH="%(conda_bin)s:$PATH"
                fi
            fi
            unset __conda_setup
            # <<< conda initialize <<<
            )r   r%   r#   r   r  r   r
   )rX   r   r  r  r  s        rE   _bashrc_contentr    s    \=+WUIv2'	2	#'	$
 #
$
 p $#U O#'+	( '$Y/ ,	($R $#/ (,($ '$Y/ ,	#($. $#rD   c                     [        U S5      n[        (       a   SSKJn  U" U5      n[	        SU SU S35      $ US;   a  [	        SU S	U S
35      $ [	        SU S35      $ )Nr   r   r  z
            # >>> conda initialize >>>
            # !! Contents within this block are managed by 'conda init' !!
            if [ -d 'z'' ]; then
                export PATH="zJ:$PATH"
            fi
            # <<< conda initialize <<<
            r  z
            # >>> conda initialize >>>
            # !! Contents within this block are managed by 'conda init' !!
            if ( -d "z&" ) then
                setenv PATH "zM:$PATH"
            endif
            # <<< conda initialize <<<
            z
        # >>> conda initialize >>>
        # !! Contents within this block are managed by 'conda init' !!
        export PATH="z3:$PATH"
        # <<< conda initialize <<<
        r  )rX   r   r  r  s       rE   '_bashrc_content_to_add_condabin_to_pathr    s    z2Mv2(7 $_ %+_ -		
 		
  $_ %+_ -		
 		
  $_ %		 rD   c                    U n [        U5       nUR                  5       nS S S 5        WnUS:X  a  [        X5      n	O!US:X  a  [	        X5      n	O[        SU S35      eSn
U(       ag  [        R                  " SU
 3SU[        R                  S	9n[        R                  " S
[        -   SU[        R                  [        R                  -  S	9nGO4[        (       d5  [        R                  " S[        U5       S3SU
 3U[        R                  S	9n[        R                  " SSU
 SU
 3U[        R                  S	9n[        R                  " SSU
 3U[        R                  S	9n[        (       a&  [        R                  " SSU[        R                  S	9nO%[        R                  " SSU[        R                  S	9nSn[        R                  " [        UU[        R                  S	9nUR                  X5      nSU;  a	  USU	 S3-  nXx:w  a  [        R                  (       a*  [!        S5        [!        U 5        [!        [#        X5      5        [        R$                  (       d6  [        US5       nUR'                  U5        S S S 5        [(        R*                  $ [(        R*                  $ [(        R,                  $ ! , (       d  f       GN= f! [         a    Sn GN  e = f! , (       d  f       [(        R*                  $ = f)Nr   rF   rG   r  r  r  r  r  r  r  z^[ \t]*?(export PATH=[\'\"].*?z\/bin:\$PATH[\'\"])r  zY^[ \t]*[^#\n]?[ \t]*((?:source|\.) .*etc\/profile\.d\/conda\.sh.*?)\n(conda activate.*?)$r  zD^[ \t]*[^#\n]?[ \t]*((?:source|\.) .*etc\/profile\.d\/conda\.sh.*?)$zE^[ \t]*^[ \t]*[^#\n]?[ \t]*((?:source|\.) .*Scripts[/\\]activate.*?)$z)# \1  # commented out by conda initializez=^[ \t]*^[ \t]*[^#\n]?[ \t]*((?:source|\.) .*bin/activate.*?)$r  r  r   r   )r$   rS  r  r  r  r  r  r  r  r  r  r#   r	   r  r   r   rj   rg  rU   r   r8   rA   rB   )ru   rX   r   r_   r-  r  r   r  r  r  r  r  s               rE   r  r    s    L|$J % %|##2<#G 	/	/#J$
  $\N2`a
 	
 ?VV-./,,	

 VV//))bll*	

 v1(<2H1I J ,-.llJ VV$()2D1EF,,

 VVS()*,,	

 6X<ll	J P<ll	J 1VV%,,	

  ''N
'z9B78;;J(??$K+)/<=<-$ .vI %$ 
v .-s9   K J0K &K0
J?:K ?K KK
K3c                    U n[        U5      (       a%  [        U5       nUR                  5       nS S S 5        OSnU(       aG  [        U5      (       a&  [        R                  " U5        [
        R                  $  [
        R(                  $ US:X  a  [        US5      nO"US:X  a  [        US5      nO[        SU S35      eWU:w  a  [        R                  (       a*  [        S5        [        U 5        [        [        Xv5      5        [        R                  (       de  [        U5      (       a  [!        U5        [#        [%        U5      5        [        US5       nUR'                  U5        S S S 5        [
        R                  $ [
        R                  $ [
        R(                  $ ! , (       d  f       GNq= f! , (       d  f       [
        R                  $ = f)	Nr   rF   posixrG   r  r  r   r   )r   r$   rS  rf   r{  r8   rA   r  r  r  r   r   rj   rg  rU   r.   r-   r,   r
   r   rB   )ru   rX   r_   r-  conda_sh_system_pathr   conda_sh_system_contentsconda_sh_contentss           rE   r  r  Y  sz    '"##+,')wwy$ -, $& &''II*+??" (6 / <' /g F33 Gg! ( 7> >  $'88dk"i 1LM??/00./ 4563S9RHH./ :??"6??"A -,: :9??"s   FF.
F+.
Gc                    U R                  SS5      u  pUR                  SS5      u  p4[        [        U5      n [        R                  " XS[        R
                  5      n [        R                  " XT5      nUS   n[        U[        5      (       a  UR                  5       nUS   n	X4[        R                  " U5        $ ! [         a  nUR                  [        :w  a  e  S nAgS nAff = f! [         a/    [        R                  " U5         [        R                  " U5        gf = f! [        R                  " U5        f = f)N\r2   r   NN)splitrsplitgetattrwinregOpenKeyKEY_READr   errnor   QueryValueEx
isinstancestrr
  CloseKeyr  )
ru   main_keythe_rest
subkey_str
value_namekeyr9  value_tuplevalue_value
value_types
             rE   _read_windows_registryr    s    %**43H%__T15Jvx(HnnX1fooF))#:!!nk3''%++-K ^
& 	#  77f  
 	s<   &B? !AC+ ?
C(	C##C(+ D$D' #D$$D' 'D?c                    U R                  SS5      u  p4UR                  SS5      u  pV[        [        U5      n [        R                  " X5S[        R
                  5      n [        R                  " XvSX!5        [        R                  " U5        g ! [         a5  nUR                  [        :w  a  e [        R                  " X55      n S nANjS nAff = f! [        R                  " U5        f = f)Nr  r2   r   )r  r  r  r  r  	KEY_WRITEr   r  r   	CreateKey
SetValueExr  )	ru   r  r  r  r  r  r  r  r9  s	            rE   _write_windows_registryr    s    $**43H%__T15Jvx(H5nnX1f6F6FG
#1jF  577fx45 	s#   &B !C 
C+C

CC*c                 B   [        U 5      u  p4Uc  Sn[        R                  nSR                  [	        USS5      5      nSU SU 3nU(       ao  UR                  S5      nUVs/ s H  oU;  d  M
  UR                  5       PM     nnUVs/ s H  oU;  d  M
  UR                  5       PM     nnSR	                  U5      n	OS	n
[        R                  " S
U
US[        R                  [        R                  -  S9n	[        R                  " SU
U	[        R                  [        R                  -  S9n	U	R                  U
S-   U
-   U
5      nX:w  a!  Un	U	R                  U
S-   U
-   U
5      nX:w  a  M!  UR                  X5      n	Xi;  a  U	(       a	  U	SU-   -  n	OUn	X9:w  ap  [        R                  (       a*  [        S5        [        U 5        [        [        X95      5        [        R                   (       d  [#        X	U5        [$        R&                  $ [$        R(                  $ s  snf s  snf )Nr   z"{}"r   r   z	if exist ry  &z & r  zF(if exist \"[^\"]*?conda[-_]hook\.bat\" \"[^\"]*?conda[-_]hook\.bat\")r2   countr  z(\"[^\"]*?conda[-_]hook\.bat\")r  r   )r  r  REG_EXPAND_SZrz  r   r  r
  r  r  
IGNORECASEUNICODEr  r   r   rj   rg  rU   r  r8   rA   rB   )ru   rX   r_   
prev_valuer  old_hook_pathnew_hookautorun_partspart	new_valuer  new_value_2s               rE   r   r     s    4K@J
))
MM$|ZAQ"RSM=/=/:H #((-2?X-$SWCW-X &3
%2T46OLDJJL] 	 
 JJ}-	0FFU--"**,
	 FF.--"**,	
	  ''e(;k(I;W&#I#++e#k1;K &
  ''>	$UX--	$	??$K+)J23#KJG_ Y
s   "	H/H	HHc                     [        U 5      u  p4Uc  SnSn[        US5      R                  SS5      nUR                  5       nUR	                  S5      Vs/ s H  owR                  5       (       d  M  UPM     nnUVs/ s H  owR                  5       PM     n	nU(       a7  [        X5      VV
s/ s H  u  pzX:w  d  M  UPM     nnn
SR                  U5      nO(Xi;  a  UR                  SU5        SR                  U5      nX<:w  ap  [        R                  (       a*  [        S5        [        U 5        [        [        X<5      5        [        R                  (       d  [        XU5        [        R                  $ [        R                   $ s  snf s  snf s  sn
nf )	Nr   r   r   /r  ;r   r   )r  r   r  lowerr  r
  zipinsertr   r   rj   rg  rU   r  r8   rA   rB   )ru   rX   r_   r  r  r  normalized_condabin_pathr  
path_partsnormalized_path_partsnormalized_partnew_path_partsr	  s                rE   r0  r0    sV    4K@J

 z2::3EM,224 $.#3#3C#8I#84JJL$#8JI6@AjdZZ\jA *-Z)O
)O%: )O 	 

 HH^,	 $@a/HHZ(	??$K+)J23#KJG = JA
s   F /F :F)F
8F
c                 j   [         R                  S   R                  S5      u  pn[        U5      S:  a  [        U5      S:  a  [	        U 5      u  pE[        U5      S:w  a  [         R                  (       a4  [        S5        [        U 5        [        [        [        U5      S5      5        [         R                  (       d  [        U S[        R                  5        [        R                  $ [        R                  $ [         R                  (       a&  [        S5        [        S5        [        R                  $ g )Nr2   .
   i8  1r   zyNot setting long path registry key; Windows version must be at least 10 with the fall 2016 "Anniversary update" or newer.)r   os_distribution_name_versionr  intr  r  r   rj   rg  rU   r  r  	REG_DWORDr8   rA   rB   )ru   win_ver_win_revr  r  s         rE   r!  r!  )  s    !>>qAGGLG
7|rc'le3!7!D
z?c!dk"iJ56??'Q8H8HI??"###??$K? ### rD   c                 f    [        U [        [        (       a  SOS5      n[        SU SU S35      nU$ )Nr   rt   zt
    #region conda initialize
    # !! Contents within this block are managed by 'conda init' !!
    If (Test-Path "z") {
        (& "z_" "shell.powershell" "hook") | Out-String | ?{$_} | Invoke-Expression
    }
    #endregion
    )r   r%   r#   r   )rX   r  conda_powershell_modules      rE   _powershell_profile_contentr"  B  sI    \=+WUI" ; K 			 #"rD   c                 8    [        U S5      n[        SU S35      $ )Nr   z~
        #region conda initialize
        # !! Contents within this block are managed by 'conda init' !!
        $Env:Path = "zD" + [IO.Path]::PathSeparator + $Env:Path
        #endregion
        )r   r   )rX   r  s     rE   3_powershell_profile_content_to_add_condabin_to_pathr$  S  s1    j1L #^ $		 rD   c                 ^   U n[         R                  R                  U5      (       a%  [        U5       nUR	                  5       nS S S 5        OSnWnU(       a<  [
        R                  " [        SUS[
        R                  [
        R                  -  S9nOUS:X  a  [        U5      nO!US:X  a  [        U5      nO[        SU S35      eSU;  a
  US	U S	3-  nOK[
        R                  " [        S
US[
        R                  [
        R                  -  S9R                  S
U5      nXg:w  a  [        R                  (       a*  [!        S	5        [!        U 5        [!        [#        Xv5      5        [        R$                  (       dc  [        ['        U5      5      (       d  [)        ['        U5      5        [        US5       nUR+                  U5        S S S 5        [,        R.                  $ [,        R.                  $ [,        R0                  $ ! , (       d  f       GN= f! , (       d  f       [,        R.                  $ = f)Nr   r2   r  rF   rG   r  r  z#region conda initializer   r  r   )rf   rL  r   r$   rS  r  r  CONDA_INITIALIZE_PS_RE_BLOCKr  r  r"  r$  r  r  r   r   rj   rg  rU   r
   r,   r   r8   rA   rB   )	ru   rX   r_   r-  profile_pathfpprofile_contentprofile_original_contentr  s	            rE   r  r  `  s    L 
ww~~l##|$ ggiO %$ . &&())bll*
 <''B<'P$33CLQ % (6de  &_<$<#=R@@O ff,*ii",,. g02JK  2??$K+)4FG',/00-.<-) .vm %$d .-s   G=3H=
H
H,c           
         SnU n[         R                  " [        [        US5      5      [        [        US5      5      [        [        US5      5      45      nS U5       nU HR  n[	        S[        X$5       3[
        R                  S9  [        R                  (       d  [        [        X$5      5        SnMT     S	nU H]  n[        X&5      n[        U5      (       d  M   [	        SU 3[
        R                  S9  [        R                  (       d  [        U5        SnM_     U(       a  [        R                  $ [        R                  $ )
NFzconda-*infozconda.*zconda-*.eggc              3   T   #    U  H  oR                  S 5      (       a  M  Uv   M      g7f)ry   Nendswith)rN   ps     rE   rP   )remove_conda_in_sp_dir.<locals>.<genexpr>  s     Nk<L1M11ks   (	(zrm -rf rd   T)rt   	conda_env)r   from_iterabler   r   rj   rk   rl   r   rU   r-   r.   r8   rA   rB   )ru   r:   r   rm_rf_thesefnothersotherrL  s           rE   r   r     s	   H#%%'78'34'78	
K OkNK.345CJJG$(-.	 
F %-4==GD6"4??dH  rD   c                    U[         R                  -   n[        U 5      (       a&  [        U S5       nUR	                  5       nS S S 5        OSnWU:w  a  [
        R                  (       aQ  [        S[        R                  S9  [        U [        R                  S9  [        [        XB5      [        R                  S9  [
        R                  (       d?  [        U S5       nUR                  [        U5      5        S S S 5        [        R                  $ [        R                  $ [        R                   $ ! , (       d  f       N= f! , (       d  f       [        R                  $ = f)Nrbr   r   rd   wb)rf   linesepr   r$   rS  r   r   rj   rk   rl   rg  rU   r   r!   r8   rA   rB   )ru   rz   conda_egg_link_contentsr   conda_egg_link_contents_olds        rE   r   r     s    /"**<k{D)R*,'')' *) ')#"&==??$SZZ(+CJJ/5OZZ ;--.EFG .v% *) .-s   D,D=,
D:=
Ec                   ^ Un[        U 5      (       a%  [        U 5       nUR                  5       nS S S 5        OSnWR                  5       nX%;   a  [        R
                  $ [        R                  S-   m[        U4S jU5       5      nU[        R                  -   [        R                  R                  U5      -   [        R                  -   n[        R                  (       aQ  [        S[        R                  S9  [        U [        R                  S9  [        [!        XF5      [        R                  S9  [        R"                  (       d?  [        U S5       nUR%                  ['        U5      5        S S S 5        [        R(                  $ [        R(                  $ ! , (       d  f       GNi= f! , (       d  f       [        R(                  $ = f)Nr   rt   c              3   V   >#    U  H  oR                  T5      (       a  M  Uv   M      g 7frA  r-  )rN   lnln_ends     rE   rP   *modify_easy_install_pth.<locals>.<genexpr>  s       'r{{6/B's   )	)r   rd   r9  )r   r$   rS  
splitlinesr8   rB   rf   septupler:  r   r   r   rj   rk   rl   rg  rU   r   r!   rA   )ru   rz   easy_install_new_liner   old_contentsold_contents_linesnew_contentsr@  s          @rE   r   r     sJ   -k{#r779L $# %0022VVgF '  	
**	
**//,
-	. **	  d$k

+i3#**E??{D)RHH),78 *??6??7 $#2 *)??s   FF'
F$'
Gc                    [        U 5      (       a%  [        U 5       nUR                  5       nS S S 5        OSn[        S5      [        -  nWU:X  a  [
        R                  $ [        R                  (       aQ  [        S[        R                  S9  [        U [        R                  S9  [        [        X#5      [        R                  S9  [        R                  (       dQ  [        U 5      (       a  [        U 5        [        U S5       nUR!                  U5        S S S 5        [
        R"                  $ [
        R"                  $ ! , (       d  f       GN= f! , (       d  f       [
        R"                  $ = f)Nr   z
    Metadata-Version: 1.1
    Name: conda
    Version: %s
    Platform: UNKNOWN
    Summary: OS-agnostic, system-level binary package manager.
    r   rd   r   )r   r$   rS  r   CONDA_VERSIONr8   rB   r   r   rj   rk   rl   rg  rU   r.   r-   r   rA   )ru   r   rF  rH  s       rE   r   r   	  s    k{#r779L $#  		
 		  |#d$k

+i3#**E??;+{C(BHH\" )??6??= $#8 )(??s   D<E<
E
E+c                 p    SR                  [        U R                  5       UR                  5       5      5      $ )Nr   )r   r   rB  )oldnews     rE   rg  rg  .	  s&    99\#.."2CNN4DEFFrD   c                 r   [        U [        5       5      n[        U S35      nUR                  R	                  5       UR
                  R	                  5       pCU(       a  UR                  5       S   nO&U(       a  UR                  5       S   nO[        S5      e[        U [        [        U5      5      5      nXU4$ )Nz
 --versionr2   z(No python version information available.)
r   r'   r1   r	  r
  rl   r  r  r)   r(   )r   r   rK   r	  rl   r   r   s          rE   r   r   2	  s    f356J
|:67F]]((*FMM,?,?,AF*	*CDD?OP '888rD   __main__)Fr  rA  )FrF   )__doc__rO  rf   r  rr  rk   difflibr   r  r   r   	itertoolsr   loggingr   os.pathr   r	   r
   r   r   r   r   r   pathlibr   randomr   typingr   r   r   r   r   rJ  r   r   r   r   r   r   auxlib.compatr   
auxlib.ishr   base.contextr   common.compatr   r    r!   r"   r#   r$   r  r%   r&   r'   r(   r)   
exceptionsr*   gateways.disk.creater+   r,   gateways.disk.deleter-   gateways.disk.linkr.   gateways.disk.permissionsr/   gateways.disk.readr0   gateways.subprocessr1   portabilityr3   r  menuinst.knownfoldersr4   r5   menuinst.winshortcutr6   r<   r6  r  r&  r8   ContentTypeOptionsrZ   rF   r   r   r   rG   rS   ri   r   rT   rh   r[  r]  rW   r   r   r"  r  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r  r  r  r  r  r   r0  r!  r"  r$  r  r   r   r   r   rg  r   argvrU  r;   rD   rE   <module>rh     s  :  	 	  
       W W W    - +  3  "   ) 0 ( ( 7 , 1 9	 @4 .  L 
  AB  JO2Zz+&=6(vt JOnbNl =@'F/.; |$D .44444444444444444$8$( '3	`  %	` F$4& '3	I  %	I X>$B"R '3o 
 %o j '3	* %	*Z< ? D0 f$2#"
  '3	B  %	B J D 4 F"TG9" zHHQK		* rD   