U
ʗReY @ s d Z ddlZddlZddlZddlZddlZddlmZm Z m
Z
mZmZm
Z
mZmZmZmZmZ ddlmZ ddlmZmZ ddlmZmZmZmZmZmZmZm Z ddl!m"Z"m#Z#m$Z$m%Z% ddl&m'Z' erdd lm(Z( d
gZ)e*e+Z,eee- ee- f Z.e-e/ddd
Z0de-e-e-ee- e-dddZ1e-e-ee- dddZ2G dd de3Z4G dd de3Z5G dd dZ6G dd dZ7e7 Z8G dd dZ9dS )z)Handles all VCS (version control) support N)
TYPE_CHECKINGAnyDictIterableIteratorListMappingOptionalTupleTypeUnion)SpinnerInterface)
BadCommandInstallationError)
HiddenTextask_path_exists
backup_dirdisplay_pathhide_url
hide_valueis_installable_dirrmtree)CommandArgscall_subprocessformat_command_argsmake_command)get_url_scheme)Literalvcsnamereturnc C s* t | }|dkrdS |ddddgtj kS )z3
Return true if the name looks like a URL.
NFhttphttpsfileftp)r r all_schemes)r scheme r( /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/vcs/versioncontrol.pyis_url9 s r* )repo_urlrevproject_namesubdirr! c C s6 | dd}| d| d| }|r2|d| 7 }|S )z
Return the URL for a VCS requirement.
Args:
repo_url: the remote VCS url, with any needed VCS prefix (e.g. "git+").
project_name: the (unescaped) project name.
-_@z#egg=z&subdirectory=)replace)r+ r, r- r. egg_project_namereqr( r( r) make_vcs_requirement_urlC s
r5 )location repo_rootr! c C sV | }t | s6| }tj| } | |krtd| dS qtj|| rHdS tj| |S )z
Find the the Python project's root by searching up the filesystem from
`location`. Return the path to project root relative to `repo_root`.
Return None if the project root is `repo_root`, or cannot be found.
zOCould not find a Python project for directory %s (tried all parent directories)N)r ospathdirnameloggerwarningsamefilerelpath)r6 r7
orig_location
last_locationr( r( r) (find_path_to_project_root_from_repo_rootU s rA c @ s e Zd ZdS )RemoteNotFoundErrorN)__name__
__module____qualname__r( r( r( r) rB r s rB c s" e Zd Zed fddZ ZS )RemoteNotValidErrorurlc s t | || _d S N)super__init__rH )selfrH __class__r( r) rK w s zRemoteNotValidError.__init__)rC rD rE strrK
__classcell__r( r( rM r) rF v s rF c @ s e Zd ZdZded ee ee ddddZeddd Z e
ee dd
dZeddd
ZedddZ
ed dddZdS )
RevOptionsz
Encapsulates a VCS-specific revision to install, along with any VCS
install options.
Instances of this class should be treated as if immutable.
NVersionControl)vc_classr,
extra_argsr! c C s( |dkrg }|| _ || _|| _d| _dS )z
Args:
vc_class: a VersionControl subclass.
rev: the name of the revision to install.
extra_args: a list of extra options.
N)rT r, rS branch_name)rL rS r, rT r( r( r) rK s zRevOptions.__init__r! c C s d| j j d| jdS )Nz