
    hS                        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l
mZ d dlmZ d dlmZ d dlmZmZ d dlmZmZ d d	lmZ  e j0                  e      Z G d
 de      Z G d de      Zdee   deeddf   fdZdee   dededefdZ y)    N)Values)	GeneratorIterableIteratorList
NamedTupleOptional)InvalidRequirement)canonicalize_name)Command)ERRORSUCCESS)BaseDistributionget_default_environment)write_outputc                   :    e Zd ZdZdZdZd
dZdedee	   de
fd	Zy)ShowCommandzx
    Show information about one or more installed packages.

    The output is in RFC-compliant mail header format.
    z$
      %prog [options] <package> ...TreturnNc                     | j                   j                  dddddd       | j                  j                  d| j                          y )	Nz-fz--filesfiles
store_trueFz7Show the full list of installed files for each package.)destactiondefaulthelpr   )cmd_opts
add_optionparserinsert_option_group)selfs    DD:\EasyAligner\venv\Lib\site-packages\pip/_internal/commands/show.pyadd_optionszShowCommand.add_options   sE      J 	! 	
 	''4==9    optionsargsc                     |st         j                  d       t        S |}t        |      }t	        ||j
                  |j                        st        S t        S )Nz.ERROR: Please provide a package name or names.)
list_filesverbose)loggerwarningr   search_packages_infoprint_resultsr   r(   r   )r    r$   r%   queryresultss        r!   runzShowCommand.run'   sI    NNKLL&u-w
 Lr#   )r   N)__name__
__module____qualname____doc__usageignore_require_venvr"   r   r   strintr/    r#   r!   r   r      s7    'E
:6 c s r#   r   c                       e Zd ZU eed<   eed<   eed<   ee   ed<   ee   ed<   ee   ed<   eed<   eed<   ee   ed	<   eed
<   eed<   ee   ed<   eed<   eed<   eed<   ee   ed<   eee      ed<   y)_PackageInfonameversionlocationeditable_project_locationrequiresrequired_by	installermetadata_versionclassifierssummaryhomepageproject_urlsauthorauthor_emaillicenseentry_pointsr   N)r0   r1   r2   r6   __annotations__r	   r   r8   r#   r!   r:   r:   5   s    
ILM'},3icNcLMs)KLs)DIr#   r:   r-   r   c           
   #     K   t               }|j                         D ci c]  }|j                  | c}| D cg c]  }t        |       }}t	        t        | |      D cg c]  \  }}|vs| c}}      }|r%t        j                  ddj                  |             dt        dt        t           ffd}|D ]'  }	 |   }	 t	        |j                         D 	ch c]  }	|	j                   c}	t        j                        }
	 t	         ||      t        j                        }	 |j%                  d      }|j'                  d	
      }|j+                         }|d}nt	        |      }|j,                  }|j/                  dg       }|j1                  dd      }|sr|D ]m  }|j3                  dd      \  }}|j5                         j7                  dd      j7                  dd      j9                         }|dk(  s]|j9                         } n t;        d*i d|j<                  d|j>                  d|j@                  xs dd|jB                  d|
d|d|jD                  d|jF                  xs dd|j/                  dg       d|j1                  d d      d|d!|d"|j1                  d#d      d$|j1                  d%d      d&|j1                  d'd      d(|d)| * yc c}w c c}w c c}}w # t        $ r Y Hw xY wc c}	w # t         $ r- t	        |j#                         t        j                        }
Y :w xY w# t         $ r dg}Y +w xY w# t(        $ r g }Y w xY ww)+z
    Gather details from installed distributions. Print distribution name,
    version, location, and installed files. Installed files requires a
    pip generated 'installed-files.txt' in the distributions '.egg-info'
    directory.
    zPackage(s) not found: %s, current_distr   c                 8      fdj                         D        S )Nc              3      K   | ]T  }j                   |j                         D ch c]  }t        |j                         c}v r|j                  d    xs d V yc c}w w)NameUNKNOWNN)canonical_nameiter_dependenciesr   r;   metadata).0distdrN   s      r!   	<genexpr>zHsearch_packages_info.<locals>._get_requiring_packages.<locals>.<genexpr>[   sc      
***373I3I3KL3Ka!!&&)3KLM MM&!.Y.*Ls   "A"A!A")values)rN   	installeds   `r!   _get_requiring_packagesz5search_packages_info.<locals>._get_requiring_packagesZ   s    
!((*
 	
r#   )keyz#N/Azentry_points.txtF)keependsNzProject-URLz	Home-page ,   )maxsplit-_rE   r;   r<   r=   r>   r?   r@   rA   rB   rC   
ClassifierrD   SummaryrF   rG   AuthorrH   zAuthor-emailrI   LicenserJ   r   r8   )$r   iter_all_distributionsrS   r   sortedzipr)   r*   joinr   r   r6   KeyErrorrT   r;   lowerr
   iter_raw_dependencies	read_text
splitlinesFileNotFoundErroriter_declared_entriesrU   get_allgetsplitcasefoldreplacestripr:   raw_nameraw_versionr=   r>   rA   rB   )r-   envrW   r;   query_namespkgmissingr\   
query_namereqr?   r@   entry_points_textrJ   
files_iterr   rU   rF   rE   url	url_labelnormalized_labelr[   s                         @r!   r+   r+   I   s     "
#C7:7Q7Q7ST7St$$d*7STI7<=ut$T*uK="5+6O6)$#Y:N6OG 1499W3EF
.> 
8C= 
 "
	Z(D	K%)%;%;%=>%=c%=>IIH	# !8!>CIINK	 $/A B,777GL //1
)-E:&E==''r:<<R0
 $!$3!;	3&&(00b9AA#rJPPR ! $z1"yy{H $  

$$
 ]](b
 '+&D&D	

 
 $
 nn
 "228b
 !((r:
 LLB/
 
 &
 <<"-
 "nb9
 LLB/
  &!
" #
 	
e "! U=O   		 ? " 	Kd88:		JH	K
 " 	#!(K	# ! 	L	s   M-K*M-K/M-#K4
0K4
4AM-K:	L L

3L!M-#MB0M-C9M-:	LM-LM-
L2MM-MM-MM-MM-M*&M-)M**M-distributionsr'   r(   c                    d}t        |       D ];  \  }}d}|dkD  rt        d       t        d|j                         t        d|j                         t        d|j                         t        d|j
                         t        d	|j                         t        d
|j                         t        d|j                         t        d|j                         |j                  t        d|j                         t        ddj                  |j                               t        ddj                  |j                               |rt        d|j                         t        d|j                         t        d       |j                   D ]  }t        d|        t        d       |j"                  D ]  }t        d|j%                                 t        d       |j&                  D ]  }t        d|        |st        d       |j(                  t        d       |j(                  D ]  }	t        d|	j%                                 > |S )zC
    Print the information from installed distributions found.
    FTr   z---zName: %szVersion: %szSummary: %szHome-page: %sz
Author: %szAuthor-email: %szLicense: %szLocation: %szEditable project location: %szRequires: %srM   zRequired-by: %szMetadata-Version: %szInstaller: %szClassifiers:z  %szEntry-points:zProject-URLs:zFiles:z+Cannot locate RECORD or installed-files.txt)	enumerater   r;   r<   rD   rE   rG   rH   rI   r=   r>   rl   r?   r@   rB   rA   rC   rJ   ry   rF   r   )
r   r'   r(   results_printedirW   
classifierentryproject_urllines
             r!   r,   r,      s    O]+4q5Z+]DLL1]DLL1_dmm4\4;;/'):):;]DLL1^T]]3))5/1O1O 	^TYYt}}%=>&		$2B2B(CD/1F1FG$..9("..
VZ0 /)**VU[[]3 +)#00V[1  1"zz!JK JJD 6 'K ,N r#   )!loggingoptparser   typingr   r   r   r   r   r	   "pip._vendor.packaging.requirementsr
   pip._vendor.packaging.utilsr   pip._internal.cli.base_commandr   pip._internal.cli.status_codesr   r   pip._internal.metadatar   r   pip._internal.utils.miscr   	getLoggerr0   r)   r   r:   r6   r+   boolr,   r8   r#   r!   <module>r      s      L L A 9 2 9 L 1			8	$"' "J: (]
S	 ]
idD8P.Q ]
@0L)00 0 
	0r#   