
    4d                         d dl mZmZ d dlZd dlZd dlZd dlmZ d dlm	Z	 d dl
mZ d dlmZ d dlmZ d dlmZ d dlZd d	lmZ d d
lmZmZmZmZmZmZ ddZd Zee_        ee_         d Z!dS )    )absolute_importprint_functionN)ChannelPriority)context)
PrefixData)get_pinned_specs	MatchSpec)conda)
handle_txn)compute_final_precsget_installed_jsonfileinit_api_contextload_channelsto_txnto_txn_precsFc           	        /0 t                       | t          j                    j        _        dt          j                    _        d |D             }d |j        D             }d|j        vr|                    t          j                   |D ]?}	|		                    d          }
|
r&|
|vr"|
                    t          |
                     @t          j                    }g }t          |||d          }t          j        s.t          j        s"t!          d                    |                     t          j        d	fg}t          j        t(          j        u r!|
                    t          j        d	f           g }t/          |d
d          }t1          |           \  }}|r~	 |                                 t5          j        |j                   n# t:          $ r Y nw xY w|}t=          j                    5 }t1          |          \  }}d d d            n# 1 swxY w Y   t          j         |           }|!                    t          j"                               t          j#        ||          }|$                                 |
                    |           t          j%        ||          }d |D             /dd |D             vr_d/v r[/&                    d          }||         j'        }tQ          d|z             )                                }|*                    |           tW          |           }d}|rtA          |           }|D ]}|,                    |j                  }|r||D ]y}|-                    |          sbt!          d           t!          d                    |                     t!          d                    |                     t]          d	           z	 |)                                } |d|  dz  }|*                    |            # t^          $ r t!          d| d           Y w xY w|rt!          d| d           /fd|D             }!|!r |0                    |!t          j1                   /fd|D             }"|"r |0                    |"t          j2                   |3                                }#|#s0t!          |4                                           t]          d	           t          j5        t          j6                  }$t          j7        |||$          }%|%8                                \  }&}'}(d |&d         D             })|%9                                 |%:                                st]          d           n t          j;        s|%<                                 |rht          j=        |           }*|*>                                }+d |)D             00fd|+D             },t          d |'|(||          }-t          |)|,| |-          }.nt          |)g | |'|(||          }.t          |.| |d           	 |                                 t5          j        |j                   d S # t:          $ r Y d S w xY w)NTc                 ,    g | ]}t          |          S  r	   .0ss     /lib/python3.11/site-packages/mamba/mamba_env.py
<listcomp>z!mamba_install.<locals>.<listcomp>&   s    ///A9Q<<///    c                     g | ]
}|d k    |S )
nodefaultsr   )r   chans     r   r   z!mamba_install.<locals>.<listcomp>)   s"    JJJTT\5I5ID5I5I5Ir   r   channelF)prependz

Looking for: {}

   prunec                     g | ]	}|j         
S r   name)r   i_recs     r   r   z!mamba_install.<locals>.<listcomp>]   s    BBBeuzBBBr   pythonc                     g | ]	}|j         
S r   r$   r   s     r   r   z!mamba_install.<locals>.<listcomp>^   s    4441444r   zpython== zgYour pinning does not match what's currently installed. Please remove the pin and fix your installationz	  Pin: {}z  Currently installed: {}z  - 
z"
ERROR: could not add pinned spec zS. Make sure pin is of the format
libname VERSION BUILD, for example libblas=*=*mkl
z
  Pinned packages:

c                 @    g | ]}t          |          j        v|S r   r
   r%   r   r   installed_namess     r   r   z!mamba_install.<locals>.<listcomp>   s,    RRR11):/)Q)QQ)Q)Q)Qr   c                 @    g | ]}t          |          j        v |S r   r,   r-   s     r   r   z!mamba_install.<locals>.<listcomp>   s,    MMM!	!(9_(L(LA(L(L(Lr   c                 ,    g | ]}t          |          S r   r	   r   ms     r   r   z!mamba_install.<locals>.<listcomp>   s    777QIaLL777r   r   c                     h | ]	}|j         
S r   r$   r1   s     r   	<setcomp>z mamba_install.<locals>.<setcomp>   s    ;;;af;;;r   c                 6    g | ]}|vt          |          S r   r	   )r   r2   specs_to_add_namess     r   r   z!mamba_install.<locals>.<listcomp>   s1     
 
 
:L1L1LIaLL1L1L1Lr   )Cr   apiContextprefix_paramstarget_prefix
always_yeschannelsextendr   get_exact_valueappendstrPoolr   quietjsonprintformatSOLVER_FLAG_ALLOW_DOWNGRADEchannel_priorityr   STRICT SOLVER_FLAG_STRICT_REPO_PRIORITYgetattrr   closeosunlinkr%   	ExceptiontempfileTemporaryDirectoryr   add_packagesget_virtual_packagesReposet_installedSolverindexversionr
   conda_build_formadd_pinr   querymatchexitAssertionErroradd_jobsSOLVER_INSTALLSOLVER_UPDATE	try_solveexplain_problemsMultiPackageCache	pkgs_dirsTransactionto_condalog_jsonpromptdry_runfetch_extract_packagesHistoryget_requested_specs_mapr   r   r   r   )1prefixspecsargsenvri   _kwargsmatch_specschannel_urlsspecspec_channelpoolreposrV   solver_optionsinstalled_pkg_recsr"   installed_json_finstalled_pkg_recs_prefixtdprefix_datareposolverirW   python_constraintpinned_specspinned_specs_infoconda_prefix_datar   xel
final_specinstall_specsupdate_specssuccesspackage_cachetransaction	mmb_specsto_link	to_unlinkspecs_to_addhistoryhistory_mapspecs_to_removefinal_precsconda_transactionr.   r6   s1                                                  @@r   mamba_installr      s   06CKMM-#CKMM/////K KJS\JJJL3<''G,--- 3 3++I66 	3L<<L 1 12228::DE$eUCCCEM 7W\ 7'..u556666:;N?#999sCQGHHHD'5))E
 ,B&+I+I(( N	""$$$I&+,,,, 	 	 	D	$6!(** 	Nb3I"3M3M00	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N .((KS5778888D+&&D	LLZn--F
 CB/ABBBO4444444&&%%h//A(+3G )*w*> ? ? P P R RNN,---#F++L /&v..  ##AF++ 		  wwr{{ K   +,,Q//0005<<R@@AAAGGG		++--J!6
!6!6!66NN:&&&& 	 	 	Fa F F F    	  @>):>>>???RRRRRRRM ;s'9:::MMMMuMMML 9c&7888  G f%%''(((Q)'*;<<M/$>>K$/$8$8$:$:!Iw	77)A,777L -Q_ -**,,, 
+f%%5577;;l;;;
 
 
 
"-
 
 
 *'9&?
 
 )/6;
 
 #"fgy:Le
 
  &$555   
	"'(((((   sH   -G 
GG2HHH!2PP43P4:-Y) )
Y76Y7c                 N    t          t          j                    | ||g|R ddi|S )Nri   T)r   rO   mkdtemp)rn   ro   rp   rq   rr   s        r   mamba_dry_runr      sH    E4/0  :>BH  r   c                      ddl m}  t          j        dd         t          j        dd          z   t          _         |             S )Nr   )mainr!      )conda_env.cli.mainr   sysargv)conda_env_mains    r   r   r      sB    999999x!}sx|+CH>r   )F)"
__future__r   r   rL   r   rO   conda.base.constantsr   conda.base.contextr   conda.core.prefix_datar   conda.core.solver   conda.models.match_specr
   conda_env.installersr   
libmambapyr7   mamba.linkingr   mamba.utilsr   r   r   r   r   r   r   r   installri   r   r   r   r   <module>r      se   7 6 6 6 6 6 6 6 				 



  0 0 0 0 0 0 & & & & & & - - - - - - - - - - - - - - - - - - & & & & & &     $ $ $ $ $ $               V V V Vr       r   