ok

Mini Shell

Direktori : /opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/
Upload File :
Current File : //opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyo

�
x�_c@@smdZddlmZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZ
ddlmZmZmZddlmZmZddlmZdd	lmZmZmZmZmZmZdd
lmZm Z m!Z!m"Z"ddl#m$Z$ddl%m&Z&e$r�dd
l'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2ddlm3Z3ddlm4Z4e.e,e5e,e5fZ6ndgZ7ej8e9�Z:d�Z;dd�Z=ddde>d�Z?d�Z@deAfd��YZBdeCfd��YZDdeCfd��YZEeE�ZFdeCfd��YZGdS(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(tCommandArgstvcscC@s9t|�}|dkrtS|ddddgtjkS(s3
    Return true if the name looks like a URL.
    thttpthttpstfiletftpN(RtNonetFalseR"tall_schemes(tnametscheme((sQ/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={}(Rtto_filenametformat(trepo_urltrevtproject_nametsubdirtegg_project_nametreq((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytmake_vcs_requirement_urlCs
	cC@s�|dkrg}ntj}tjj�}|rC|j|�nt}t|�}yJt	j
t|�dt	jdt	jd|�}	|	j
r�|	j
j�nWn2tk
r�}
|r�tjd|
|�n�nXg}xbtr>d}|	jr
t|	jj��}n|sPn|j�}|j|d�||�q�Wz|	j�Wd|	jri|	jj�nX|	jo|	j|k}
|
r�|r�|r�td|d|d|d	|	j�}tj|�nd
j|	j|�}t|��ndj|�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_argstlinestexit_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((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytcall_subprocessTs`									
cC@s�|}x]tjjtjj|d��se|}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((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyt!find_path_to_setup_from_repo_root�s$tRemoteNotFoundErrorcB@seZRS((t__name__t
__module__(((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyRl�st
RevOptionscB@sPeZdZddd�Zd�Zed��Zd�Zd�Z	d�Z
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_classtbranch_name(tselfRqR0Rp((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyt__init__�s
				cC@sdj|jj|j�S(Ns<RevOptions {}: rev={!r}>(R.RqR*R0(Rs((sQ/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((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytarg_rev�s
cC@sEg}|j}|dk	r4||jj|�7}n||j7}|S(s<
        Return the VCS-specific command arguments.
        N(RwR'Rqtget_base_rev_argsRp(RstargsR0((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytto_args�s	
cC@s|js
dSdj|j�S(NR<s (to revision {})(R0R.(Rs((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyt
to_displays	cC@s|jj|d|j�S(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((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytmake_newsN(RmRnt__doc__R'RtRutpropertyRwRzR{R}(((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyRo�s		
	t
VcsSupportcB@s�eZiZddddddgZd�Zd�Zed��Zed	��Zed
��Z	d�Z
d�Zd
�Zd�Z
d�ZRS(tsshtgitthgtbzrtsftptsvncC@sRtjj|j�ttdd�r;tjj|j�ntt|�j	�dS(Nt
uses_fragment(
turllib_parsetuses_netloctextendtschemestgetattrR'R�tsuperR�Rt(Rs((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyRtscC@s
|jj�S(N(t	_registryt__iter__(Rs((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyR�!scC@st|jj��S(N(tlistR�tvalues(Rs((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytbackends%scC@sg|jD]}|j^q
S(N(R�Rc(Rstbackend((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytdirnames*scC@s.g}x!|jD]}|j|j�qW|S(N(R�R�R�(RsR�R�((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyR)/scC@set|d�s&tjd|j�dS|j|jkra|�|j|j<tjd|j�ndS(NR*sCannot register VCS %ssRegistered VCS backend: %s(thasattrRdReRmR*R�R=(Rstcls((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytregister7scC@s ||jkr|j|=ndS(N(R�(RsR*((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyt
unregister@scC@si}xR|jj�D]A}|j|�}|s7qntjd||j�|||<qW|sedSt|dt�}||S(sv
        Return a VersionControl object if a repository of that type is found
        at the given directory.
        sDetermine that %s uses VCS: %stkeyN(	R�R�tget_repository_rootRdR=R*R'tmaxtlen(RsRgtvcs_backendstvcs_backendt	repo_pathtinner_most_repo_path((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytget_backend_for_dirEs	
cC@s1x*|jj�D]}||jkr|SqWdS(s9
        Return a VersionControl object or None.
        N(R�R�R�R'(RsR+R�((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytget_backend_for_scheme^scC@s|j�}|jj|�S(s9
        Return a VersionControl object or None.
        (tlowerR�tget(RsR*((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytget_backendhs(RmRnR�R�RtR�RR�R�R)R�R�R�R�R�(((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyR�s	
						
tVersionControlcB@s�eZdZdZdZdZdZdZe	d��Z
e	d��Ze	d��Ze	d��Z
ed��Zd�Ze	ddd��Ze	d��Zd	�Ze	d
��Ze	d��Zed��Zd
�Zed��Ze	d��Zd�Zd�Zd�Ze	d��Zd�Zd�Ze	d��Z e	d��Z!e	ddde"d��Z#e	d��Z$e	d��Z%RS(R<cC@s |j�jdj|j��S(s�
        Return whether the vcs prefix (e.g. "git+") should be added to a
        repository's remote url when used in a requirement.
        s{}:(R�t
startswithR.R*(R�t
remote_url((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytshould_add_vcs_url_prefix~scC@sdS(s~
        Return the path to setup.py, relative to the repo root.
        Return None if setup.py is in the repo root.
        N(R'(R�Rg((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytget_subdirectory�scC@s
|j|�S(sR
        Return the revision string that should be used in a requirement.
        (tget_revision(R�trepo_dir((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytget_requirement_revision�scC@s�|j|�}|dkrdS|j|�rFdj|j|�}n|j|�}|j|�}t|||d|�}|S(sC
        Return the requirement string to use to redownload the files
        currently at the given repository directory.

        Args:
          project_name: the (unescaped) project name.

        The return value has a form similar to the following:

            {repository_url}@{revision}#egg={project_name}
        s{}+{}R2N(tget_remote_urlR'R�R.R*R�R�R5(R�R�R1R/trevisionR2R4((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytget_src_requirement�s	cC@s
t�dS(s�
        Return the base revision arguments for a vcs command.

        Args:
          rev: the name of a revision to install.  Cannot be None.
        N(tNotImplementedError(R0((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyRx�s	cC@stS(sZ
        Return true if the commit hash checked out at dest matches
        the revision in url.

        Always return False, if the VCS does not support immutable commit
        hashes.

        This method does not check if there are local uncommitted changes
        in dest after checkout, as pip currently has no use case for that.
        (R((Rsturltdest((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytis_immutable_rev_checkout�scC@st||d|�S(s�
        Return a RevOptions object.

        Args:
          rev: the name of a revision to install.
          extra_args: a list of extra options.
        Rp(Ro(R�R0Rp((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyR|�s
cC@s7tjj|�\}}|jtjj�p6t|�S(sy
           posix absolute paths start with os.path.sep,
           win32 ones start with drive (like c:\folder)
        (R>Rat
splitdriveR�tseptbool(R�trepotdrivettail((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyt_is_local_repository�scC@s
t�dS(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�((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytexport�scC@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'(R�tnetlocR+((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytget_netloc_and_auth�sc	C@s�tj|�\}}}}}d|krBtdj|���n|jdd�d}|j||�\}}d}d|kr�|jdd�\}}|s�tdj|���q�ntj	||||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 <vcs>+<protocol>://<url>, 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(
R�turlsplitt
ValueErrorR.tsplitR�R'trsplitRt
urlunsplit(	R�R�R+R�Ratquerytfragt	user_passR0((sQ/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((sQ/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(R�tsecretR'R
R�R|R(
RsR�t
secret_urlR0R�R�tsecret_passwordR�Rptrev_options((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytget_url_rev_options(scC@stj|�jd�S(si
        Normalize a URL for comparison by unquoting it and removing any
        trailing slash.
        t/(R�tunquoteRK(R�((sQ/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�(R�turl1turl2((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytcompare_urlsAscC@s
t�dS(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�(RsR�R�R�((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyt	fetch_newIs
cC@s
t�dS(s}
        Switch the repo at ``dest`` to point to ``URL``.

        Args:
          rev_options: a RevOptions object.
        N(R�(RsR�R�R�((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytswitchUscC@s
t�dS(s�
        Update an already-existing repo to the given ``rev_options``.

        Args:
          rev_options: a RevOptions object.
        N(R�(RsR�R�R�((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyRA_scC@s
t�dS(s�
        Return whether the id of the current commit equals the given name.

        Args:
          dest: the repository directory.
          name: a string name.
        N(R�(R�R�R*((sQ/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	�r�t
jd|jj
�t|�|�|j||j�s�t
jdt|�|j|�|j|||�n
t
jd�dSt
jd|j|jt|�|�ddf}n(t
jd||j|j�ddf}t
jd
|j|�tdj|d�|d�}|dkr�tjd�n|d	kr�t
jdt|��t|�|j|||�dS|d
krFt|�}t
jdt|�|�tj||�|j|||�dS|dkr�t
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?  {}iitai����sDeleting %ssBacking up %s to %ssSwitching %s %s to %s%s(R�R�R�R�(R�R�R�(R�R>RaRbR�R{tis_repository_directoryR�R�R�RdR=t	repo_namettitleRR�R0tinfoRAReR*R	R.tsystexitRR
tshutiltmoveR�(	RsR�R�R�trev_displaytexisting_urltprompttresponsetdest_dir((sQ/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.
        R�N(R>RaRbRR�(RsRgR�((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytunpack�s
cC@s
t�dS(s�
        Return the url used at location

        Raises RemoteNotFoundError if the repository does not have a remote
        url configured.
        N(R�(R�Rg((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyR��s	cC@s
t�dS(sR
        Return the current commit id of the files at the given location.
        N(R�(R�Rg((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyR��sc	C@st|j|�}y#t||d|d|d|�SWnCtk
rz}|jtjkrttdjt����q{�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(R�RQR8RRRSRTte((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pytrun_command�scC@s>tjd||j|j�tjjtjj||j��S(sL
        Return whether a directory path is a repository directory.
        sChecking in %s for %s (%s)...(RdR=RcR*R>RaRbRP(R�Ra((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyR�s	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(R�R'(R�Rg((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyR�s
((N(&RmRnR*RcR�R�t
unset_environR'RvtclassmethodR�R�R�R�tstaticmethodRxR�R|R�R�R�R�R�R�R�R�R�R�RAR�R�R�R�R�RBR�R�R�(((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyR�tsJ			
	
				
	
	^	
(HR~t
__future__RR�tloggingR>R�RCR�tpip._vendorRtpip._vendor.six.moves.urllibRR�tpip._internal.exceptionsRRRtpip._internal.utils.compatRRtpip._internal.utils.loggingRtpip._internal.utils.miscR	R
RRR
Rtpip._internal.utils.subprocessRRRRtpip._internal.utils.typingRtpip._internal.utils.urlsRttypingRRRRRRRRRRRR R!tstrtAuthInfot__all__t	getLoggerRmRdR,R'R5RBR`RkRHRltobjectRoR�R"R�(((sQ/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyt<module>sF."L		Q	I^	

Zerion Mini Shell 1.0