관리-도구
편집 파일: show.cpython-39.opt-1.pyc
a ����[��f�����������������������@���s��d�dl�Z�d�dlZd�dlZd�dlmZ�d�dlmZmZmZm Z m Z �d�dlmZ�d�dl mZ�d�dlmZmZ�d�dlmZmZ�d�dlmZ�e�e�ZG�d d ��d e�ZG�dd��de�Ze ed f�e ed f�ed�dd�Zee�ee�d�dd�Zee�eeed�dd�Z dS�)�����N)�Values)�Iterator�List� NamedTuple�Optional�Tuple��canonicalize_name)�Command)�ERROR�SUCCESS)�BaseDistribution�get_default_environment)�write_outputc�������������������@���s<���e�Zd�ZdZdZdZdd�dd�Zeee �e d�d d �ZdS�)�ShowCommandzx Show information about one or more installed packages. The output is in RFC-compliant mail header format. z$ %prog [options] <package> ...TN)�returnc�����������������C���s,���|�j�jddddddd��|�j�d|�j���d�S�) Nz-fz--files�files� store_trueFz7Show the full list of installed files for each package.)�dest�action�default�helpr���)Zcmd_optsZ add_option�parserZinsert_option_group)�self��r����?/usr/lib/python3.9/site-packages/pip/_internal/commands/show.py�add_options���s����� zShowCommand.add_options)�options�argsr���c�����������������C���s8���|st��d��tS�|}t|�}t||j|jd�s4tS�tS�)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�resultsr���r���r����run(���s���� �zShowCommand.run)�__name__� __module__�__qualname__�__doc__�usageZignore_require_venvr���r���r����str�intr'���r���r���r���r���r������s ���r���c�������������������@���s����e�Zd�ZU�eed<�eed<�eed<�ee�ed<�ee�ed<�eed<�eed<�ee�ed<�eed <�eed <�eed<�eed<�eed <�ee�ed<�eee��ed<�dS�)�_PackageInfo�name�version�location�requires�required_by� installer�metadata_version�classifiers�summary�homepage�author�author_email�license�entry_pointsr���N)r(���r)���r*���r-����__annotations__r���r���r���r���r���r���r/���6���s��� r/���.)�entry�infor���c�����������������C���s\���|�rD|�d�dkrD|r |d�dkr*|d7�}n|dd��}|�dd��}�q�t�tjg�|�|��R����S�)a���Convert a legacy installed-files.txt path into modern RECORD path. The legacy format stores paths relative to the info directory, while the modern format stores paths relative to the package root, e.g. the site-packages directory. :param entry: Path parts of the installed-files.txt entry. :param info: Path parts of the egg-info directory relative to package root. :returns: The converted entry. For best compatibility with symlinks, this does not use ``abspath()`` or ``Path.resolve()``, but tries to work with path parts: 1. While ``entry`` starts with ``..``, remove the equal amounts of parts from ``info``; if ``info`` is empty, start appending ``..`` instead. 2. Join the two directly. r����..���)rA���N�����r-����pathlib�Path)r?���r@���r���r���r����_convert_legacy_entryH���s���� rG���)r%���r���c�����������������#���s���t���}dd��|���D����dd��|�D��}t��fdd�t|�|�D���}|rXt�dd�|���ttt �d���fd d �}tt tt ��d�dd �}tt tt ��d�dd�}|D��],}z��|�}W�n�ty����Y�q�Y�n0�tdd��|���D��t j d�} t||�t j d�} z|�d�}|jdd�}W�n�t�y.���g�}Y�n0�||��p@||�} | du��rRd}nt| �}|j}t|jt |j�|j�pxd| | |j|j�p�d|�dg��|�dd�|�dd�|�dd�|�dd�|�dd�||d�V��q�dS�)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. c�����������������S���s���i�|�]}|j�|�qS�r���)�canonical_name��.0�distr���r���r���� <dictcomp>l��������z(search_packages_info.<locals>.<dictcomp>c�����������������S���s���g�|�]}t�|��qS�r���r���)rJ���r0���r���r���r���� <listcomp>m���rM���z(search_packages_info.<locals>.<listcomp>c��������������������s���g�|�]\}}|��vr|�qS�r���r���)rJ���r0����pkg�Z installedr���r���rN���o���rM���zPackage(s) not found: %s�, )�current_distr���c��������������������s�����fdd������D��S�)Nc�����������������3���s4���|�],}��j�d�d��|���D��v�r|jd�p*dV��qdS�)c�����������������S���s���h�|�]}t�|j��qS�r���)r ���r0���)rJ����dr���r���r���� <setcomp>y���rM���zRsearch_packages_info.<locals>._get_requiring_packages.<locals>.<genexpr>.<setcomp>�NameZUNKNOWNN)rH����iter_dependencies�metadatarI����rR���r���r���� <genexpr>u���s �����zHsearch_packages_info.<locals>._get_requiring_packages.<locals>.<genexpr>)�valuesrX���rP���rX���r����_get_requiring_packagest���s���� �z5search_packages_info.<locals>._get_requiring_packages)rK���r���c�����������������S���s<���z|���d�}W�n�ty"���Y�d�S�0�dd��t�|����D��S�)NZRECORDc�����������������s���s ���|�]}t�t�|d����V��qdS�)r���NrD���)rJ����rowr���r���r���rY�������rM���zCsearch_packages_info.<locals>._files_from_record.<locals>.<genexpr>)� read_text�FileNotFoundError�csv�reader� splitlines)rK����textr���r���r����_files_from_record|���s ����z0search_packages_info.<locals>._files_from_recordc��������������������s����z|���d�}W�n�ty"���Y�d�S�0�dd��|jdd�D��}|�j}|�j}|d�u�sV|d�u�rZ|S�zt�|��|���W�n�ty����|�Y�S�0���j s�|S���fdd�|D��S�)Nzinstalled-files.txtc�����������������s���s���|�]}|r|V��qd�S��Nr����rJ����pr���r���r���rY�������rM���zCsearch_packages_info.<locals>._files_from_legacy.<locals>.<genexpr>F��keependsc�����������������3���s"���|�]}t�t�|�j��j�V��qd�S�rd���)rG���rE���rF����partsre����Zinfo_relr���r���rY�������s���) r]���r^���ra���r2���Zinfo_directoryrE���rF����relative_to� ValueErrorri���)rK���rb����paths�rootr@���r���rj���r����_files_from_legacy����s$���� �z0search_packages_info.<locals>._files_from_legacyc�����������������s���s���|�]}|j�V��qd�S�rd���)r0���)rJ���Zreqr���r���r���rY�������rM���z'search_packages_info.<locals>.<genexpr>)�keyzentry_points.txtFrg���N��Z ClassifierZSummaryz Home-pageZAuthorzAuthor-emailZLicense)r0���r1���r2���r3���r4���r5���r6���r7���r8���r9���r:���r;���r<���r=���r���)r���Ziter_distributions�sorted�zipr!���r"����joinr ���r���r-���r����KeyErrorrV����lowerr]���ra���r^���rW���r/���Zraw_namer1���r2���r5���r6���Zget_all�get)r%����envZquery_names�missingr[���rc���ro���Z query_namerK���r3���r4���Zentry_points_textr=���Z files_iterr���rW���r���rP���r���r#���c���sZ����� �r#���)� distributionsr���r ���r���c����������� ������C���sP��d}t�|��D��]<\}}d}|dkr*td��td|j��td|j��td|j��td|j��td |j��td |j��td|j��td|j ��td d� |j���tdd� |j���|�rtd|j ��td|j��td��|jD�]}td|��q�td��|jD�]}td|�����q�|rtd��|jdu��r.td��q|jD�]}td|������q4q|S�)zC Print the information from installed distributions found. FTr���z---zName: %szVersion: %szSummary: %sz Home-page: %sz Author: %szAuthor-email: %szLicense: %szLocation: %szRequires: %srQ���zRequired-by: %szMetadata-Version: %sz Installer: %szClassifiers:z %sz Entry-points:zFiles:Nz+Cannot locate RECORD or installed-files.txt)� enumerater���r0���r1���r8���r9���r:���r;���r<���r2���rt���r3���r4���r6���r5���r7���r=����stripr���) rz���r���r ���Zresults_printed�irK���Z classifierr?����liner���r���r���r$�������s>���� r$���)!r_���ZloggingrE���Zoptparser����typingr���r���r���r���r���Zpip._vendor.packaging.utilsr ���Zpip._internal.cli.base_commandr ���Zpip._internal.cli.status_codesr���r���Zpip._internal.metadatar ���r���Zpip._internal.utils.miscr���Z getLoggerr(���r!���r���r/���r-���rG���r#����boolr$���r���r���r���r����<module>���s&��� %"`�