
    siZ;                    R   S 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.J/r/J0r0J1r1J2r2J3r3J4r4  SSK5J6r6J7r7J8r8J9r9J:r:  SSK;J<r<  SSK=J>r>  SSK?J@r@JArA  SSKBJCrC  SSKDJErE  SSKFJGrG  SSKHJIrI  SSKJJKrK  SSKLJMrM  \3(       a  SSKNrNSSKOJPrPJQrQ  SS KRJSrS  \" \T5      rUS!rVS"rW " S# S$5      rX\S%   rYS& rZ ScS' jr[SdS( jr\S) r]S* r^ScS+ jr_S, r` ScS- jraScS. jrbS/ rcS0 rdS1 reS2 rfSeS3 j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}SJ r~  SfSK\Y4SL jjrSM rSN r  SfSK\Y4SO jjrSP rSQ r  SfSK\Y4SR jjr  SfSK\Y4SS jjrST rSU rScSV jrScSW jrSX rSY rSZ r  SfSK\Y4S[ jjrS\ rS] rS^ rS_ rS` rSa r\TSb:X  a(  \3(       a  \GR*                  S   r\f" \5        g\e" 5         gg)ga  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)json)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.pyr9   r9   i   s    JHIrE   r9   )
initializeadd_condabin_to_pathc                     [        U 5      n[        U5        [        R                  (       d"  [	        S U 5       5      (       a  [        S5      e[        U5        g)Nc              3   L   #    U  H  oS    [         R                  :H  v   M     g7fresultNr9   rA   .0steps     rF   	<genexpr>install.<locals>.<genexpr>y   s       #8<X&+++   "$z(Some steps require elevated permissions.r   )make_install_planrun_planr   dry_runanyr   print_plan_results)conda_prefixplans     rF   installr[   v   sL    \*DTN??s #8<#     CDDtrE   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rK   rM   rN   s     rF   rQ   initialize.<locals>.<genexpr>        
@44>V...4rS   Operation failed.filer3   )osgetenvrT   rU   r   rV   run_plan_elevatedmake_initialize_planrX   rW   printsysstderr)	rY   shellsfor_user
for_systemanaconda_promptr`   plan1plan2rZ   s	            rF   rG   rG      s     E	yy*+v5!,/e$ hOE UO??% =Dt

@4
@@@!

3 ArE   c           	      X   [        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)rv   conda_source_rootzeasy-install.pthzconda.egg-infoc              3   L   #    U  H  oS    [         R                  :H  v   M     g7frK   rM   rN   s     rF   rQ   !initialize_dev.<locals>.<genexpr>   rc   rS   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&   rl   prefixrg   getcwd_get_python_infor   r   r+   rT   appendremove_conda_in_sp_dirr=   make_conda_egg_linkmodify_easy_install_pthmake_dev_egg_info_filerU   r   rV   verboserX   rm   rW   r   r   r#   rk   _initialize_dev_bash_initialize_dev_cmdexer$   writeNotImplementedError)shelldev_env_prefixr{   r   
python_exepython_versionsite_packages_dirrZ   env_varsunset_env_varsscriptfhs               rF   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  NS N-7f)	Nz$(cygpath 'z')c              3   ,   #    U  H
  nS U 3v   M     g7f)zunset Nr<   rO   envvars     rF   rQ   '_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<   rO   r   values      rF   rQ   r      s%      :R'&E7!$:R   z	eval "$("z" -m conda shell.bash hook)"zconda activate 'r   )r   rl   
executabler#   sorteditemsr   auto_activate)r   r   r   sys_executables       rF   r   r      s     S^^,Nv&~&6b9 @???:@AQ:R  
 n%%A
BB  **  @s!   7BB'B!B",BBc              #   P  #    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  Ni 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     rF   rQ   )_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      rF   rQ   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        rF   r   r   
  s     G{{FJ'H	R @???8>x~~?O8P  
 H//07)
<<
88 ;./{7)2fXQOO<<  @s"   6B&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rK   rM   rN   s     rF   rQ   'add_condabin_to_path.<locals>.<genexpr>/  rc   rS   rd   re   r3   )
make_condabin_planrU   r   rV   ri   rX   rW   rk   rl   rm   )rY   rn   ro   rp   r`   rZ   s         rF   rH   rH   %  s\    hGD TN??$t

@4
@@@!

3 ArE   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)rv   rY   rw   zconda-env.exer   ru   	conda.climain)rv   rY   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: re   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_xshrk   rl   rm   install_conda_csh)rY   r   r   r   rZ   conda_exe_pathconda_env_exe_paths          rF   rT   rT   9  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                 x  ^ [        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a8  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        [
        (       a2  [%        [&        R(                  5      u  nnU(       a  [+        S$U 35      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)rv   rY   r   r`   rw   ZDOTDIR$ZDOTDIR.zshrc/etc/profile.d/conda.shrv   rY   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r2   stdoutstrip	Exception	exe_namesexe_nameprofiles     rF   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\AutoRunrv   OHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabledr   Anaconda Prompt.lnkzCould not get Desktop folder: Desktop)rT   setr&   r   r"   r#   r   init_sh_userr=   rg   environinit_sh_systeminit_fish_userinit_xonsh_userinit_powershell_userinit_cmd_exe_registryinit_long_pathinstall_anaconda_promptr6   r5   r  RuntimeErrorr   )rY   rn   ro   rp   rq   r`   rZ   bashrc_path
zshrc_pathconfig_fish_pathconfig_xonsh_pathtcshrc_pathr  config_powershell_pathsconfig_pathdesktop_dir	exceptionr  s                    @rF   rj   rj   2  s9   & \*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&)G	{'STT  #:c?I>KK 7 @ @'+K9N'O(4#*	 KrE   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   rH   )rv   rY   r   r`   content_typerw   r   r   r   r   )rv   rY   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     rF   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\PATHrv   r  )r  r&   r   r"   r#   r   r  r=   rg   r  r  r  r  r   add_condabin_to_path_registryr"  )rY   rn   ro   rp   r`   rZ   r%  r&  r'  r(  r)  r  r*  r+  r  s                 @rF   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 KrE   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)	NrL   rx   argsr<   ry   z%s: %rT)exc_info)	getr9   rB   rC   globalsr   loginforA   )rZ   rP   previous_resultrL   es        rF   rU   rU     s    ((8T2v0@0@AA	'YtJ/0&"%)-(B)?F  X   	'HHXtJ/THB&&F	's   6A>>
B;)B66B;c                    [        S U  5       5      (       Ga  [        R                  " U SS S9n[        (       a  SSKJn  Sn [        SS	SS
9 nUR                  U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  pgUb  [        SU 3[        R                  S9  [        U5       n[        UR!                  5       5      n	SSS5        U(       a  [#        U5      (       a  [%        U5        O['        S[        R                   S30 [(        R*                  " 5       US9n
U
R                  R-                  5       nU(       a  [        U[        R                  S9  U
R.                  R-                  5       n	[        R0                  " W	5      U SS& gg! , (       d  f       GNK= f! , (       d  f       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rK   rM   rN   s     rF   rQ   $run_plan_elevated.<locals>.<genexpr>  rc   rS   Fc                     U R                   $ N)__dict__)xs    rF   <lambda>#run_plan_elevated.<locals>.<lambda>  s    ajjrE   )ensure_asciidefaultr   )run_as_adminNzw+z.json)suffixdeleter   z-mzconda.core.initializez'ERROR during elevated execution.
  rc: re   zsudo z -m conda.core.initialize)envpathstdin)rW   r*   dumpsr#   common._os.windowsrG  r   r   namer   rl   r   rk   rm   r$   r    readr/   r.   r2   rg   r   r  r
  loads)rZ   
plan_inputrG  	temp_pathtfr   	hinstance
error_coder   plan_outputrL   rm   s               rF   ri   ri   	  s     
@4
@@@ZZ(

 69I%+DOSUHHZ( "I P  !!8 9;
(4'>!I;a@PQ)%	 )B:,O ZZ
 y)R"22779"=K * !3!3)$ %''@AYY[ 	F ]]((*Ff3::. ----/K**[)Q[ A PO *) !3!3)$ "49s=   G F1-A G G'G 1
G ;G 
GG &G:c                     [         R                  R                  5       R                  5       n [        R
                  " U 5      n[        U5        [         R                  R                  [        R                  " U5      5        g r@  )
rl   rL  rP  r  r*   rQ  rU   r
  r   rM  )rL  rZ   s     rF   run_plan_from_stdinrY  I  sK    IINN""$E::eDTNJJTZZ%&rE   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)rE  )	r$   r*   rQ  r    rP  rU   r   r   rM  )rS  r   rZ   s      rF   run_plan_from_temp_filer[  P  st    	9	zz*277956 
TN	9e	$
tzz$UCDE 
%	$ 
	 
%	$s   .B.B!
B!
B/c                 l   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+  [
        R                  (       a  [        SUS9  g [        SUS9  g [
        R                  (       a  [        S	US9  g [        S
US9  g )NrL   14ry   rv   re   c              3   d   #    U  H&  oR                  S 5      [        R                  :H  v   M(     g7frK   )r6  r9   rB   rN   s     rF   rQ   %print_plan_results.<locals>.<genexpr>`  s      IDD((8$7Ds   .0zW
==> DRY RUN: The above changes would have been made. NO ACTUAL CHANGES WERE MADE. <==
zK
==> For changes to take effect, close and re-open your current shell. <==
z)DRY RUN: No action would have been taken.zNo action taken.)rl   r
  rk   r6  rW   r   rV   )rZ   streamrP   changeds       rF   rX   rX   X  s    (+T(^M-JKRX	
 
 IDIIG??k
 _
 ??=FK$62rE   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$   rP  r#   r   r'   r4   r   r   r   rk   	make_diffrV   r-   r
   r   r0   r9   rB   rC   )rv   rY   r   r   conda_ep_pathr   original_ep_contentnew_ep_contentpython_pathconda_extrafdsts              rF   r   r   x  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   r1   r9   rC   r   rV   r   r
   r-   r,   rB   )rv   rY   exe_pathbitssource_exe_paths        rF   r   r     s    Hvs##D-wt8KLOhx';+NN###??WX&''GH%& 	_'??rE   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   rg   r  formatr9   rC   r   rV   r7   r   rB   rK  r   remove)rv   rY   r`   	icon_pathtargetr4  rL   s          rF   r#  r#    s     '2BCI"**Z()5JKF 	z+;<z+DE	
D F??)HHTNC N	
 77>>&!!IIf__FMrE   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$   rP  r   r   rk   re  rV   r-   r
   r   r9   rB   rC   )rv   file_contentr   original_contentnew_contentrk  s         rF   _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  rv   rY   r}  s      rF   r   r     #    !#((u(=L33rE   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$   rP  r  rv   rY   src_pathfsrcr}  s        rF   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        rF   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        rF   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  rv   rY   r  r}  r  s        rF   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        rF   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  rv   rY   conda_bat_src_pathr  r}  s        rF   r   r   1  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        rF   r   r   9  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        rF   r   r   C  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        rF   r   r   M  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        rF   r   r   U  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        rF   r   r   _  r  r  c                 F    [        5       R                  SS9n[        X5      $ r  )r   r  r  r  s      rF   r   r   g  s"     ?''e'<L33rE   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  )rv   rY   conda_psm1_pathr  r}  s        rF   r   r   m  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      rF   r   r   u  s#    &(--E-BL33rE   c                 F    [        5       R                  SS9n[        X5      $ r  )r   r  r  r  s      rF   r   r   {  r  rE   c                 F    [        5       R                  SS9n[        X5      $ r  )r   r  r  r  s      rF   r   r     s"    >&&U&;L33rE   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   ru   r   win_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_exerY   )r   r%   r#   common.pathr  r   rY   r  r  conda_initialize_contents       rF   _config_fish_contentr    sR    \=+WUIv2$Y/	#	   $	 & $#rE   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   r  z
        # >>> conda initialize >>>
        # !! Contents within this block are managed by 'conda init' !!
        set -x PATH "z3" $PATH
        # <<< conda initialize <<<
        r   r#   r  r  r   )rY   condabin_dirr  r  s       rF   ,_config_fish_content_to_add_condabin_to_pathr    sI    j1Lv2'5# #^ $		  $#rE   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 initializerG   rH   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$   rP  FileNotFoundErrorr  r  
ValueErrorresub	MULTILINECONDA_INITIALIZE_RE_BLOCKDOTALLr#   r	   replacer   r   rk   re  rV   r   r
   r-   r   r9   rB   rC   rv   rY   r`   r/  user_rc_pathr   
rc_contentrc_original_contentconda_init_commentr  replace_strs              rF   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   ru   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   rx  r  s       rF   _config_xonsh_contentr    sP    \=+WUIv2$Y/	#	   fyf!! " $#rE   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  )rY   condabin_pathr  s      rF   -_config_xonsh_content_to_add_condabin_to_pathr  1  sC    z2Mv2(7 ( )		 rE   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  rG   rH   r  r  r  r  r  r  r  r  r   r   )r$   rP  r  r  r  r  r  r  r  r  r  r  r   r   rk   re  rV   r   r
   r-   r   r9   rB   rC   r  s              rF   r  r  A  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   ru   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_binrY   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
   )rY   r   r  r  r  s        rF   _bashrc_contentr    s    \=+WUIv2$Y/	#'	$
 #
$
 p $#U O#'+	( '$Y/ ,	($R $#/ (,($ '$Y/ ,	#($. $#rE   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  )rY   r   r  r  s       rF   '_bashrc_content_to_add_condabin_to_pathr    s    z2Mv2(7 $_ %+_ -		
 		
  $_ %+_ -		
 		
  $_ %		 rE   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   rG   rH   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$   rP  r  r  r  r  r  r  r  r  r  r#   r	   r  r   r   rk   re  rV   r   r9   rB   rC   )rv   rY   r   r`   r/  r  r   r  r  r  r  r  s               rF   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   rG   posixrH   r  r  r   r   )r   r$   rP  rg   ry  r9   rB   r  r  r  r   r   rk   re  rV   r/   r.   r-   r
   r   rC   )rv   rY   r`   r/  conda_sh_system_pathr   conda_sh_system_contentsconda_sh_contentss           rF   r  r  e  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\r3   r   NN)splitrsplitgetattrwinregOpenKeyKEY_READr   errnor   QueryValueEx
isinstancestrr  CloseKeyr  )
rv   main_keythe_rest
subkey_str
value_namekeyr;  value_tuplevalue_value
value_types
             rF   _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  r3   r   )r  r  r  r  r  	KEY_WRITEr   r  r   	CreateKey
SetValueExr  )	rv   r  r  r  r  r  r  r  r;  s	            rF   _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                 F   [        U 5      u  p4Uc  Sn[        R                  nSR                  [	        USS5      5      nSU SU 3nU(       aq  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 rw  &z & r  zF(if exist \"[^\"]*?conda[-_]hook\.bat\" \"[^\"]*?conda[-_]hook\.bat\")r3   countr  z(\"[^\"]*?conda[-_]hook\.bat\")r  r   )r  r  REG_EXPAND_SZrx  r   r  r  r  r  
IGNORECASEUNICODEr  r   r   rk   re  rV   r  r9   rB   rC   )rv   rY   r`   
prev_valuer  old_hook_pathnew_hookautorun_partspart	new_valuer  new_value_2s               rF   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0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(       a8  [        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   rk   re  rV   r  r9   rB   rC   )rv   rY   r`   r   r  r  normalized_condabin_pathr  
path_partsnormalized_path_partsnormalized_partnew_path_partsr  s                rF   r2  r2    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0F<F,F;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 )Nr3   .
   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   rk   re  rV   r  r  	REG_DWORDr9   rB   rC   )rv   win_ver_win_revr   r  s         rF   r"  r"  5  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? ### rE   c                 f    [        U [        [        (       a  SOS5      n[        SU SU S35      nU$ )Nr   ru   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   )rY   r  conda_powershell_modules      rF   _powershell_profile_contentr  N  sI    \=+WUI" ; K 			 #"rE   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   )rY   r  s     rF   3_powershell_profile_content_to_add_condabin_to_pathr   _  s1    j1L #^ $		 rE   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   r3   r  rG   rH   r  r  z#region conda initializer   r  r   )rg   rK  r   r$   rP  r  r  CONDA_INITIALIZE_PS_RE_BLOCKr  r  r  r   r  r  r   r   rk   re  rV   r
   r-   r   r9   rB   rC   )	rv   rY   r`   r/  profile_pathfpprofile_contentprofile_original_contentr  s	            rF   r   r   l  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)rz   Nendswith)rO   ps     rF   rQ   )remove_conda_in_sp_dir.<locals>.<genexpr>  s     Nk<L1M11ks   (	(zrm -rf re   T)ru   	conda_env)r   from_iterabler   r   rk   rl   rm   r   rV   r.   r/   r9   rB   rC   )rv   r;   r   rm_rf_thesefnothersotherrK  s           rF   r   r     s	   H#%%'78'34'78	
K OkNK.345CJJG$(-.	 
F %-4==GD6"4??dH  rE   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   re   wb)rg   linesepr   r$   rP  r   r   rk   rl   rm   re  rV   r   r!   r9   rB   rC   )rv   r{   conda_egg_link_contentsr   conda_egg_link_contents_olds        rF   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Nj= f! , (       d  f       [        R(                  $ = f)Nr   ru   c              3   V   >#    U  H  oR                  T5      (       a  M  Uv   M      g 7fr@  r)  )rO   lnln_ends     rF   rQ   *modify_easy_install_pth.<locals>.<genexpr>  s       'r{{6/B's   )	)r   re   r5  )r   r$   rP  
splitlinesr9   rC   rg   septupler6  r   r   r   rk   rl   rm   re  rV   r   r!   rB   )rv   r{   easy_install_new_liner   old_contentsold_contents_linesnew_contentsr<  s          @rF   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   re   r   )r   r$   rP  r   CONDA_VERSIONr9   rC   r   r   rk   rl   rm   re  rV   r/   r.   r   rB   )rv   r   rB  rD  s       rF   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   r>  )oldnews     rF   re  re  :	  s&    99\#.."2CNN4DEFFrE   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
 --versionr3   z(No python version information available.)
r   r'   r2   r
  r  rm   r  r  r)   r(   )r   r   rL   r
  rm   r   r   s          rF   r   r   >	  s    f356J
|:67F]]((*FMM,?,?,AF*	*CDD?OP '888rE   __main__)Fr  r@  )FrG   )__doc__rg   r  rp  rl   difflibr   r  r   r   	itertoolsr   loggingr   os.pathr   r	   r
   r   r   r   r   r   pathlibr   randomr   typingr   r   r   r   r   rF  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)   common.serializer*   
exceptionsr+   gateways.disk.creater,   r-   gateways.disk.deleter.   gateways.disk.linkr/   gateways.disk.permissionsr0   gateways.disk.readr1   gateways.subprocessr2   portabilityr4   r  menuinst.knownfoldersr5   r6   menuinst.winshortcutr7   r=   r8  r  r"  r9   ContentTypeOptionsr[   rG   r   r   r   rH   rT   rj   r   rU   ri   rY  r[  rX   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!  r2  r"  r  r   r   r   r   r   r   re  r   argvrS  r<   rE   rF   <module>re     s  : 
 	  
       W W W    - +  3  "   $ ( 0 ( ( 7 , 1 9	 @4 .  L 
  AB  JO2Zz+&=6(vt JOodNl =*@'F3@; |$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		* rE   