관리-도구
편집 파일: generate_metadata.cpython-38.opt-1.pyc
U ��.e[ � @ s� d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl m Z ddlmZ ddl mZ er|dd lmZmZ dd lmZ e�e�Zdd� Zd d� Zdd� Zdd� ZdS )z4Metadata generation logic for source distributions. � N)�InstallationError)� ensure_dir)�make_setuptools_shim_args)�call_subprocess)�MYPY_CHECK_RUNNING)�vcs)�Callable�List)�InstallRequirementc C s | j s tS tS )a Return a callable metadata generator for this InstallRequirement. A metadata generator takes an InstallRequirement (install_req) as an input, generates metadata via the appropriate process for that install_req and returns the generated metadata directory. )Z use_pep517�_generate_metadata_legacy�_generate_metadata��install_req� r �N/usr/lib/python3.8/site-packages/pip/_internal/operations/generate_metadata.py�get_metadata_generator s r c s� dd� � � fdd�}dd� }| }|r.||�}nt j�|d�}t �|�}|sVtd| ��t|�d krn|j|d � t j�||d �S )zEFind an .egg-info in `source_directory`, based on `is_editable`. c S s0 t j�t j�| dd��p.t j�t j�| dd��S )N�bin�pythonZScriptsz Python.exe)�os�path�lexists�join�exists)r r r r �looks_like_virtual_env( s �z._find_egg_info.<locals>.looks_like_virtual_envc s� g }t �| �D ]�\� }}tjD ]}||kr|�|� qt|�D ]<}�t j�� |��r`|�|� q>|dksp|dkr>|�|� q>|�� fdd�|D �� qdd� |D �S )NZtestZtestsc 3 s | ]}t j�� |�V qd S �N)r r r )�.0�dir_��rootr r � <genexpr>? s zC_find_egg_info.<locals>.locate_editable_egg_info.<locals>.<genexpr>c S s g | ]}|� d �r|�qS )z .egg-info)�endswith)r �fr r r � <listcomp>@ s zD_find_egg_info.<locals>.locate_editable_egg_info.<locals>.<listcomp>) r �walkr Zdirnames�remove�listr r �extend)�baseZ candidates�dirs�filesr �r r r �locate_editable_egg_info/ s z0_find_egg_info.<locals>.locate_editable_egg_infoc S s( | � tjj�tjjr"| � tjj�p$d S )Nr )�countr r �sep�altsep)r r r r �depth_of_directoryB s ��z*_find_egg_info.<locals>.depth_of_directory�pip-egg-infoz!Files/directories not found in %s� )�keyr )r r r �listdirr �len�sort)Zsource_directoryZis_editabler+ r/ r'