XylotrechusZ
U
��.e48 � @ s� d Z ddlZddlZddlZddlmZ ddlmZmZ ddl m
Z
ddlmZm
Z
ddlmZ ddlmZmZ dd lmZ dd
lmZ ddlmZ ddlmZ dd
lmZmZ ddlmZ ddl m!Z! ddl"m#Z#m$Z$ ddl%m&Z& e�rddl'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z- ddl.m/Z/ dddgZ0e�1e2�Z3e
j4�5� Z6dd� Z7dd� Z8dd� Z9dd� Z:dd� Z;G d d!� d!e<�Z=d"d#� Z>d/d%d�Z?d&d'� Z@d(d)� ZAd*d+� ZBd0d,d�ZCd1d-d.�ZDdS )2a~ Backing implementation for InstallRequirement's various constructors
The idea here is that these formed a major chunk of InstallRequirement's size
so, moving them and support code dedicated to them outside of that class
helps creates for better understandability for the rest of the code.
These are meant to be used elsewhere within pip to create instances of
InstallRequirement.
� N)�Marker)�InvalidRequirement�Requirement)� Specifier)�RequirementParseError�parse_requirements)�InstallationError)�PyPI�TestPyPI)�Link)�make_pyproject_path)�InstallRequirement)�ARCHIVE_EXTENSIONS)�is_installable_dir�splitext)�MYPY_CHECK_RUNNING)�path_to_url)�is_url�vcs)�Wheel)�Any�Dict�Optional�Set�Tuple�Union)�
WheelCache�install_req_from_editable�install_req_from_line�parse_editablec C s t | �d �� }|tkrdS dS )z9Return True if `name` is a considered as an archive file.� TF)r �lowerr )�nameZext� r# �B/usr/lib/python3.8/site-packages/pip/_internal/req/constructors.py�is_archive_file4 s r% c C s6 t �d| �}d }|r*|�d�}|�d�}n| }||fS )Nz^(.+)(\[[^\]]+\])$r � )�re�match�group)�path�m�extrasZpath_no_extrasr# r# r$ �
_strip_extras= s
r- c C s | s
t � S td| �� �jS )N�placeholder)�setr r! r, )r, r# r# r$ �convert_extrasJ s r0 c
C s` | }t |�\}}tj�|�rptj�tj�|d��shd�tj�|��}t|�}tj� |�r`|d7 }t
|��t|�}|�� �
d�r�t|�j}|r�||td|�� �jfS ||dfS tD ]&}|�� �
d| �r�d||f } q�q�d |kr�t
d
�| ���|�d d�d �� }t�|��s:d
| d�dd� tjD �� d } t
| ��t|�j}|�sVt
d| ��||dfS )a Parses an editable requirement into:
- a requirement name
- an URL
- extras
- editable options
Accepted requirements:
svn+http://blahblah@rev#egg=Foobar[baz]&subdirectory=version_subdir
.[some_extra]
zsetup.pyzMFile "setup.py" not found. Directory cannot be installed in editable mode: {}zb
(A "pyproject.toml" file was found, but editable mode currently requires a setup.py based build.)zfile:r. Nz%s:z%s+%s�+z�{} is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with svn+, git+, hg+, or bzr+).r r zFor --editable=%s only z, c S s g | ]}|j d �qS )z+URL�r"