ó â\e[c@@sRdZddlmZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl mZmZmZmZmZddlmZerßddlmZmZmZdd lmZnd d gZejeƒZd efd „ƒYZ defd„ƒYZ!e!ƒZ"defd„ƒYZ#d„Z$dS(s)Handles all VCS (version control) supporti(tabsolute_importN(tparse(t BadCommand(t display_patht backup_dirtcall_subprocesstrmtreetask_path_exists(tMYPY_CHECK_RUNNING(tDicttOptionaltTuple(tCommandtvcstget_src_requirementt 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: vcs: a VersionControl object. rev: the name of the revision to install. extra_args: a list of extra options. N(tNonet extra_argstrevR (tselfR RR((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyt__init__%s     cC@sdj|jj|jƒS(Ns(tformatR tnameR(R((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyt__repr__3scC@s |jdkr|jjS|jS(N(RRR tdefault_arg_rev(R((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pytarg_rev6s cC@sEg}|j}|dk r4||jj|ƒ7}n||j7}|S(s< Return the VCS-specific command arguments. N(RRR tget_base_rev_argsR(RtargsR((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pytto_args=s    cC@s|js dSdj|jƒS(Nts (to revision {})(RR(R((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyt to_displayIs 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(RR((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pytmake_newOsN( t__name__t __module__t__doc__RRRtpropertyRRRR (((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyRs  t VcsSupportcB@s˜eZiZddddddgZd„Zd„Zed„ƒZed „ƒZed „ƒZ d „Z ddd „Z d „Z d„Zd„ZRS(tsshtgitthgtbzrtsftptsvncC@sRtjj|jƒttddƒr;tjj|jƒntt|ƒj ƒdS(Nt uses_fragment( t urllib_parset uses_netloctextendtschemestgetattrRR,tsuperR%R(R((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyR]scC@s |jjƒS(N(t _registryt__iter__(R((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyR4fscC@st|jjƒƒS(N(tlistR3tvalues(R((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pytbackendsiscC@sg|jD]}|j^q S(N(R7tdirname(Rtbackend((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pytdirnamesmscC@s.g}x!|jD]}|j|jƒqW|S(N(R7R/R0(RR0R9((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyt all_schemesqscC@sbt|dƒs&tjd|jƒdS|j|jkr^||j|j(RR@R((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyt unregister€s  cC@sJxC|jjƒD]2}|j|ƒrtjd||jƒ|jSqWdS(s— Return the name of the version control backend if found at given location, e.g. vcs.get_backend_name('/path/to/vcs/checkout') sDetermine that %s uses VCS: %sN(R3R6tcontrols_locationR=R?RR(Rtlocationtvc_type((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pytget_backend_nameˆs    cC@s*|jƒ}||jkr&|j|SdS(N(tlowerR3(RR((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyt get_backend”s cC@s&|j|ƒ}|r"|j|ƒSdS(N(RFRHR(RRDRE((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pytget_backend_from_location™s N(R!R"R3R0RR4R$R7R:R;RARRBRFRHRI(((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyR%Ys   tVersionControlcB@s%eZdZdZdZdZdZdd„Zd„Z ddd„Z d„Z d„Z d„Z d„Zd„Zd „Zd „Zd „Zd „Zd „Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zedddddd„Zed„ƒZ ed„ƒZ!RS(RcO@s&||_tt|ƒj||ŽdS(N(turlR2RJR(RRKRtkwargs((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyR¬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(RR((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.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(RRR((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyR¹scC@s1tjj|ƒ\}}|jtjjƒp0|S(sy posix absolute paths start with os.path.sep, win32 ones start with drive (like c:\folder) (tostpatht splitdrivet startswithtsep(Rtrepotdrivettail((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyt_is_local_repositoryÃscC@s|jddƒS(Nt/t_(treplace(Rtsurname((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyttranslate_egg_surnameÍscC@s t‚dS(s Export the repository at the url to the destination location i.e. only download the files, without vcs informations N(RM(RRD((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pytexportÑsc C@s«d}d|ks"t||ƒ‚|jddƒd}tj|ƒ\}}}}}d}d|krƒ|jddƒ\}}ntj||||dfƒ}||fS(sm Returns the correct repository URL and revision by parsing the given repository URL svSorry, '%s' is a malformed VCS url. The format is +://, e.g. svn+http://myrepo/svn/MyApp#egg=MyAppt+it@RN(tAssertionErrortsplitR-turlsplitRtrsplitt urlunsplit( RRKt error_messagetschemetnetlocROtquerytfragR((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyt get_url_revØs cC@s |gfS(s{ Return the URL and RevOptions "extra arguments" to use in obtain(), as a tuple (url, extra_args). ((RRK((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pytget_url_rev_argsëscC@sI|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(RiRjR(RRKRRt rev_options((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pytget_url_rev_optionsòscC@sH|jdƒj|jƒ s,td|ƒ‚|j|ƒ|j|ƒfS(sA Returns (url, revision), where both are strings RWsBad directory: %s(trstriptendswithR8R_tget_urlt get_revision(RRD((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pytget_infoýs cC@stj|ƒjdƒS(si Normalize a URL for comparison by unquoting it and removing any trailing slash. RW(R-tunquoteRm(RRK((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyt normalize_urlscC@s|j|ƒ|j|ƒkS(sV Compare two repo URLs for identity, ignoring incidental differences. (Rs(Rturl1turl2((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyt compare_urls scC@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(RM(RtdestRKRk((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyt fetch_news cC@s t‚dS(s} Switch the repo at ``dest`` to point to ``URL``. Args: rev_options: a RevOptions object. N(RM(RRwRKRk((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pytswitchscC@s t‚dS(sŠ Update an already-existing repo to the given ``rev_options``. Args: rev_options: a RevOptions object. N(RM(RRwRk((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.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(RM(RRwR((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pytis_commit_id_equal/sc C@s†|j|jƒ\}}tjj|ƒsA|j|||ƒdS|jƒ}|j|ƒr.|j|ƒ}|j ||ƒrút j d|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|ƒtd|d|dƒ}|dkr£tjdƒn|d kræt jdt|ƒƒt|ƒ|j|||ƒdS|d kr>t|ƒ}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. Args: dest: the repository directory in which to install or update. 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ÿÿÿÿs Deleting %ssBacking up %s to %ssSwitching %s %s to %s%s(R|R}R~R(R}R~R(RlRKRNROtexistsRxRtis_repository_directoryRoRvR=R?t repo_namettitleRR{RtinfoRzR>RRtsystexitRRtshutiltmoveRy( RRwRKRkt rev_displayt existing_urltprompttresponsetdest_dir((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pytobtain9s~                cC@s0tjj|ƒrt|ƒn|j|ƒdS(sq Clean up current location and download the url repository (and vcs infos) into location N(RNRORRR(RRD((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pytunpack“s cC@s t‚dS(sê Return a string representing the requirement needed to redownload the files currently present in location, something like: {repository_url}@{revision}#egg={project_name}-{version_identifier} N(RM(RtdistRD((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyRœscC@s t‚dS(sc Return the url used at location This is used in get_info() and obtain(). N(RM(RRD((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyRo¥scC@s t‚dS(sR Return the current commit id of the files at the given location. N(RM(RRD((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyRp­straisec C@sŠ|jg|}y,t||||||d|jd|ƒSWnGtk r…}|jtjkrtd|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 unset_environtspinnersCCannot find command %r - do you have %r installed and in your PATH?N(RRR“tOSErrorterrnotENOENTR( Rtcmdt show_stdouttcwdt on_returncodet command_desct extra_environR”te((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyt run_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)...(R=R?R8RRNRORtjoin(R@RO((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyR‚Îs 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‚(R@RD((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyRC×s ((N("R!R"RR8R0R“RRRRRRVR[R\RiRjRlRqRsRvRxRyRzR{RRRRoRptTrueRŸt classmethodR‚RC(((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyRJ£s@          Z   cC@sztj|ƒ}|r`y|ƒj||ƒSWq`tk r\tjd||jƒ|jƒSXntjd|ƒ|jƒS(NsPcannot determine version of editable source in %s (%s command not found in path)stcannot determine version of editable source in %s (is not SVN checkout, Git clone, Mercurial clone or Bazaar branch)(R RIRRR=R>Rtas_requirement(R‘RDtversion_control((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyRäs    (%R#t __future__RR–tloggingRNRˆR†tpip._vendor.six.moves.urllibRR-tpip._internal.exceptionsRtpip._internal.utils.miscRRRRRtpip._internal.utils.typingRttypingR R R tpip._internal.basecommandR t__all__t getLoggerR!R=tobjectRR%R RJR(((s9/tmp/pip-install-0xiv62/pip/pip/_internal/vcs/__init__.pyts*     ( =G ÿB