efɕdZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlmZddlZddlmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#ddl$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+dd l,m-Z-ej.d Z/ej.d ej0Z1ej.d Z2ej.d ej0j3Z4d5Z6gdZ7dZ8dZ9e9:dj:ej;eZdZ?d1dZ@d1dZAd1dZBdedfdZCdZDej.dej0ZE eDdZFGddZGGd d!eGZHGd"d#eZIej.d$jJZKd%ZLd&ZMd2d'ZNd(ZOGd)d*ZPGd+d,e jQZRejSjTfd-ZUd.ZVeNe8eUZUd/ZWd0ZXdS)3z$PyPI and direct package downloading.Nwraps) CHECKOUT_DIST Distribution BINARY_DISTnormalize_path SOURCE_DIST Environmentfind_distributions safe_name safe_version to_filename Requirement DEVELOP_DISTEGG_DIST parse_version)logDistutilsError) translate)Wheelunique_everseenz^egg=([-A-Za-z0-9_.+!]+)$zhref\s*=\s*['"]?([^'"> ]+)z([^<]+)\n\s+\(md5\)z([-+.a-z0-9]{2,}):z.tar.gz .tar.bz2 .tar .zip .tgz) PackageIndexdistros_for_urlparse_bdist_wininstinterpret_distro_namez>, ' ' :DDD   k3 / / "R%[F:DDD ^^, - - :DDD   os 3 3 "R%[F:DD  ctj|}|\}}}}}}tj|dd}|dkr>|dkr8tj|dd}d|vr|dd\}}||fS)N/zsourceforge.netdownload#)urllibr"urlparseunquotesplit) urlpartsschemeserverpath parametersqueryfragmentr0s r&egg_info_for_urlrGes L ! !# & &E8=5FFD*eX <   3 3 4 4D """tz'9'9|##DJJsOOB$788 d{{C++h >r3c#Kt|\}}t|||D]}|V|rNt|}|r4t ||d|t D] }|VdSdSdS)zEYield egg or source distribution objects that might be found at a URLr:) precedenceN)rGdistros_for_location EGG_FRAGMENTmatchrgroupr)r?metadatar0rFdistrLs r&rrps%c**ND($S$99 ""8,,  -U[[^^X-       r3c|dr |dd}|drd|vrtj|||gS|drOd|vrKt|}|sgSt||j|jtdzgS|d r.t|\}}}|t||||t|StD]B}||r+|dt| }t|||cSCgS) z:Yield egg or source distribution objects based on basename.egg.zipNr+z.egg-z.whlr:)location project_nameversionrIr)) r-r from_locationr is_compatiblerTrUrrrr EXTENSIONSlen)rSbasenamerNwheelwin_baser1platformexts r&rJrJ~s$$!CRC=  JSH__*8XxHHII   SH__h""$$ I !"/ #a<        %8%B%B"&(  ((Hfk8  GG   S ! ! G 3s88) ,H(8XFF F F F G Ir3cxtt|tj||S)zEYield possible egg or source distribution objects based on a filename)rJrosrCrZ)filenamerNs r&distros_for_filenamerbs3 x  "'"2"28"<"z(interpret_distro_name..s.KKAbh|Q77KKKKKKr3Nr:) py_versionrIr])r>anyrangerYisdigitrjoin)rSrZrNrjrIr]r@rgs r&rrs  NN3  E #KKqrrKKKKK3u::   8BQB<   ! !  E  JJ  rr qrr   r3c<tfd}|S)zs Wrap a function returning an iterable such that the resulting iterable only ever yields unique items. c.t|i|SNr)argskwargsfuncs r&wrapperzunique_values..wrappers ttT4V44555r3r)rtrus` r& unique_valuesrvs5  4[[6666[6 Nr3z3<([^>]*\srel\s{0,10}=\s{0,10}['"]?([^'" >]+)[^>]*)>c #Kt|D]}|\}}tt t j|d}d|vsd|vr_t|D]D}tj |t|dVEdD]|}||}|dkr_t||}|rBtj |t|dV}dS)zEFind rel="homepage" and rel="download" links in `page`, yielding URLs,homepager7r:)z Home PagezDownload URLr6N)RELfinditergroupssetmapstrstripr,r>HREFr;r"urljoin htmldecoderMfindsearch)r?pagerLtagrelrelsposs r&find_external_linksrsMd##LL<<>>S3sy#))++"3"3C"8"899::   t!3!3s++ L Ll**3 5;;q>>0J0JKKKKKK4LLiinn "99KKc**E Ll**3 5;;q>>0J0JKKKKK LLr3c$eZdZdZdZdZdZdS)ContentCheckerzP A null content checker that defines the interface for checking content cdS)z3 Feed a block of data to the hash. Nselfblocks r&feedzContentChecker.feeds  r3cdS)zC Check the hash. Return False if validation fails. Trrs r&is_validzContentChecker.is_valids tr3cdS)zu Call reporter with information about the checker (hash name) substituted into the template. Nr)rreportertemplates r&reportzContentChecker.reports r3N)__name__ __module__ __qualname____doc__rrrrr3r&rrsK  r3rc\eZdZejdZdZedZdZ dZ dZ dS) HashCheckerzK(?Psha1|sha224|sha384|sha256|sha512|md5)=(?P[a-f0-9]+)cT||_tj||_||_dSrq) hash_namehashlibnewhashexpected)rrrs r&__init__zHashChecker.__init__s%"K **   r3ctj|d}|stS|j|}|stS|di|S)z5Construct a (possibly null) ContentChecker from a URLr6r)r;r"r<rpatternr groupdict)clsr?rFrLs r&from_urlzHashChecker.from_urls{<((--b1 $!## # ""8,, $!## #s''U__&&'''r3c:|j|dSrq)rupdaters r&rzHashChecker.feeds r3cF|j|jkSrq)r hexdigestrrs r&rzHashChecker.is_valid"sy""$$ 55r3c,||jz}||Srq)r)rrrmsgs r&rzHashChecker.report%s'x}}r3N) rrrrecompilerr classmethodrrrrrr3r&rr sbj #G !!! (([(   666r3rc.eZdZdZ d+fd ZfdZd,d Zd,d Zd,d Zd Z d Z dZ dZ dZ d-dZdZd-fd ZdZdZdZdZdZ d.dZd/dZdZdZdZdZd-dZd Zd!Zd"Zd#Z d$Z!e"d,d%Z#d&Z$d'Z%d(Z&d)Z'd*Z(xZ)S)0rz;A distribution index that scans web pages for download URLshttps://pypi.org/simple/*NTcrtj|i||dd|d z|_i|_i|_i|_tjd tt|j |_ g|_tjj|_dS)Nr5|)superrr- index_url scanned_urls fetched_urls package_pagesrerrnr~rrLallowsto_scanr;requesturlopenopener)rrhosts ca_bundle verify_sslrrkw __class__s r&rzPackageIndex.__init__-s $%"%%%"S)Fy/A/A#/F/F+F)F%GGj#i*?*?!@!@AAG  n, r3c t|jn#t$rYdSwxYwt|Srq)rrU Exceptionradd)rrOrs r&rzPackageIndex.add?sS  $, ' ' ' '    FF ww{{4   s  &&Fc ||jvr|sdSd|j|<t|s||dStt |}|r-||sdS|d||s |r ||jvr$tt|j |dS||s d|j|<dS| d|d|j|<d}| |||z}|dSt|tjjr(|jdkr| d|jzd|j|j<d|jd d vr|dS|j}|}t|t0sTt|tjjrd }n|jd pd }||d }|t6|D]W} tj|t?| d} |!| X|"|j#r-tI|dddkr|%||}dSdSdS)z>$. ) ) 1ga.F.F#.M.M%%c400DDD 1 1.M.Mr3c tj|s|d|dStj|rl|sjtj|}tj|D]6}|tj||d7t|}|r:| d|tt|j |dSdS)Nz Not found: %sTz Found: %s)r`rCexistswarnisdirrealpathlistdirrrnrbrrr~r)rfnnestedrCitemrs r&rzPackageIndex.process_filename}sw~~b!!  IIor * * * F 7==   FV F7##B''D 4(( F F%%bgll4&>&>EEEE$R((  ' JJ{B ' ' ' TXu%% & & & & & ' 'r3cNt|}|o*|ddk}|s8|tj|drdSd}|rt||z|||dS)Nr:fileTz Note: Bypassing %s (disallowed host; see https://setuptools.pypa.io/en/latest/deprecated/easy_install.html#restricting-downloads-with-allow-hosts for details). ) rrMr,rr;r"r<rr)rr?fatalsis_filers r&rzPackageIndex.url_oks sOO4 ((**f4  dkk&,"7"7"<".sm  D))  ~~k**  5M       r3)filterr`rCrr itertoolsstarmap scan_egg_link)r search_pathdirs egg_linkss r&scan_egg_linkszPackageIndex.scan_egg_linkssYbgm[11     Y t19 = =>>>>>r3c ttj||5}t t dt tj|}dddn #1swxYwYt|dkrdS|\}}ttj||D]?}tjj|g|R|_ t|_ ||@dS)Nri)openr`rCrnrrr~rrrYr rSr rIr)rrCr raw_lineslinesegg_path setup_pathrOs r&rzPackageIndex.scan_egg_links) "',,tU++ , , B c#)Y&?&?@@AAE B B B B B B B B B B B B B B B u::?? F$*&rw||D('C'CDD  DGL6666DM)DO HHTNNNN  s6A00A47A4c d}||js|Stttjj|t|jdd}t|dks d|dvr|St|d}t|d}d|j | i|<t|t|fS)N)NNr5rir9r:rT)r.rrr~r;r"r=rYr>r r r setdefaultr,r)rrNO_MATCH_SENTINELr@pkgvers r&_scanzPackageIndex._scans&t~.. %$ $S-tC4G4G4I4I/J/P/PQT/U/UVVWW u::??cU1Xoo$ $a!!58$$?C%%ciikk266t<3S!1!111r3c \t|D]f} |tj|t |dW#t$rYcwxYw||\}}|sdSt||D]c}t|\}}| dr%|s#|r |d|d|z }n| || |dtd|S)z#Process the contents of a PyPI pager:r.pyz#egg=rRc6d|dddzS)Nz%sr:ri)rM)ms r&z,PackageIndex.process_index..s2QWWQ15E5EEr3)rr{rr;r"rrrMr#rrGr-need_version_infoscan_urlPYPI_MD5sub) rr?rrLrrnew_urlr0frags r&rzPackageIndex.process_indexsN]]4((  E  6<//Z A5O5OPPQQQQ    ::c??S 2+355 # #G)'22JD$}}U## 0D 00GsssCC88GG**3/// MM' " " " "|| E Et   sAA22 A?>A?c2|d|dS)NzPPage at %s links to .py file(s) without version info; an index scan is required.)scan_allrr?s r&rzPackageIndex.need_version_infos*       r3c|j|jvr%|r|j|g|R|d||jdS)Nz6Scanning index of all packages (this may take a while))rrrrrrrrrs r&rzPackageIndex.scan_allsa >!2 2 2 & #%%%%% IIN O O O dn%%%%%r3c||j|jzdz|j|js%||j|jzdz|j|js||t|j|jdD]}||dS)Nr5r) rr unsafe_namerrkeyrTnot_found_in_indexr)r requirementr?s r& find_packageszPackageIndex.find_packagess dn{'>>DEEE!%%ko66 K MM$.;+CCcI J J J!%%ko66 1  # #K 0 0 0*..{CCDD  C MM#      r3c|||||jD]!}||vr|cS|d||"t t |||S)Nz%s does not match %s)prescanr(r%rrrobtain)rr' installerrOrs r&r+zPackageIndex.obtains  ;''') B BD{"" JJ-{D A A A A\4((// YGGGr3c2||jd|z|sd|t j|t |jjdtj |ddS)z- checker is a ContentChecker zValidating %%s checksum for %sz validation failed for z; possible download problem?N) rrrrr`unlinkrrr/rCrZ)rcheckerratfps r& check_hashzPackageIndex.check_hash s tz#Ch#NOOO!!  IIKKK Ih    <$$$bg&6&6x&@&@&@&@B   r3c|D]y}|j@t|r1|dstt |r||_|j|zdS)z;Add `urls` to the list that will be prescanned for searchesNfile:)rrr.rrrappend)rurlsr?s r&add_find_linkszPackageIndex.add_find_linkss ) )C $!#%>>'**%,,--%  c"""" ##C(((( ) )r3cp|jr'tt|j|jd|_dS)z7Scan urls scheduled for prescanning (e.g. --find-links)N)rrr~rrs r&r*zPackageIndex.prescan&s3 < 3 T]DL11 2 2 2 r3c||jr |jd}}n |jd}}|||j|dS)Nz#Couldn't retrieve index page for %rz3Couldn't find index page for %r (maybe misspelled?))r%rrr$r)rr'methrs r&r&zPackageIndex.not_found_in_index,sX     #H#DD ED S+)*** r3ct|tst|}|rj||d||}t |\}}|dr||||}|Stj |r|St|}t| ||ddS)aLocate 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. r:rrSN)rrr _download_urlrMrGr- gen_setupr`rCrr'rfetch_distribution)rr$tmpdirrAfoundr0rFs r&r7zPackageIndex.download7s$$ ,, 3%%F 3**6<<??D&II!1$!7!7h==''D NN5(FCCE %% 3 ,T22t..tV<s r&rz-PackageIndex.fetch_distribution..findws{CG  $ $?l22:27** D )* s{U;(F(Tf*$-- v>>C-0D*w~~d&<==$#  $ $r3z:No local packages or working download links found for %s%sza source distribution of rzBest match: %s)rSrq)rr*r(rrclonerB) rr'r> force_scanrIrG local_indexrOrrHs ` ` `` @r&r=zPackageIndex.fetch_distributionYsn4 $k222 $ $ $ $ $ $ $ $ $ $,  % LLNNN   { + + +4 $$D 2 /4 [11D <|' 4 $$D < <   { + + +4 $$D < IIL77=2      II& - - -::t'=:>> >r3cH|||||}||jSdS)a3Obtain 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)r=rS)rr'r>rKrIrOs r&fetchzPackageIndex.fetchs0&&{FJOO  = tr3c t|}|r.dt||ddDpg}t |dkrXt j|}t j||krvt j ||}t j |r t j ||stj |||}tt j |dd5}|d|djd|djdt j|dd dddn #1swxYwY|S|rt'd |d |t'd ) Nc g|] }|j | Sr)rU)rfds r& z*PackageIndex.gen_setup..s09r3r:zsetup.pywz(from setuptools import setup setup(name=rz , version=z, py_modules=[z]) z9Can't unambiguously interpret project/version identifier zI; any dashes in the name or version should be escaped using underscores. zpCan't process plain .py files without an '#egg=name-version' suffix to enable automatic setup script generation.)rKrLrrMrYr`rCrZdirnamernrsamefileshutilcopy2rwriterTrUsplitextr) rrarFr>rLrrZdstrs r&r<zPackageIndex.gen_setups""8,,  .xQNN    u::??w''11Hwx((F22gll6844s++#0@0@30O0O#L3///"Hbgll6:66<<  a---a(((((221555                O   .&.XXuu6  !G sAF,,F03F0i c|d|d} t|}||}t |t jjr"td|d|j d|j |}d}|j }d}d|vrP| d} ttt| }||||||t#|d 5} ||} | rI|| | | |d z }||||||nnb|||| dddn #1swxYwY||r|SS#|r|wwxYw) NzDownloading %szCan't download :  rr6zcontent-lengthzContent-LengthwbTr:)rrrrrr;rrrrr dl_blocksizeget_allmaxr~int reporthookrrrrXr1r) rr?rafpr/rblocknumbssizesizesr0rs r& _download_tozPackageIndex._download_tos "C(((  !**3//Gs##B"fl455 $n25##rwwwGggiiGH"BD7**(8993sE??++XxTBBBh%% 8GGBKKE U+++ %((( A XxTJJJJ3777 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8   r   s1C3F8 A;F F8FF8FF88GcdSrqr)rr?rareblksizergs r&rczPackageIndex.reporthook s r3c|drt|S t||jS#tt jjf$r]}dd|j D}|r| ||nt|d||Yd}~dSd}~wtj j$r }|cYd}~Sd}~wtj j$rD}|r| ||jntd|d|j|Yd}~dSd}~wt jj$rC}|r| ||jnt|d|j|Yd}~dSd}~wt jjt(f$r:}|r| ||ntd|d||Yd}~dSd}~wwxYw)Nr3r]c,g|]}t|Sr)r)rfargs r&rRz)PackageIndex.open_url..s777CHH777r3zDownload error for r\z7 returned a bad status line. The server might be down, )r. local_openopen_with_authrr#httpclient InvalidURLrnrrrrr;rrURLErrorreason BadStatusLineline HTTPExceptionOSError)rr?warningvrs r&rzPackageIndex.open_url sm >>' " " #c?? " T!#t{33 3DK23 B B B((7777788C B '3''''$SS%9::A('''''|%   HHHHHH|$     '18,,,,$n3633A-,,,,, {(     '16****$"%##qvv/+*****  )73 T T T T '1%%%%$nCCC%KLLRSS&%%%%% TsL;GAB..GC G G#9D""G98E77G/G  Gct|\}}|r3d|vr.|dddd}d|v.nd}|dr |dd}tj||}|dks|d r|||S|d ks|d r|||S|d r| ||S|d krBtj tj |dS||d|||S)Nz...\___downloaded__rQr+svnzsvn+gitzgit+zhg+rriT)rGreplacer-r`rCrnr. _download_svn _download_git _download_hgr;r url2pathnamer"r<r_attempt_download)rrAr?r>r/rFras r&r;zPackageIndex._download_url/s*#..h  $$,,||D#..66tSAA$,,$D == $ $ 9D7<<-- U??f//77?%%c844 4 u__ 1 1& 9 9_%%c844 4   u % % 9$$S(33 3 v  >..v|/D/DS/I/I!/LMM M KKT " " "))#x88 8r3c2||ddS)NT)rr s r&rzPackageIndex.scan_urlLs d#####r3c|||}d|ddvr||||S|S)Nrrr)rirr,_invalid_download_html)rr?rars r&rzPackageIndex._attempt_downloadOsY##C22 W[[44::<< < <..sGXFF FOr3cNtj|td|)NzUnexpected HTML page found at )r`r.r)rr?rras r&rz#PackageIndex._invalid_download_htmlVs) (CcCCDDDr3c&td|)Nz/Invalid config, SVN download is not supported: r)rr? _filenames r&rzPackageIndex._download_svnZsTsTTUUUr3cJtj|\}}}}}|ddd}|ddd}d}d|vr|dd\}}tj||||df}||fS)N+r:r6r9r@r)r;r"urlsplitr>rsplit urlunsplit)r? pop_prefixrAnetlocrCrErrevs r&_vcs_split_rev_from_urlz$PackageIndex._vcs_split_rev_from_url]s,2L,A,A#,F,F)eTc1%%b)zz#q!!!$ $;; C++ID#l%%vvtUB&GHHCxr3c8|ddd}||d\}}|d||tjd|d||0|d |tjd |d ||S) Nr9r:rTrzDoing git clone from %s to %szgit clone --quiet r]zChecking out %szgit -C z checkout --quiet r>rrr`systemrr?rars r&rzPackageIndex._download_gitos>>#q))!,///EES 13AAA sssHH=>>> ? II' - - - IIHHC   r3c:|ddd}||d\}}|d||tjd|d||1|d |tjd |d |d |S) Nr9r:rTrzDoing hg clone from %s to %szhg clone --quiet r]zUpdating to %sz hg --cwd z up -C -r z -qrrs r&rzPackageIndex._download_hgs>>#q))!,///EES 0#x@@@ ccc88<=== ? II& , , , IIHHCC   r3c*tj|g|RdSrq)rrr"s r&rzPackageIndex.debugs  #r3c*tj|g|RdSrq)rrr"s r&rzPackageIndex.info  tr3c*tj|g|RdSrq)rrr"s r&rzPackageIndex.warnrr3)rrNT)Frq)FFFN)FF)*rrrrrrrrrrrrrrrr(r+r1r6r*r&r7r=rNr<r_rircrr;rrrr staticmethodrrrrrr __classcell__rs@r&rr*sEE- ------$!!!!!31313131j''''     ??? 222    :   &&&&   HHHHHH    ) ) )    P P PLM?M?M?M?^    ,,,\L"""H    T T T TD999:$$$EEEVVV\"&&r3rz!&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?cT|d}tj|S)Nr)rMrunescape)rLwhats r& decode_entityrs! ;;q>>D =  r3c,tt|S)a Decode HTML entities in the given text. >>> htmldecode( ... 'https://../package_name-0.1.2.tar.gz' ... '?tokena=A&tokenb=B">package_name-0.1.2.tar.gz') 'https://../package_name-0.1.2.tar.gz?tokena=A&tokenb=B">package_name-0.1.2.tar.gz' ) entity_subr)texts r&rrs mT * **r3cfd}|S)Ncfd}|S)Nctj}tj |i|tj|S#tj|wxYwrq)socketgetdefaulttimeoutsetdefaulttimeout)rrrs old_timeoutrttimeouts r&_socket_timeoutz@socket_timeout.._socket_timeout.._socket_timeoutsd 244K  $W - - - 6tT,V,,(5555(5555s AAr)rtrrs` r&rz'socket_timeout.._socket_timeouts* 6 6 6 6 6 6r3r)rrs` r&socket_timeoutrs$      r3ctj|}|}t j|}|}|ddS)a9 Encode auth from a URL suitable for an HTTP header. >>> str(_encode_auth('username%3Apassword')) 'dXNlcm5hbWU6cGFzc3dvcmQ=' Long auth strings should not cause a newline to be inserted. >>> long_auth = 'username:' + 'password'*10 >>> chr(10) in str(_encode_auth(long_auth)) False  r)r;r"r=encodebase64 b64encoderr)authauth_s auth_bytes encoded_bytesencodeds r& _encode_authrs[\ ! !$ ' 'FJ$Z00M""$$G ??4 $ $$r3c$eZdZdZdZdZdZdS) Credentialz: A username/password pair. Use like a namedtuple. c"||_||_dSrqusernamepassword)rrrs r&rzCredential.__init__s    r3c#.K|jV|jVdSrqrrs r&__iter__zCredential.__iter__s(mmr3c&dt|zS)Nz%(username)s:%(password)s)varsrs r&__str__zCredential.__str__s*T$ZZ77r3N)rrrrrrrrr3r&rrsK!!!88888r3rc@eZdZfdZedZdZdZxZS) PyPIConfigcjtgdd}t|tjtjdd}tj|r| |dSdS)z% Load from ~/.pypirc )rr repositoryr~z.pypircN) dictfromkeysrrr`rCrn expanduserrr)rdefaultsrcrs r&rzPyPIConfig.__init__s==!G!G!GLL """ W\\"',,S119 = = 7>>"    IIbMMMMM  r3cfdD}ttj|S)Ncdg|],}|d*|-S)r)rr)rfsectionrs r&rRz2PyPIConfig.creds_by_repository..sI& & & xx..4466& & & & r3)sectionsrr~_get_repo_cred)rsections_with_repositoriess` r&creds_by_repositoryzPyPIConfig.creds_by_repositorysR& & & & ==??& & & " C+-GHHIIIr3c||d}|t||d||dfS)Nrrr)rrr)rrrepos r&rzPyPIConfig._get_repo_credstxx..4466Z HHWj ) ) / / 1 1 HHWj ) ) / / 1 1    r3cv|jD]\}}||r|cSdS)z If the URL indicated appears to be a repository defined in this config, return the credential for that repository. N)ritemsr.)rr?rcreds r&find_credentialzPyPIConfig.find_credentialsS !% 8 > > @ @   J~~j))     r3) rrrrpropertyrrrrrs@r&rrst     JJXJ   r3rctj|}|\}}}}}}|drtjd|dvrt|\} } nd} | sMt |} | r*t| } | j |f} tj dg| R| rodt| z} || ||||f} tj| }tj|}|d| ntj|}|dt&||}| rctj|j\}}}}}}||kr2|| kr,||||||f} tj| |_|S) z4Open a urllib2 request, handling HTTP authentication:znonnumeric port: '')rqhttpsNz*Authenticating as %s for %s (from .pypirc)zBasic Authorizationz User-Agent)r;r"r<r-rqrrrs _splituserrrrrrrr urlunparserRequest add_header user_agentr?)r?rparsedrArrCparamsrErraddressrrr@rrrds2h2path2param2query2frag2s r&rprps\ " "3 ' 'F06-FFD&%s<k$$%:;;; """"6** gg J||++C00  Jt99D=#%D HA ID I I I I .,t,,,vud:,))%00.((11?D1111.((-- |Z000 B 406|/D/DRV/L/L,Bvvu < 'user[:passwd]', 'host[:port]'.rN) rpartition)hostuserdelims r&rr@s0,,D% #DDtd **r3c|Srqr)r?s r& fix_sf_urlrKs Jr3ctj|\}}}}}}tj|}t j|rtj|S| drt j |rg}t j |D]} t j || } | dkr>t| d5} | } dddn #1swxYwYnzt j | r| dz } |d| d} | |d | } d \}}nd \}}} d d i}t#j| }tj|||||S)z7Read a local path, with special support for directoriesr5z index.htmlrNz{name})r/zB{url}{files}r)r?files)OK)rzPath not foundz Not foundrz text/html)r;r"r<rrr`rCisfilerr-rrrnrrr4formatioStringIOrr)r?rArBrCparamrErrarrfilepathrdbodyrstatusmessager body_streams r&roroOs/5|/D/DS/I/I,FFD%~**400H w~~hC~%%c*** s  C h 7 7CH%% @ @Aw||Ha00HL  (C((%B7799D%%%%%%%%%%%%%%%x(( S LL6==1=EE F F F FX ;;3dii.>.>;??D# B{+G+d##K < ! !#vw M MMsD((D, /D, rq)r)Yrsysr`rerrVrrrr configparserr http.clientrq urllib.parser;urllib.request urllib.error functoolsrr pkg_resourcesrrrrr r r r r rrrrr distutilsrdistutils.errorsrfnmatchrsetuptools.wheelr setuptools.extern.more_itertoolsrrrKIrrrLrr>rX__all___SOCKET_TIMEOUT_tmplr version_inforr'rrGrrJrbrrvrzrrrrrrrrrrrRawConfigParserrrrrprrrorr3r&r s**   ++++++""""""<<<<<<rz677 rz3RT:: 2:J  RZ,bd 3 3 9 . 4 4 6 6    F \\ W^S- .: 0        F.2kTXD   bjKRTRR LLL$2.Br r r r r ;r r r nRZ< = = A  + + +    %%%*88888888"$$$$$-$$$N &~5++++^+++100@@NNNNNr3