Rec@@smdZddlmZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z ddlmZmZmZddlmZmZddlmZdd lmZmZmZmZmZmZdd lmZm Z m!Z!m"Z"dd l#m$Z$dd l%m&Z&e$rdd l'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2ddlm3Z3ddlm4Z4e.e,e5e,e5fZ6ndgZ7ej8e9Z:dZ;ddZ=ddde>dZ?dZ@deAfdYZBdeCfdYZDdeCfdYZEeEZFdeCfdYZGdS(s)Handles all VCS (version control) supporti(tabsolute_importN(t pkg_resources(tparse(t BadCommandtInstallationErrortSubProcessError(tconsole_to_strtsamefile(tsubprocess_logger(task_path_existst backup_dirt display_paththide_urlt hide_valuetrmtree(tformat_command_argst make_commandtmake_subprocess_output_errortreveal_command_args(tMYPY_CHECK_RUNNING(tget_url_scheme( tDicttIterabletIteratortListtOptionaltTexttTupletTypetUniontMappingtAny(t HiddenText(t CommandArgstvcscC@s9t|}|dkrtS|ddddgtjkS(s3 Return true if the name looks like a URL. thttpthttpstfiletftpN(RtNonetFalseR"t all_schemes(tnametscheme((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytis_url8s  cC@sDtj|}dj|||}|r@|dj|7}n|S(s 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. s {}@{}#egg={}s&subdirectory={}(Rt to_filenametformat(trepo_urltrevt project_nametsubdirtegg_project_nametreq((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytmake_vcs_requirement_urlCs c C@s|dkrg}ntj}tjj}|rC|j|nt}t|}yJt j t |dt j dt j d|} | j r| j jnWn2tk r} |rtjd| |nnXg} xbtr>d} | jr t| jj} n| sPn| j} | j| d|| qWz| jWd| jri| jjnX| jo| j|k} | r| r|rtd|d|d| d | j}tj|nd j| j|}t|nd j| S( s Args: extra_ok_returncodes: an iterable of integer return codes that are acceptable, in addition to 0. Defaults to None, which means []. log_failed_cmd: if false, failed commands are not logged, only raised. tstdouttstderrtcwds#Error %s while executing command %ss Ntcmd_argstlinest exit_statussSCommand errored out with exit status {}: {} Check the logs for full command output.t(R'RtdebugtostenvirontcopytupdatetTrueRt subprocesstPopenRtPIPEtstdintcloset ExceptiontcriticalR6Rtreadlinetrstriptappendtwaitt returncodeRterrorR.Rtjoin(tcmdR8t extra_environtextra_ok_returncodestlog_failed_cmdtlog_subprocesstenvtshowing_subprocesst command_desctproctexct all_outputtlinetproc_had_errortmsgtexc_msg((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytcall_subprocessTs`               cC@s|}x]tjjtjj|dse|}tjj|}||kr tjd|dSq Wt||rydStjj ||S(s Find the path to `setup.py` by searching up the filesystem from `location`. Return the path to `setup.py` relative to `repo_root`. Return None if `setup.py` is in `repo_root` or cannot be found. ssetup.pysGCould not find setup.py for directory %s (tried all parent directories)N( R>tpathtexistsRPtdirnametloggertwarningR'Rtrelpath(tlocationt repo_roott orig_locationt last_location((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyt!find_path_to_setup_from_repo_roots$ tRemoteNotFoundErrorcB@seZRS((t__name__t __module__(((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyRlst RevOptionscB@sPeZdZdddZdZedZdZdZ dZ RS(s Encapsulates a VCS-specific revision to install, along with any VCS install options. Instances of this class should be treated as if immutable. cC@s=|dkrg}n||_||_||_d|_dS(s Args: vc_class: a VersionControl subclass. rev: the name of the revision to install. extra_args: a list of extra options. N(R't extra_argsR0tvc_classt branch_name(tselfRqR0Rp((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyt__init__s     cC@sdj|jj|jS(Ns(R.RqR*R0(Rs((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyt__repr__scC@s |jdkr|jjS|jS(N(R0R'Rqtdefault_arg_rev(Rs((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytarg_revs cC@sEg}|j}|dk r4||jj|7}n||j7}|S(s< Return the VCS-specific command arguments. N(RwR'Rqtget_base_rev_argsRp(RstargsR0((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytto_argss    cC@s|js dSdj|jS(NR<s (to revision {})(R0R.(Rs((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyt to_displays cC@s|jj|d|jS(s Make a copy of the current instance, but with a new rev. Args: rev: the name of the revision for the new object. Rp(Rqtmake_rev_optionsRp(RsR0((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytmake_newsN( RmRnt__doc__R'RtRutpropertyRwRzR{R}(((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyRos   t VcsSupportcB@seZiZddddddgZdZdZedZed Zed Z d Z d Z d Z dZ dZRS(tsshtgitthgtbzrtsftptsvncC@sRtjj|jttddr;tjj|jntt|j dS(Nt uses_fragment( t urllib_parset uses_netloctextendtschemestgetattrR'RtsuperRRt(Rs((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyRtscC@s |jjS(N(t _registryt__iter__(Rs((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyR!scC@st|jjS(N(tlistRtvalues(Rs((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytbackends%scC@sg|jD]}|j^q S(N(RRc(Rstbackend((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytdirnames*scC@s.g}x!|jD]}|j|jqW|S(N(RRR(RsRR((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyR)/scC@set|ds&tjd|jdS|j|jkra||j|jRat splitdriveRtseptbool(Rtrepotdrivettail((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyt_is_local_repositoryscC@s tdS(s Export the repository at the url to the destination location i.e. only download the files, without vcs informations :param url: the repository URL starting with a vcs prefix. N(R(RsRgR((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytexportscC@s |dfS(sZ Parse the repository URL's netloc, and return the new netloc to use along with auth information. Args: netloc: the original repository URL netloc. scheme: the repository URL's scheme without the vcs prefix. This is mainly for the Subversion class to override, so that auth information can be provided via the --username and --password options instead of through the URL. For other subclasses like Git without such an option, auth information must stay in the URL. Returns: (netloc, (username, password)). N(NN(R'(RtnetlocR+((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytget_netloc_and_authsc C@stj|\}}}}}d|krBtdj|n|jddd}|j||\}}d}d|kr|jdd\}}|stdj|qntj ||||df}|||fS(s Parse the repository URL to use, and return the URL, revision, and auth info to use. Returns: (url, rev, (username, password)). t+svSorry, {!r} is a malformed VCS url. The format is +://, e.g. svn+http://myrepo/svn/MyApp#egg=MyAppit@syThe URL {!r} has an empty revision (after @) which is not supported. Include a revision after @ or remove @ from the URL.R<N( Rturlsplitt ValueErrorR.tsplitRR'trsplitRt urlunsplit( RRR+RRatquerytfragt user_passR0((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytget_url_rev_and_auths   cC@sgS(sM Return the RevOptions "extra arguments" to use in obtain(). ((tusernametpassword((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyt make_rev_args sc C@s|j|j\}}}|\}}d}|dk rHt|}n|j||}|j|d|} t|| fS(s Return the URL and RevOptions object to use in obtain() and in some cases export(), as a tuple (url, rev_options). RpN(RtsecretR'R RR|R ( RsRt secret_urlR0RRtsecret_passwordRRpt rev_options((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytget_url_rev_options(s  cC@stj|jdS(si Normalize a URL for comparison by unquoting it and removing any trailing slash. t/(RtunquoteRK(R((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyt normalize_url8scC@s|j||j|kS(sV Compare two repo URLs for identity, ignoring incidental differences. (R(Rturl1turl2((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyt compare_urlsAscC@s tdS(s Fetch a revision from a repository, in the case that this is the first fetch from the repository. Args: dest: the directory to fetch the repository to. rev_options: a RevOptions object. N(R(RsRRR((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyt fetch_newIs cC@s tdS(s} Switch the repo at ``dest`` to point to ``URL``. Args: rev_options: a RevOptions object. N(R(RsRRR((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytswitchUscC@s tdS(s Update an already-existing repo to the given ``rev_options``. Args: rev_options: a RevOptions object. N(R(RsRRR((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyRA_scC@s tdS(s Return whether the id of the current commit equals the given name. Args: dest: the repository directory. name: a string name. N(R(RRR*((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytis_commit_id_equalis c C@s|j|\}}tjj|s>|j|||dS|j}|j|r1|j|}|j||j rt j d|j j t|||j||jst jdt||j ||j|||n t jddSt jd|j|j t||ddf}n(t jd ||j|j d df}t jd |j|tdj|d|d}|dkrtjdn|d krt jdt|t||j|||dS|d krFt|}t jdt||tj|||j|||dS|dkrt jd|j t||||j|||ndS(s Install or update in editable mode the package represented by this VersionControl object. :param dest: the repository directory in which to install or update. :param url: the repository URL starting with a vcs prefix. Ns)%s in %s exists, and has correct URL (%s)sUpdating %s %s%ss$Skipping because already up-to-date.s%s %s in %s exists with URL %ss%(s)witch, (i)gnore, (w)ipe, (b)ackup tstitwtbs0Directory %s already exists, and is not a %s %s.s(i)gnore, (w)ipe, (b)ackup s+The plan is to install the %s repository %ssWhat to do? {}iitais Deleting %ssBacking up %s to %ssSwitching %s %s to %s%s(RRRR(RRR(RR>RaRbRR{tis_repository_directoryRRRRdR=t repo_namettitleR RR0tinfoRAReR*R R.tsystexitRR tshutiltmoveR( RsRRRt rev_displayt existing_urltprompttresponsetdest_dir((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytobtainus                  cC@s6tjj|rt|n|j|d|dS(s Clean up current location and download the url repository (and vcs infos) into location :param url: the repository URL starting with a vcs prefix. RN(R>RaRbRR(RsRgR((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytunpacks cC@s tdS(s Return the url used at location Raises RemoteNotFoundError if the repository does not have a remote url configured. N(R(RRg((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyRs cC@s tdS(sR Return the current commit id of the files at the given location. N(R(RRg((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyRsc C@st|j|}y#t||d|d|d|SWnCtk rz}|jtjkrttdjtq{nXdS(s Run a VCS subcommand This is simply a wrapper around call_subprocess that adds the VCS command name, and checks that the VCS is available RRRSRTsWCannot find command {cls.name!r} - do you have {cls.name!r} installed and in your PATH?N( RR*R`tOSErrorterrnotENOENTRR.tlocals(RRQR8RRRSRTte((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyt run_commands  cC@s>tjd||j|jtjjtjj||jS(sL Return whether a directory path is a repository directory. sChecking in %s for %s (%s)...(RdR=RcR*R>RaRbRP(RRa((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyRs cC@s|j|r|SdS(sy Return the "root" (top-level) directory controlled by the vcs, or `None` if the directory is not in any. It is meant to be overridden to implement smarter detection mechanisms for specific vcs. This can do more than is_repository_directory() alone. For example, the Git override checks that Git is actually available. N(RR'(RRg((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyRs ((N(&RmRnR*RcRRt unset_environR'Rvt classmethodRRRRt staticmethodRxRR|RRRRRRRRRRRARRRRRRBRRR(((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyRtsJ         ^   (HR~t __future__RRtloggingR>RRCRt pip._vendorRtpip._vendor.six.moves.urllibRRtpip._internal.exceptionsRRRtpip._internal.utils.compatRRtpip._internal.utils.loggingRtpip._internal.utils.miscR R R R R Rtpip._internal.utils.subprocessRRRRtpip._internal.utils.typingRtpip._internal.utils.urlsRttypingRRRRRRRRRRRR R!tstrtAuthInfot__all__t getLoggerRmRdR,R'R5RBR`RkRHRltobjectRoRR"R(((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytsF      ."L   Q I^