
    <Bh                        S r SSKJr  SSKrSSKrSSKJrJrJr  SSK	J
r
  \
(       a
  SSKJrJrJr  \R                  " \5      rSS jrS rSS	 jrSS
 jrg)zCLI implementation for `conda compare`.

Compare the packages in an environment with the packages listed in an environment file.
    )annotationsN)abspath
expanduser
expandvars)TYPE_CHECKING)ArgumentParser	Namespace_SubParsersActionc                    SSK Jn  SSKJnJn  SnUnU" S5      nU R
                  "  SUUUS.UD6nU" U5        U" U5        UR                  SS	S
S9  UR                  SS9  U$ )N   )dals   )add_parser_jsonadd_parser_prefixz,Compare packages between conda environments.a  
        Examples:

        Compare packages in the current environment with respect
        to 'environment.yml' located in the current working directory::

            conda compare environment.yml

        Compare packages installed into the environment 'myenv' with respect
        to 'environment.yml' in a different directory::

            conda compare -n myenv path/to/file/environment.yml

        )helpdescriptionepilogfilestorez<Path to the environment file that is to be compared against.)actionr   zconda.cli.main_compare.execute)func)compare)
auxlib.ishr   helpersr   r   
add_parseradd_argumentset_defaults)	sub_parserskwargsr   r   r   summaryr   r   ps	            6lib/python3.13/site-packages/conda/cli/main_compare.pyconfigure_parserr#      s    !;<GK	F" 				
 	A AaNNK  
 NN8N9H    c                    SSK Jn  SSKJn  [        R
                  R                  U 5      (       d  U" U 5      e[        U" U SS9R                  5       S S9$ )Nr   
PrefixData)EnvironmentLocationNotFoundT)interoperabilityc                    U R                   $ )N)name)xs    r"   <lambda>get_packages.<locals>.<lambda>H   s    affr$   )key)	core.prefix_datar'   
exceptionsr(   ospathisdirsortediter_records)prefixr'   r(   s      r"   get_packagesr8   ?   sI    -877==  )&116D1>>@ r$   c                   SSK Jn  / nSnU H  nU" U5      nUR                  =op;   a]  UR                  X   =n5      (       dA  SnUR	                  U SU SUR                   SUR
                   SUR                   3	5        Mw  My  SnUR	                  U S	35        M     U(       d  UR	                  S
5        [        U5      U4$ )Nr   )	MatchSpecFTz( found but mismatch. Specification pkg: z, Running pkg: z===z
 not foundzzSuccess. All the packages in the specification file are present in the environment with matching version and build string.)models.match_specr:   r+   matchappendversionbuildint)	active_pkgsspecification_pkgsr:   outputmisspkgpkg_specr+   
active_pkgs	            r"   compare_packagesrI   L   s    -FD!S>MM!D1>>0A"A*BBfDSE J$$.OO#4Bz7I7I6J!JL\L\K]_ C DMMTF*-. " 6	

 t9fr$   c                   SSK Jn  SSKJn  SSKJn  SSKJn  SSKJ	n  SSK
Jn  UR                  5       nUR                  5         [        UR                  5      n	 U R                   R#                  S	S5      S
   n
X;   a  U R                   nO'[%        ['        [)        U R                   5      5      5      nUR+                  U R,                  U[.        R0                  " 5       S9nUR2                  nU R4                  c  U R,                  c  UR,                  U l        [7        U	5      Vs0 s H  oR,                  U_M     nn/ nSUR8                  ;   a  UUR8                  S   -   nSUR8                  ;   a  UUR8                  S   -   n[;        UU5      u  nnUR<                  (       a
  U" U5        U$ [?        SRA                  [C        [        U5      5      5        U$ ! U a    e f = fs  snf )Nr   )contextr&   )specs)SpecNotFound)CONDA_SESSION_SCHEMESr   )stdout_jsonz://r   )r+   filename	directorycondapip
)"base.contextrK   r0   r'   envrL   r1   rM   gateways.connection.sessionrN   commonrO   from_contextassert_environmentstrprefix_pathr   splitr   r   r   detectr+   r2   getcwdenvironmentr7   r8   dependenciesrI   jsonprintjoinmap)argsparserrK   r'   rL   rM   rN   rO   prefix_datar7   
url_schemerP   specrV   rF   rB   rC   exitcoderD   s                      r"   executerl   f   s   &-)C#))+K""$(()FYY__UA.q1
.yyHz*TYY*?@AH||X|U;;499#4DI -9,@A,@S88S=,@KA#"""/#2B2B72KK   /#2B2B52II'5GHHf||F O 	diiC()*O#   Bs   B=G $G!G)r   r
   returnr   )rm   ztuple[int, list[str]])rf   r	   rg   r   rm   rA   )__doc__
__future__r   loggingr2   os.pathr   r   r   typingr   argparser   r	   r
   	getLogger__name__logr#   r8   rI   rl    r$   r"   <module>rx      sL   
 #  	 3 3  EE!'T
4)r$   