eaiovnaovbqoebvqoeavibavo  abc@@sdZddlmZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl mZmZmZmZmZddgZejeZd efd YZeZd efd YZd ZdS(s)Handles all VCS (version control) supporti(tabsolute_importN(tparse(t BadCommand(t display_patht backup_dirtcall_subprocesstrmtreetask_path_existstvcstget_src_requirementt VcsSupportcB@seZiZddddddgZdZdZedZed Zed Z d Z ddd Z d Z dZdZRS(tsshtgitthgtbzrtsftptsvncC@sRtjj|jttddr;tjj|jntt|j dS(Nt uses_fragment( t urllib_parset uses_netloctextendtschemestgetattrtNoneRtsuperR t__init__(tself((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyRscC@s |jjS(N(t _registryt__iter__(R((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyR$scC@st|jjS(N(tlistRtvalues(R((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pytbackends'scC@sg|jD]}|j^q S(N(Rtdirname(Rtbackend((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pytdirnames+scC@s.g}x!|jD]}|j|jqW|S(N(RRR(RRR!((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyt all_schemes/scC@sbt|ds&tjd|jdS|j|jkr^||j|js  cC@sJxC|jjD]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(RRtcontrols_locationR&R)R$R(Rtlocationtvc_type((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pytget_backend_nameFs    cC@s*|j}||jkr&|j|SdS(N(tlowerR(RR$((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyt get_backendRs cC@s&|j|}|r"|j|SdS(N(R0R2R(RR.R/((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pytget_backend_from_locationWs N(R(t __module__RRRRtpropertyRR"R#R+RR,R0R2R3(((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyR s   tVersionControlcB@seZdZdZdZddZdZdZdZ dZ dZ dZ dZ d Zd Zd Zd Zd ZdZdZdZdZeddddddZedZRS(tcO@s&||_tt|j||dS(N(turlRR6R(RR8targstkwargs((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyRgs cC@s1tjj|\}}|jtjjp0|S(sy posix absolute paths start with os.path.sep, win32 ones start with drive (like c:\folder) (tostpatht splitdrivet startswithtsep(Rtrepotdrivettail((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyt_is_local_repositorykscC@s|jddS(Nt/t_(treplace(Rtsurname((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyttranslate_egg_surnameuscC@s tdS(s Export the repository at the url to the destination location i.e. only download the files, without vcs informations N(tNotImplementedError(RR.((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pytexportysc C@sd}|jjddd}tj|\}}}}}d}d|krj|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@R7N(R8tsplitRturlsplitRtrsplitt urlunsplit( Rt error_messageR8tschemetnetlocR<tquerytfragtrev((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyt get_url_revs cC@s|j||j|fS(sA Returns (url, revision), where both are strings (tget_urlt get_revision(RR.((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pytget_infoscC@stj|jdS(si Normalize a URL for comparison by unquoting it and removing any trailing slash. RD(Rtunquotetrstrip(RR8((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyt normalize_urlscC@s|j||j|kS(sV Compare two repo URLs for identity, ignoring incidental differences. (R](Rturl1turl2((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyt compare_urlsscC@s tdS(sx Called when installing or updating an editable package, takes the source path of the checkout. N(RI(Rtdest((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pytobtainscC@s tdS(sB Switch the repo at ``dest`` to point to ``URL``. N(RI(RRaR8t rev_options((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pytswitchscC@s tdS(sO Update an already-existing repo to the given ``rev_options``. N(RI(RRaRc((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pytupdatescC@s tdS(sp Return True if the version is identical to what exists and doesn't need to be updated. N(RI(RRaRc((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyt check_versionsc C@smt}t}tjj|rAt}tjjtjj||jr|j|}|j||rt j d|j j t |||j||st jdt ||j ||j||qt jdq>t jd|j|j t ||ddf}qAt jd ||j|j d df}n|rit jd |j|td |d|d}|dkrt jd|j t ||||j|||qi|dkrqi|dkrt jdt |t|t}qi|d krJt|} t jdt || tj|| t}qi|dkritjdqin|S(s Prepare a location to receive a checkout/clone. Return True if the location is ready for (and requires) a checkout/clone, False otherwise. s)%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? %siisSwitching %s %s to %s%ss Deleting %ssBacking up %s to %stai(RgRhRiRj(RhRiRj(tTruetFalseR;R<texiststjoinR RXR`R&R)t repo_namettitleRRftinfoReR'R$RRdRRtshutiltmovetsystexit( RRaR8Rct rev_displaytcheckouttpromptt existing_urltresponsetdest_dir((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pytcheck_destinations$                  cC@s0tjj|rt|n|j|dS(sq Clean up current location and download the url repository (and vcs infos) into location N(R;R<RnRRb(RR.((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pytunpacks cC@s tdS(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(RI(RtdistR.((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyR scC@s tdS(s_ Return the url used at location Used in get_info or check_destination N(RI(RR.((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyRX)scC@s tdS(s_ Return the current revision of the files at location Used in get_info N(RI(RR.((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyRY0straisec C@su|jg|}y t|||||||SWn>tk rp}|jtjkrjtd|jqqnXdS(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 sCannot find command %rN(R$RtOSErrorterrnotENOENTR( Rtcmdt show_stdouttcwdt on_returncodet command_desct extra_environtspinnerte((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyt run_command7s   cC@sDtjd||j|jtjj||j}tjj|S(s Check if a location is controlled by the vcs. It is meant to be overridden to implement smarter detection mechanisms for specific vcs. sChecking in %s for %s (%s)...(R&R)R R$R;R<RoRn(R*R.R<((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyR-Ns (N(R(R4R$R RRRRCRHRJRWRZR]R`RbRdReRfR}R~R RXRYRlRt classmethodR-(((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyR6as2            U  cC@sztj|}|r`y|j||SWq`tk r\tjd||j|jSXntjd||jS(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)(RR3R RR&R'R$tas_requirement(RR.tversion_control((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyR [s    (t__doc__t __future__RRtloggingR;RsRutpip._vendor.six.moves.urllibRRtpip.exceptionsRt pip.utilsRRRRRt__all__t getLoggerR(R&tobjectR RR6R (((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyts     ( G