ó •abc@@s÷dZddlmZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl mZmZmZmZmZddgZejeƒZd efd „ƒYZeƒZd 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@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_netloctextendtschemestgetattrtNoneRtsuperR t__init__(tself((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyRscC@s |jjƒS(N(t _registryt__iter__(R((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyR$scC@st|jjƒƒS(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|jƒqW|S(N(RRR(RRR!((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyt all_schemes/scC@sbt|dƒs&tjd|jƒdS|j|jkr^||j|js  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(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@sàeZdZdZdZdd„Zd„Zd„Zd„Z d„Z d„Z d„Z d„Z d „Zd „Zd „Zd „Zd „Zd„Zd„Zd„Zd„Zedddddd„Zed„ƒZRS(tcO@s&||_tt|ƒj||ŽdS(N(turlRR6R(RR8targstkwargs((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyRgs cC@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((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyt_is_local_repositorykscC@s|jddƒS(Nt/t_(treplace(Rtsurname((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyttranslate_egg_surnameuscC@s t‚dS(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@s’d}|jjddƒd}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_rev€s 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_info“scC@stj|ƒjdƒS(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_url›scC@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_urls¢scC@s t‚dS(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__.pytobtain¨scC@s t‚dS(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__.pytswitch¯scC@s t‚dS(sO Update an already-existing repo to the given ``rev_options``. N(RI(RRaRc((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pytupdateµscC@s t‚dS(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_version»sc C@smt}t}tjj|ƒrAt}tjjtjj||jƒƒr|j|ƒ}|j||ƒrât j d|j j ƒt |ƒ|ƒ|j||ƒsÒt jdt |ƒ|j |ƒ|j||ƒqt jdƒq>t jd|j|j t |ƒ|ƒddf}qAt jd ||j|j ƒd df}n|rit jd |j|ƒtd |d|dƒ}|dkr¼t jd|j t |ƒ||ƒ|j|||ƒqi|dkrËqi|dkrt jdt |ƒƒt|ƒt}qi|d krJt|ƒ} t jdt |ƒ| ƒtj|| ƒt}qi|dkritjdƒqin|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_destinationÂs‚$                  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 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(RI(RtdistR.((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyR scC@s t‚dS(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 t‚dS(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|jƒ‚qq‚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 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|jƒtjj||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 RXRYRlRŒt classmethodR-(((s4/usr/lib/python2.7/site-packages/pip/vcs/__init__.pyR6as2            U  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)(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__RR‚tloggingR;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 ú