관리-도구
편집 파일: misc.cpython-38.pyc
U ��.e�c � @ s� d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl Z d dl Z d dlZd dlm Z d dlmZ d dlmZ d dlmZmZ d dlmZ d dlmZ d d lmZ d d lmZ d dlm Z d dl!m"Z"m#Z#m$Z$m%Z% d d l&m'Z'm(Z(m)Z)m*Z* d dl+m,Z, d dl-m.Z. d dl/m0Z0m1Z1 e�r8d dlm2Z3 nd dlm3Z3 e.�r�d dl4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z> d dl?m@Z@ e<eAeAeAf ZBndd� Z>dddddddddd d!d"d#d$gZCe�DeE�ZFd%d&� ZGd'd(� ZHd)d"� ZId*d � ZJed+d,d-�d�d/d��ZKd0d1� ZLd2d3� ZMd4d� ZNd�d6d�ZOd7d8� ZPd9d:� ZQd;d� ZRd<d=� ZSd>d?� ZTd@d� ZUdAd� ZVejWfdBdC�ZXd�dEd�ZYdFd� ZZdGd� Z[dHdI� Z\dJdK� Z]dLdM� Z^dNdO� Z_dPdQ� Z`dRdS� ZadDe)dDd.d.dfdTdU�ZbdVdW� ZcdXdY� ZddZd[� Zed\d]� ZfG d^d_� d_eg�ZhG d`da� dae3�Ziejjdbdc� �Zkddd!� Zldedf� ZmG dgdh� dheg�Znd�did#�Zodjdk� Zpdldm� Zqdndo� Zrd�dqdr�Zsdsdt� Ztdudv� Zudwdx� Zvdydz� Zwd{d|� Zxd}d~� Zydd�� Zzd�d$� Z{d�d�� Z|G d�d�� d�eg�Z}d�d�� Z~d�d�� Zd�d�� Z�d�d�� Z�dS )�� )�absolute_importN��deque)� pkg_resources)�retry)�PY2� text_type)�input)�parse)�unquote)�__version__)�CommandError)�distutils_scheme�get_major_minor_version� site_packages� user_site)�WINDOWS� expanduser�stdlib_pkgs�str_to_display)�write_delete_marker_file)�MYPY_CHECK_RUNNING)�running_under_virtualenv�virtualenv_no_global)�BytesIO)�StringIO) �Any�AnyStr� Container�Iterable�List�Optional�Text�Tuple�Union�cast)�Distributionc C s |S �N� )Ztype_�valuer( r( �</usr/lib/python3.8/site-packages/pip/_internal/utils/misc.pyr% A s r% �rmtree�display_path� backup_dir�ask�splitext�format_size�is_installable_dir�normalize_path�renames�get_prog�captured_stdout� ensure_dir�get_installed_version�remove_auth_from_urlc C s4 t j�t j�t�dd�} t j�| �} d�t| t� �S )Nz..zpip {} from {} (python {})) �os�path�join�dirname�__file__�abspath�formatr r )Zpip_pkg_dirr( r( r* �get_pip_versionQ s ��r@ c C sD t | �dk r"| dt | � d 7 } nt | �dkr:| dd� } td| �S )ax Convert a tuple of ints representing a Python version to one of length three. :param py_version_info: a tuple of ints representing a Python version, or None to specify no version. The tuple can have any length. :return: a tuple of length three if `py_version_info` is non-None. Otherwise, return `py_version_info` unchanged (i.e. None). � )r N�VersionInfo)�lenr% )Zpy_version_infor( r( r* �normalize_version_info] s rD c C sD zt �| � W n0 tk r> } z|jtjkr.� W 5 d}~X Y nX dS )z os.path.makedirs without EEXIST.N)r9 �makedirs�OSError�errnoZEEXIST)r: �er( r( r* r6 q s c C sP z0t j�tjd �} | dkr(dtj W S | W S W n tttfk rJ Y nX dS )Nr )z__main__.pyz-cz %s -m pip�pip) r9 r: �basename�sys�argv� executable�AttributeError� TypeError� IndexError)�progr( r( r* r4 { s i� i� )Zstop_max_delayZ wait_fixedFc C s t j| |td� d S )N)� ignore_errors�onerror)�shutilr+ �rmtree_errorhandler)�dirrR r( r( r* r+ � s �c C sX zt �|�jtj@ }W n ttfk r2 Y dS X |rRt �|tj� | |� dS � dS )z�On Windows, the files in .svn are read-only, so when rmtree() tries to remove them, an exception is thrown. We catch that here, remove the read-only attribute, and hopefully continue without problems.N)r9 �stat�st_mode�S_IWRITE�IOErrorrF �chmod)�funcr: �exc_infoZhas_attr_readonlyr( r( r* rU � s rU c C sd | dkrdS t | t�r| S z| �t�� d�}W n0 tk r^ trRtd�| ��}nt | �}Y nX |S )z� Convert a bytes (or text) path to text (unicode in Python 2) for display and logging purposes. This function should never error out. Also, this function is mainly needed for Python 2 since in Python 3 str paths are already text. N�strictzb{!r}) � isinstancer �decoderK �getfilesystemencoding�UnicodeDecodeErrorr r r? �ascii)r: r, r( r( r* �path_to_display� s rd c C st t j�t j�| ��} tjd dkrB| �t�� d�} | �t� � d�} | � t �� t jj �rpd| t t �� �d� } | S )zTGives the display value for a given path, making it relative to cwd if possible.r � �replace�.N)r9 r: �normcaser>