Qc@sdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl Tddl mZddlmZddlmZmZmZmZmZmZmZmZmZmZmZmZddlmZdd lm Z dd l!m"Z"dd l!m#Z#dd l$m%Z%ej&d Z'ej&dej(Z)ej&dZ*ej&dej(j+Z,dj-Z.ddddgZ/dZ0dZ1dZ2e3dZ4e3dZ5e3dZ6e3e7e3dZ8e3dZ9dZ:ej&dej(Z;e:d Z<d!ej=d" e>d#d$j=fZ?d%e@fd&YZAd'eAfd(YZBdeCfd)YZDej&d*jEZFd+ZGd,ZHd-ZIdd.ZJd/ZKejLd0ZMeJe0eMZMd1ZNd2ZOdS(3s#PyPI and direct package downloadingiN(t ssl_support(t*(tlog(tDistutilsError( turllib2thttplibtStringIOt HTTPErrorturlparset urlunparsetunquotet splitusert url2pathnametname2codepointtunichrturljoin(t filterfalse(t translate(thashlib(twraps(tget_all_headerss^egg=([-A-Za-z0-9_.]+)$shref\s*=\s*['"]?([^'"> ]+)s([^<]+) \s+\(md5\)s([-+.a-z0-9]{2,}):s.tar.gz .tar.bz2 .tar .zip .tgzt PackageIndextdistros_for_urltparse_bdist_wininsttinterpret_distro_nameicCs|j}d\}}}|jdr|jdrL|d }d}q|jddr~|dd!}|d }d}q|jd r|d }d }q|jd d r|dd!}|d }d }qn|||fS(s=Return (base,pyversion) or (None,None) for possible .exe names.exes .win32.exeitwin32s .win32-pyiiis.win-amd64.exeis win-amd64s .win-amd64-pyiN(NNN(tlowertNonetendswitht startswith(tnameRtbasetpy_vertplat((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyR$s$           cCst|\}}}}}}t|jdd}|dkrk|dkrkt|jdd}nd|kr|jdd\}}n||fS(Nt/issourceforge.nettdownloadit#i(RR tsplit(turltschemetservertpatht parameterstquerytfragmentR((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pytegg_info_for_url<s ccst|\}}xt|||D] }|Vq%W|rtj|}|rx1t||jd|dtD] }|VqqWqndS(sEYield egg or source distribution objects that might be found at a URLit precedenceN(R-tdistros_for_locationt EGG_FRAGMENTtmatchRtgroupt CHECKOUT_DIST(R&tmetadataRR,tdistR1((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRDs "cCs|jdr|d }n|jdrMd|krMtj|||gS|jdrt|\}}}|dk rt||||t|Snx>tD]6}|j|r|t| }t|||SqWgS(s:Yield egg or source distribution objects based on basenames.egg.zipis.eggt-s.exeN( Rt Distributiont from_locationRRRt BINARY_DISTt EXTENSIONStlen(tlocationtbasenameR4twin_baseR tplatformtext((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyR/Ps   cCs"tt|tjj||S(sEYield possible egg or source distribution objects based on a filename(R/tnormalize_pathtosR)R=(tfilenameR4((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pytdistros_for_filenameesc cs|jd}|s^xFt|dD]1\}}t|dkr&|jdr&dSq&Wnxatdt|dD]F}t||dj|| dj||d|d|d |VqxWdS( sGenerate alternative interpretations of a source distro name Note: if `location` is a filesystem filename, you should call ``pkg_resources.normalize_path()`` on it before passing it to this routine! R6iispy2.Nit py_versionR.R?(R%t enumerateR;RtrangeR7tjoin( R<R=R4RER.R?tpartstitp((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRls!  ) ccst}|j}|dkrMxgt|j|D]}|||Vq1Wn;x8|D]0}||}||krT|||VqTqTWdS(sHList unique elements, preserving order. Remember all elements ever seen.N(tsettaddRRt __contains__(titerabletkeytseentseen_addtelementtk((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pytunique_everseens         cstfd}|S(ss Wrap a function returning an iterable such that the resulting iterable only ever yields unique items. cst||S(N(RU(targstkwargs(tfunc(s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pytwrappers(R(RXRY((RXs>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyt unique_valuesss(<([^>]*\srel\s*=\s*['"]?([^'">]+)[^>]*)>ccsxtj|D]}|j\}}tttj|jjd}d|ksgd|krx7t j|D]#}t |t |j dVqwWqqWxdd D]\}|j |}|dkrt j||}|rt |t |j dVqqqWdS( sEFind rel="homepage" and rel="download" links in `page`, yielding URLst,thomepageR#is Home PagesDownload URLiN(s Home PagesDownload URL(tRELtfinditertgroupsRLtmaptstrtstripRR%tHREFRt htmldecodeR2tfindtsearch(R&tpageR1ttagtreltrelstpos((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pytfind_external_linkss'(  sPython-urllib/%s setuptools/%sit setuptoolsitContentCheckercBs)eZdZdZdZdZRS(sP A null content checker that defines the interface for checking content cCsdS(s3 Feed a block of data to the hash. N((tselftblock((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pytfeedscCstS(sC Check the hash. Return False if validation fails. (tTrue(Ro((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pytis_validscCsdS(su Call reporter with information about the checker (hash name) substituted into the template. N((Rotreporterttemplate((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pytreports(t__name__t __module__t__doc__RqRsRv(((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRns  t HashCheckercBsSeZejdZdZedZdZdZ dZ dZ RS(sK(?Psha1|sha224|sha384|sha256|sha512|md5)=(?P[a-f0-9]+)cCstj||_||_dS(N(Rtnewthashtexpected(Rot hash_nameR}((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyt__init__scCsLt|d}|stS|jj|}|s<tS||jS(s5Construct a (possibly null) ContentChecker from a URLi(RRntpatternRft groupdict(tclsR&R,R1((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pytfrom_urlscCs|jj|dS(N(R|tupdate(RoRp((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRqscCs|jj|jkS(N(R|t hexdigestR}(Ro((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRsscCsHy|jjSWn3tk rCdtt|jkr=dSnXdS(s Python 2.4 implementation of MD5 doesn't supply a .name attribute so provide that name. When Python 2.4 is no longer required, replace invocations of this method with simply 'self.hash.name'. tmd5N(R|RtAttributeErrorRattype(Ro((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyt_get_hash_names  cCs||j}||S(N(R(RoRtRutmsg((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRvs( RwRxtretcompileRRt classmethodRRqRsRRv(((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRzs     cBspeZdZdd%d&edZedZedZedZ dZ dZ d Z d Z d&d Zd Zd&d ZdZdZdZdZdZeeed&dZeedZdZdZdZdZd&dZdZdZdZdZ dZ!edZ"d Z#d!Z$d"Z%d#Z&d$Z'RS('s;A distribution index that scans web pages for download URLsshttps://pypi.python.org/simpleRcOstj||||d|jd |_i|_i|_i|_tjdj t t |j |_ g|_|rtjr|stjrtj||_n tj|_dS(NR"t|(t EnvironmentRRt index_urlt scanned_urlst fetched_urlst package_pagesRRRHR`RR1tallowstto_scanRt is_availabletfind_ca_bundlet opener_fortopenerRturlopen(RoRthostst ca_bundlet verify_sslRVtkw((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyR s   ' !c CsU||jkr| rdSt|j|/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRsN      !     *cCstjj|s&|jd|dStjj|r| rtjj|}x9tj|D]%}|jtjj||t qaWnt |}|r|j d|t t |j|ndS(Ns Not found: %ss Found: %s(RBR)texiststwarntisdirtrealpathtlistdirRRHRrRDRRR`RM(RotfntnestedR)titemR((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRJs& cCs}t|}|r-|jdjdksF|jt|drJtSd}|rit||n|j||dS(Nitfiles, Link to % s ***BLOCKED*** by --allow-hosts (RR2RRRRrRR(RoR&tfataltsR((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRZs :cCsfx_|D]W}tjj|rx<tj|D](}|jdr/|j||q/q/WqqWdS(Ns .egg-link(RBR)RRRt scan_egg_link(Rot search_pathRtentry((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pytscan_egg_linksds  cCsgttjttjj||D]}|r(|^q(}t|dkrxXttjj||dD]4}tjj|||_ t |_ |j |qrWndS(Nii( R`RaRbtopenRBR)RHR;tfind_distributionsR<t SOURCE_DISTR.RM(RoR)Rt_ftlinesR5((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRks 4& c sfd}xQtj|D]@}y&|t|t|jdWqtk r^qXqW||\}}|r xyt||D]h}t|\}} |jdr| r|r|d||f7}qj |nj |qWt j d|SdSdS(s#Process the contents of a PyPI pagecs|jjrttt|tjjd}t|dkrd|dkrt|d}t|d}t j j |j i|/usr/lib/python2.7/vendor-packages/setuptools/package_index.pytscanvs%"is.pys #egg=%s-%scSsd|jdddS(Ns%siii(R2(tm((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pytsRN( RcR^RRdR2t ValueErrorRlR-Rtneed_version_infotscan_urltPYPI_MD5tsub( RoR&RgRR1RRtnew_urlRtfrag((Ros>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRts$&  cCs|jd|dS(NsPPage at %s links to .py file(s) without version info; an index scan is required.(tscan_all(RoR&((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRscGsO|j|jkr;|r+|j||n|jdn|j|jdS(Ns6Scanning index of all packages (this may take a while)(RRRRR(RoRRV((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRs  cCs|j|j|jd|jj|jsN|j|j|jdn|jj|jss|j|nx3t|jj|jdD]}|j|qWdS(NR"(( RRt unsafe_nameRRRPt project_nametnot_found_in_indexR(Rot requirementR&((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyt find_packagess%cCsk|j|j|x8||jD])}||kr;|S|jd||q%Wtt|j||S(Ns%s does not match %s(tprescanRRPRtsuperRtobtain(RoRt installerR5((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRs  cCsi|j|jd||jse|jtj|td|jjtj j |fndS(s- checker is a ContentChecker sValidating %%s checksum for %ss7%s validation failed for %s; possible download problem?N( RvRRsRRBtunlinkRR|RR)R=(RotcheckerRCttfp((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyt check_hashs     cCsrxk|D]c}|jdksJt| sJ|jdsJtt|rZ|j|q|jj|qWdS(s;Add `urls` to the list that will be prescanned for searchessfile:N(RRRRRRRtappend(RoturlsR&((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pytadd_find_linkss  cCs2|jr%tt|j|jnd|_dS(s7Scan urls scheduled for prescanning (e.g. --find-links)N(RRR`RR(Ro((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRs cCsN||jr |jd}}n|jd}}|||j|jdS(Ns#Couldn't retrieve index page for %rs3Couldn't find index page for %r (maybe misspelled?)(RPRRRR(RoRtmethR((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRs   cCst|tst|}|r||j|jd||}t|\}}|jdrx|j|||}n|Stj j |r|Sytj |}Wqt k rt d|fqXnt|j||ddS(sLocate and/or download `spec` to `tmpdir`, returning a local path `spec` may be a ``Requirement`` object, or a string containing a URL, an existing local filename, or a project/version requirement spec (i.e. the string form of a ``Requirement`` object). If it is the URL of a .py file with an unambiguous ``#egg=name-version`` tag (i.e., one that escapes ``-`` as ``_`` throughout), a trivial ``setup.py`` is automatically created alongside the downloaded file. If `spec` is a ``Requirement`` object or a string containing a project/version requirement spec, this method returns the location of a matching distribution (possibly after downloading it to `tmpdir`). If `spec` is a locally existing file or directory name, it is simply returned unchanged. If `spec` is a URL, it is downloaded to a subpath of `tmpdir`, and the local filename is returned. Various errors may be raised if a problem occurs during downloading. is.pys1Not a URL, existing file, or requirement spec: %rR<N(Rt RequirementRt _download_urlR2R-Rt gen_setupRBR)RtparseRRRtfetch_distributionR(RotspecttmpdirR'tfoundRR,((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyR#s"  c sKjd|id}dfd}|rcjj|||}n|dk r|p|||}n|dkrjdk rj||}n|dkr| rj|||}n|dkrjdr dpd|n/jd||jdj|j|SdS( s|Obtain a distribution suitable for fulfilling `requirement` `requirement` must be a ``pkg_resources.Requirement`` instance. If necessary, or if the `force_scan` flag is set, the requirement is searched for in the (online) package index as well as the locally installed packages. If a distribution matching `requirement` is found, the returned distribution's ``location`` is the value you would have gotten from calling the ``download()`` method with the matching distribution's URL or filename. If no matching distribution is found, ``None`` is returned. If the `source` flag is set, only source distributions and source checkout links will be considered. Unless the `develop_ok` flag is set, development and system eggs (i.e., those using the ``.egg-info`` format) will be ignored. sSearching for %scs|dkr}nx||jD]q}|jtkrn rn|kr#jd|d|/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRe8s    "s2No local packages or download links found for %s%ssa source distribution of RsBest match: %sR<N( RRRRRRtcloneR#R<( RoRRt force_scanRRt local_indexR5Re((RRoRRs>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRs.       cCs/|j||||}|dk r+|jSdS(s3Obtain a file suitable for fulfilling `requirement` DEPRECATED; use the ``fetch_distribution()`` method now instead. For backward compatibility, this routine is identical but returns the ``location`` of the downloaded distribution instead of a distribution object. N(RRR<(RoRRRRR5((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pytfetches c Csqtj|}|rLgt||jddD]}|jr1|^q1pOg}t|dkrBtjj |}tjj ||krtjj ||}ddl m } | ||stj|||}qnttjj |dd} | jd|dj|djtjj|df| j|S|ratd||fn td dS( Nii(tsamefilessetup.pytwsIfrom setuptools import setup setup(name=%r, version=%r, py_modules=[%r]) isCan't unambiguously interpret project/version identifier %r; any dashes in the name or version should be escaped using underscores. %rspCan't process plain .py files without an '#egg=name-version' suffix to enable automatic setup script generation.(R0R1RR2RtversionR;RBR)R=tdirnameRHtsetuptools.command.easy_installRtshutiltcopy2RtwriteRtsplitextRR( RoRCR,RR1tdRR=tdstRR((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRss2 4  i c Cs|jd|d \}}}zItj|}|j|}t|trqtd||j|j fn|j}d}|j } d} d|krt |d} t t t| } |j|||| | nt|d}x`trO|j| } | rK|j| |j| |d7}|j|||| | qPqW|j||||SWd|r~|jn|r|jnXdS( NsDownloading %ssCan't download %s: %s %siiscontent-lengthsContent-Lengthtwbi(NNN(RRRzRRRRRRRt dl_blocksizeRtmaxR`tintt reporthookRRrRRqRRR( RoR&RCtfpRRRRtblocknumtbstsizetsizesRp((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyt _download_tos>        cCsdS(N((RoR&RCRtblksizeR((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRscCs|jdrt|Syt||jSWnttjfk rtjd}dj g|j D]}t |^qf}|r|j ||qt d||fn'tjk rtjd}|Stjk r/tjd}|r|j ||jqt d||jfntjk rtjd}|rk|j ||jqt d||jfnStjk rtjd}|r|j ||qt d||fnXdS(Nsfile:it s%s %ssDownload error for %s: %ss;%s returned a bad status line. The server might be down, %s(Rt local_opentopen_with_authRRRt InvalidURLtsystexc_infoRHRVRaRRRRtURLErrortreasont BadStatusLinetlinet HTTPException(RoR&twarningtvtargR((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRs> +cCs<t|\}}|rLx7d|krH|jddjdd}qWnd}|jdrn|d }ntjj||}|dks|jd r|j||S|d ks|jd r|j||S|jd r|j ||S|d krt t |dS|j |t |j||SdS(Ns..t.s\t_t__downloaded__s.egg.zipitsvnssvn+tgitsgit+shg+Ri(R-treplaceRRBR)RHRt _download_svnt _download_gitt _download_hgR RRRrt_attempt_download(RoR'R&RRR,RC((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRs$%  cCs|j|tdS(N(RRr(RoR&((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRscCsK|j||}d|jddjkrC|j|||S|SdS(NRs content-typeR(RRRt_download_html(RoR&RCR((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyR/ scCst|}xW|D]O}|jrtjd|r^|jtj||j||SPqqW|jtj|td|dS(Ns ([^- ]+ - )?Revision \d+:s���Unexpected HTML page found at ( ���R���Rb���R���Rf���R���RB���R���R,��R���(���Ro���R&���R���RC���R���R!��(����(����s>���/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyR0����s����       c���������C���sT��|�j��d�d��d�}�d�}�|�j���j�d��r#d�|�k�r#t�|��\�}�}�}�}�}�} �|� r#|�j�d��r#d�|�d �k�r#|�d �j��d�d��\�}�}�t�|��\�} �} �| �r d �| �k�r�| �j��d �d��\�} �} �d �| �| �f�}�n �d �| �}�| �}�t�|�|�|�|�|�| �f��}�q q#n��|��j�d �|�|��t�j�d�|�|�|�f��|�S(���NR$���i���i����R���s���svn:t���@s���//R"���i���t���:s��� --username=%s --password=%ss ��� --username=s'���Doing subversion checkout from %s to %ss���svn checkout%s -q %s %s( ���R%���R���R���R���R ���R ���R���RB���t���system(���Ro���R&���RC���t���credsR'���t���netlocR)���RK���t���qR���t���autht���hostt���usert���pw(����(����s>���/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyR,��0��s"����!&  'c��� ������C���s���t��|��\�}�}�}�}�}�|�j�d�d��d�}�|�j�d�d��d�}�d��}�d�|�k�rt�|�j�d�d��\�}�}�n��t�|�|�|�|�d�f��}�|�|�f�S(���Nt���+i���iR$���i����R1��R���(���t���urlsplitR%���R���t���rsplitt ���urlunsplit( ���Ro���R&���t ���pop_prefixR'���R5��R)���R+���R���t���rev(����(����s>���/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyt���_vcs_split_rev_from_urlD��s���� c���������C���s���|�j��d�d��d�}�|��j�|�d�t�\�}�}�|��j�d�|�|��t�j�d�|�|�f��|�d��k �r�|��j�d�|��t�j�d�|�|�f��n��|�S( ���NR$���i���i����R?��s���Doing git clone from %s to %ss���git clone --quiet %s %ss���Checking out %ss"���(cd %s && git checkout --quiet %s)(���R%���RA��Rr���R���RB���R3��R���(���Ro���R&���RC���R@��(����(����s>���/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyR-��U��s����  c���������C���s���|�j��d�d��d�}�|��j�|�d�t�\�}�}�|��j�d�|�|��t�j�d�|�|�f��|�d��k �r�|��j�d�|��t�j�d�|�|�f��n��|�S( ���NR$���i���i����R?��s���Doing hg clone from %s to %ss���hg clone --quiet %s %ss���Updating to %ss���(cd %s && hg up -C -r %s >&-)(���R%���RA��Rr���R���RB���R3��R���(���Ro���R&���RC���R@��(����(����s>���/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyR.��e��s����  c���������G���s���t��j�|�|��d��S(���N(���R���R���(���Ro���R���RV���(����(����s>���/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyR���u��s����c���������G���s���t��j�|�|��d��S(���N(���R���R���(���Ro���R���RV���(����(����s>���/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyR���x��s����c���������G���s���t��j�|�|��d��S(���N(���R���R���(���Ro���R���RV���(����(����s>���/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyR���{��s����(���R���N((���Rw���Rx���Ry���R���Rr���R���t���FalseR���R���R���R���R���R���R���R���R���R���R���R���R���R���R#���R���R���R���R ��R��R��R���R���R���R/��R0��R,��RA��R-��R.��R���R���R���(����(����(����s>���/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyR��� ��sJ��� 0   ,       *  D ) $  &          s!���&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?c���������C���s3���t��|��t��s�|��S|��d�k�r)�t�|���St�|���S(���Ni���(���R���R��R���t���chr(���t���c(����(����s>���/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyt���uchr��s ���� � c���������C���s{���|��j��d��}�|�j�d��r4�t�|�d�d��}�n=�|�j�d��rV�t�|�d��}�n�t�j�|�|��j��d���}�t�|��S(���Ni���s���#xi���i���R$���i����(���R2���R���R��R ���R���RE��(���R1���t���what(����(����s>���/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyt ���decode_entity��s����c���������C���s ���t��t�|���S(���s'���Decode HTML entities in the given text.(���t ���entity_subRG��(���t���text(����(����s>���/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRd�����s����c������������s�����f�d���}�|�S(���Nc������������s������f�d���}�|�S(���Nc�������������s?���t��j���}�t��j���z���|��|���SWd��t��j�|��Xd��S(���N(���t���sockett���getdefaulttimeoutt���setdefaulttimeout(���RV���RW���t ���old_timeout(���RX���t���timeout(����s>���/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyt���_socket_timeout��s ����  (����(���RX���RO��(���RN��(���RX���s>���/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRO����s����(����(���RN��RO��(����(���RN��s>���/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyt���socket_timeout��s���� c���������C���s=���t��|���}�|�j���}�t�j�|��}�|�j���}�|�j���S(���s��� A function compatible with Python 2.3-3.3 that will encode auth from a URL suitable for an HTTP header. >>> _encode_auth('username%3Apassword') u'dXNlcm5hbWU6cGFzc3dvcmQ=' (���R ���t���encodet���base64t ���encodestringR���t���rstrip(���R7��t���auth_st ���auth_bytest ���encoded_bytest���encoded(����(����s>���/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyt ���_encode_auth��s ����   c���������C���sQ��t��|���\�}�}�}�}�}�}�|�j�d��r?�t�j�d���n��|�d�k�r`�t�|��\�}�} �n�d �}�|�r�d�t�|��}�t�|�| �|�|�|�|�f��} �t�j �| ��} �| �j �d�|��n�t�j �|���} �| �j �d�t ��|�| ��} �|�rMt��| �j ��\�} �}�}�}�}�}�| �|�k�rM|�| �k�rMt�| �|�|�|�|�|�f��| �_ �qMn��| �S( ���s4���Open a urllib2 request, handling HTTP authenticationR2��s���nonnumeric port: ''t���httpt���httpss���Basic t ���Authorizations ���User-Agent(���s���https���httpsN( ���R���R���R���R��R ���R���RY��R ���R���t���Requestt ���add_headert ���user_agentR&���(���R&���R���R'���R5��R)���t���paramsR+���R���R7��R8��R���t���requestR��t���s2t���h2t���path2t���param2t���query2t���frag2(����(����s>���/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyR����s&����  !'c���������C���s���|��S(���N(����(���R&���(����(����s>���/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyt ���fix_sf_url��s����c���������C���so��t��|���\�}�}�}�}�}�}�t�|��}�t�j�j�|��rI�t�j�|���S|�j�d��r=t�j�j�|��r=g��}�x�t�j �|��D]�} �| �d�k�r�t �t�j�j �|�| ��d��} �| �j ���} �| �j ���Pn.�t�j�j�t�j�j �|�| ���r�| �d�7} �n��|�j�d�| �| �f��q�Wd�|��d�d�j �|��} �d�\�} �} �n�d�\�} �} �} �t�|��| �| �i�d �d�6t�| ���S(���s7���Read a local path, with special support for directoriesR"���s ���index.htmlt���rbs���<a href=%r>%s</a>s���<html><head><title>%ss%ss itOKisPath not founds Not founds text/htmls content-type(isOK(isPath not founds Not found(RR RBR)tisfileRRRRRRRHRRRRR(R&R'R(R)tparamR+RRCtfilesRRtbodytstatustmessage((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pyRs*  !   !  (PRyRtos.pathRBRRtrandomRJt itertoolsRRRmRt pkg_resourcest distutilsRtdistutils.errorsRtsetuptools.compatRRRRRR R R R R RRRtfnmatchRtsetuptools.py24compatRRtsetuptools.py27compatRRR0tIRcRR1RR%R:t__all__t_SOCKET_TIMEOUTRR-RRR/RDRRRURZR]RlRtrequireR_tobjectRnRzRRRRHRERGRdRPRYRRRhR(((s>/usr/lib/python2.7/vendor-packages/setuptools/package_index.pytsbH   R        "  !/   $