AlkantarClanX12

Your IP : 18.119.127.13


Current Path : /proc/self/root/usr/lib/python3.6/site-packages/pip/commands/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib/python3.6/site-packages/pip/commands/__pycache__/show.cpython-36.pyc

3

�Pf�@s�ddlmZddlmZddlZddlZddlmZddlm	Z	m
Z
ddlmZddl
mZeje�ZGdd	�d	e�Zd
d�Zdd
d�ZdS)�)�absolute_import)�
FeedParserN)�Command)�SUCCESS�ERROR)�
pkg_resources)�canonicalize_namecs4eZdZdZdZdZdZ�fdd�Zdd�Z�Z	S)	�ShowCommandz6Show information about one or more installed packages.Zshowz$
      %prog [options] <package> ...z*Show information about installed packages.cs>tt|�j||�|jjddddddd�|jjd|j�dS)	Nz-fz--files�files�
store_trueFz7Show the full list of installed files for each package.)�dest�action�default�helpr)�superr	�__init__Zcmd_optsZ
add_option�parserZinsert_option_group)�self�args�kw)�	__class__��/usr/lib/python3.6/show.pyrszShowCommand.__init__cCs8|stjd�tS|}t|�}t||j|jd�s4tStS)Nz.ERROR: Please provide a package name or names.)�
list_files�verbose)�loggerZwarningr�search_packages_info�
print_resultsr
rr)rZoptionsr�query�resultsrrr�run"s
zShowCommand.run)
�__name__�
__module__�__qualname__�__doc__�nameZusage�summaryrr �
__classcell__rr)rrr	sr	c#si�xtjD]}|�t|j�<qWdd�|D�}�x�fdd�|D�D�]Ή�j�j�jdd��j�D�d�}d}d}t�tj�rވj	d�rȈj
d�}dd�|D�}�fd	d�|D�}�fd
d�|D�}�j	d�r܈jd�}nP�j	d��r�j
d�}�fd
d�|D�}�fdd�|D�}�j	d��r.�jd�}�j	d��rL�j
d�}||d<�j	d��r�x,�j
d�D]}	|	j��rd|	j�|d<P�qdWt
�}
|
j|�|
j�}xdD]}|j|�||<�q�Wg}
x4|j�D](}	|	jd��r�|
j|	td�d���q�W|
|d<|�rt|�|d<|VqFWdS)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.
    cSsg|]}t|��qSr)r)�.0r%rrr�
<listcomp>:sz(search_packages_info.<locals>.<listcomp>csg|]}|�kr�|�qSrr)r(Zpkg)�	installedrrr)<scSsg|]
}|j�qSr)�project_name)r(Zdeprrrr)As)r%�version�location�requiresNZRECORDcSsg|]}|jd�d�qS)�,r)�split)r(�lrrrr)Iscsg|]}tjj�j|��qSr)�os�path�joinr-)r(�p)�distrrr)Jscsg|]}tjj|�j��qSr)r2r3�relpathr-)r(r5)r6rrr)KsZMETADATAzinstalled-files.txtcsg|]}tjj�j|��qSr)r2r3r4Zegg_info)r(r5)r6rrr)Sscsg|]}tjj|�j��qSr)r2r3r7r-)r(r5)r6rrr)TszPKG-INFOzentry_points.txt�entry_pointsZ	INSTALLER�	installer�metadata-versionr&�	home-page�author�author-email�licensezClassifier: �classifiersr
)r:r&r;r<r=r>)rZworking_setrr+r,r-r.�
isinstanceZDistInfoDistributionZhas_metadataZget_metadata_linesZget_metadata�striprZfeed�close�get�
splitlines�
startswith�append�len�sorted)rr5Zquery_names�packageZ	file_listZmetadata�lines�pathsr8�lineZfeed_parserZ
pkg_info_dict�keyr?r)r6r*rr/s^







rFc	Cs�d}�x�t|�D�]�\}}d}|dkr0tjd�tjd|jdd��tjd|jd	d��tjd
|jdd��tjd|jd
d��tjd|jdd��tjd|jdd��tjd|jdd��tjd|jdd��tjddj|jdg���|�rxtjd|jdd��tjd|jdd��tjd�x"|jdg�D]}tjd|��q0Wtjd �x&|jd!g�D]}tjd|j���q^W|rtjd"�x&|jd#g�D]}tjd|j���q�Wd#|krtjd$�qW|S)%zD
    Print the informations from installed distributions found.
    FTrz---zName: %sr%�zVersion: %sr,zSummary: %sr&z
Home-page: %sz	home-pagez
Author: %sr<zAuthor-email: %szauthor-emailzLicense: %sr>zLocation: %sr-zRequires: %sz, r.zMetadata-Version: %szmetadata-versionz
Installer: %sr9zClassifiers:r?z  %sz
Entry-points:r8zFiles:r
z!Cannot locate installed-files.txt)�	enumerater�inforCr4rA)	Z
distributionsrrZresults_printed�ir6Z
classifier�entryrLrrrrxs>



r)FF)Z
__future__rZemail.parserrZloggingr2Zpip.basecommandrZpip.status_codesrrZpip._vendorrZpip._vendor.packaging.utilsrZ	getLoggerr!rr	rrrrrr�<module>s
I