????

Your IP : 216.73.216.152


Current Path : /usr/lib/python2.7/site-packages/pip/_internal/vcs/
Upload File :
Current File : //usr/lib/python2.7/site-packages/pip/_internal/vcs/versioncontrol.pyc

�
}�\]c@@s�dZddlmZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddl
mZddlmZmZmZmZmZddlmZer+dd	lmZmZmZmZmZmZmZmZm Z dd
l!m"Z"eee#ee#fZ$ndgZ%ej&e'�Z(dd�Z*d
e+fd��YZ,de-fd��YZ.de-fd��YZ/e/�Z0de-fd��YZ1dS(s)Handles all VCS (version control) supporti(tabsolute_importN(t
pkg_resources(tparse(t
BadCommand(task_path_existst
backup_dirtcall_subprocesstdisplay_pathtrmtree(tMYPY_CHECK_RUNNING(	tAnytDicttIterabletListtMappingtOptionaltTexttTupletType(tSpinnerInterfacetvcscC@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((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pytmake_vcs_requirement_url!s
tRemoteNotFoundErrorcB@seZRS((t__name__t
__module__(((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pyR1st
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@s4|dkrg}n||_||_||_dS(s�
        Args:
          vc_class: a VersionControl subclass.
          rev: the name of the revision to install.
          extra_args: a list of extra options.
        N(tNonet
extra_argsRtvc_class(tselfR$RR#((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pyt__init__>s

			cC@sdj|jj|j�S(Ns<RevOptions {}: rev={!r}>(RR$tnameR(R%((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pyt__repr__RscC@s |jdkr|jjS|jS(N(RR"R$tdefault_arg_rev(R%((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pytarg_revUs
cC@sEg}|j}|dk	r4||jj|�7}n||j7}|S(s<
        Return the VCS-specific command arguments.
        N(R*R"R$tget_base_rev_argsR#(R%targsR((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pytto_args]s	
cC@s|js
dSdj|j�S(Nts (to revision {})(RR(R%((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pyt
to_displayjs	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.
        R#(R$tmake_rev_optionsR#(R%R((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pytmake_newqsN(RR t__doc__R"R&R(tpropertyR*R-R/R1(((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pyR!5s		
	t
VcsSupportcB@s�eZiZddddddgZd�Zd�Zed��Zed	��Zed
��Z	d�Z
d�Zd
�Zd�Z
RS(tsshtgitthgtbzrtsftptsvncC@sRtjj|j�ttdd�r;tjj|j�ntt|�j	�dS(Nt
uses_fragment(
turllib_parsetuses_netloctextendtschemestgetattrR"R;tsuperR4R&(R%((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pyR&�scC@s
|jj�S(N(t	_registryt__iter__(R%((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pyRC�scC@st|jj��S(N(tlistRBtvalues(R%((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pytbackends�scC@sg|jD]}|j^q
S(N(RFtdirname(R%tbackend((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pytdirnames�scC@s.g}x!|jD]}|j|j�qW|S(N(RFR>R?(R%R?RH((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pytall_schemes�scC@set|d�s&tjd|j�dS|j|jkra|�|j|j<tjd|j�ndS(NR'sCannot register VCS %ssRegistered VCS backend: %s(thasattrtloggertwarningRR'RBtdebug(R%tcls((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pytregister�scC@s ||jkr|j|=ndS(N(RB(R%R'((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pyt
unregister�scC@sGx@|jj�D]/}|j|�rtjd||j�|SqWdS(sv
        Return a VersionControl object if a repository of that type is found
        at the given directory.
        sDetermine that %s uses VCS: %sN(RBREtcontrols_locationRLRNR'R"(R%tlocationtvcs_backend((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pytget_backend_for_dir�s	
cC@s|j�}|jj|�S(s9
        Return a VersionControl object or None.
        (tlowerRBtget(R%R'((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pytget_backend�s(RR RBR?R&RCR3RFRIRJRPRQRURX(((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pyR4|s	
					
tVersionControlc	B@s�eZdZdZdZdZdZdZe	d��Z
e	d��Ze	d��Ze	d��Z
ed��Ze	ddd��Ze	d��Zd�Ze	d	��Ze	d
��Zed��Zd�Zed
��Ze	d��Zd�Zd�Zd�Ze	d��Zd�Zd�Ze	d��Ze	d��Z e	e!ddddddd��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{}:(RVt
startswithRR'(ROt
remote_url((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pytshould_add_vcs_url_prefix�scC@sdS(sI
        Return the path to setup.py, relative to the repo root.
        N(R"(ROtrepo_dir((s?/tmp/pip-install-ewDPok/pip/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(ROR]((s?/tmp/pip-install-ewDPok/pip/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{}+{}RN(tget_remote_urlR"R\RR'R`R^R(ROR]RRtrevisionRR((s?/tmp/pip-install-ewDPok/pip/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(R((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pyR+scC@st||d|�S(s�
        Return a RevOptions object.

        Args:
          rev: the name of a revision to install.
          extra_args: a list of extra options.
        R#(R!(RORR#((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pyR0s
cC@s7tjj|�\}}|jtjj�p6t|�S(sy
           posix absolute paths start with os.path.sep,
           win32 ones start with drive (like c:\folder)
        (tostpatht
splitdriveRZtseptbool(ROtrepotdrivettail((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pyt_is_local_repositoryscC@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(Rd(R%RSturl((s?/tmp/pip-install-ewDPok/pip/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"(ROtnetloctscheme((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pytget_netloc_and_auth*sc	C@s�tj|�\}}}}}d|krBtdj|���n|jdd�d}|j||�\}}d}d|kr�|jdd�\}}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@R.N(	R<turlsplitt
ValueErrorRtsplitRrR"trsplitt
urlunsplit(	RORnRqRpRftquerytfragt	user_passR((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pytget_url_rev_and_auth=s	cC@sgS(sM
        Return the RevOptions "extra arguments" to use in obtain().
        ((tusernametpassword((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pyt
make_rev_argsVscC@sU|j|�\}}}|\}}|j||�}|j|d|�}||fS(s�
        Return the URL and RevOptions object to use in obtain() and in
        some cases export(), as a tuple (url, rev_options).
        R#(R}R�R0(R%RnRR|R~RR#trev_options((s?/tmp/pip-install-ewDPok/pip/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<tunquotetrstrip(Rn((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pyt
normalize_urljscC@s|j|�|j|�kS(sV
        Compare two repo URLs for identity, ignoring incidental differences.
        (R�(ROturl1turl2((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pytcompare_urlssscC@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(Rd(R%tdestRnR�((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pyt	fetch_new{s	cC@s
t�dS(s}
        Switch the repo at ``dest`` to point to ``URL``.

        Args:
          rev_options: a RevOptions object.
        N(Rd(R%R�RnR�((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pytswitch�scC@s
t�dS(s�
        Update an already-existing repo to the given ``rev_options``.

        Args:
          rev_options: a RevOptions object.
        N(Rd(R%R�RnR�((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pytupdate�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(Rd(ROR�R'((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pytis_commit_id_equal�s	c	C@s�|j|�\}}tjj|�s>|j|||�dS|j�}|j|�r.|j|�}|j||�r�t	j
d|jj�t
|�|�|j||j�s�t	jdt
|�|j|�|j|||�n
t	jd�dSt	jd|j|jt
|�|�ddf}n(t	jd||j|j�ddf}t	jd
|j|�td|d|d�}|dkr�tjd�n|d	kr�t	jdt
|��t|�|j|||�dS|d
kr>t|�}t	jdt
|�|�tj||�|j|||�dS|dkr�t	jd|jt
|�||�|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?  %siitai����sDeleting %ssBacking up %s to %ssSwitching %s %s to %s%s(R�R�R�R�(R�R�R�(R�ReRftexistsR�R/tis_repository_directoryRaR�RLRNt	repo_namettitleRR�RtinfoR�RMR'RtsystexitRRtshutiltmoveR�(	R%R�RnR�trev_displaytexisting_urltprompttresponsetdest_dir((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pytobtain�s�			
	
	
	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.
        RnN(ReRfR�RR�(R%RSRn((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pytunpacks
cC@s
t�dS(s�
        Return the url used at location

        Raises RemoteNotFoundError if the repository does not have a remote
        url configured.
        N(Rd(RORS((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pyRascC@s
t�dS(sR
        Return the current commit id of the files at the given location.
        N(Rd(RORS((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pyR_straisec	
C@s�|jg|}y;t|||d|d|d|d|d|jd|�SWnGtk
r�}	|	jtjkr�td|j|jf��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
        t
on_returncodetextra_ok_returncodestcommand_desct
extra_environt
unset_environtspinnersCCannot find command %r - do you have %r installed and in your PATH?N(R'RR�tOSErrorterrnotENOENTR(
ROtcmdtshow_stdouttcwdR�R�R�R�R�te((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pytrun_commands	cC@s>tjd||j|j�tjjtjj||j��S(sL
        Return whether a directory path is a repository directory.
        sChecking in %s for %s (%s)...(RLRNRGR'ReRfR�tjoin(RORf((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pyR�Cs	cC@s
|j|�S(s6
        Check if a location is controlled by the vcs.
        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.
        (R�(RORS((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pyRRMs((N(%RR R'RGR�R?R�R"R)tclassmethodR\R^R`RctstaticmethodR+R0RmRoRrR}R�R�R�R�R�R�R�R�R�R�RaR_tTrueR�R�RR(((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pyRY�sN

			
							]	

(2R2t
__future__RR�tloggingReR�R�tpip._vendorRtpip._vendor.six.moves.urllibRR<tpip._internal.exceptionsRtpip._internal.utils.miscRRRRRtpip._internal.utils.typingR	ttypingR
RRR
RRRRRtpip._internal.utils.uiRtstrtAuthInfot__all__t	getLoggerRRLR"Rt	ExceptionRtobjectR!R4RRY(((s?/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/versioncontrol.pyt<module>s.(@	GG