a [ÎdgŸã@s–dZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl ZddlZddlZddlZddlmZddlZddlmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#ddlm$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*dd l+m,Z,e -d ¡Z.e -d ej/¡Z0e -d ¡Z1e -d ej/¡j2Z3d 4¡Z5gd¢Z6dZ7dZ8e8j9dj9ej:ŽedZ;dd„ZdDdd„Z?dEdd„Z@dFdd„ZAdedfd d!„ZBdGd"d#„ZCd$d%„ZDe -d&ej/¡ZEeDd'd(„ƒZFGd)d*„d*ƒZGGd+d,„d,eGƒZHGd-d.„d.eƒZIe -d/¡jJZKd0d1„ZLd2d3„ZMdHd4d5„ZNd6d7„ZOGd8d9„d9ƒZPGd:d;„d;e jQƒZRejSjTfdd?„ZVeNe7ƒeUƒZUd@dA„ZWdBdC„ZXdS)Iz#PyPI and direct package downloadingéN©Úwraps) Ú CHECKOUT_DISTÚ DistributionÚ BINARY_DISTÚnormalize_pathÚ SOURCE_DISTÚ EnvironmentÚfind_distributionsÚ safe_nameÚ safe_versionÚ to_filenameÚ RequirementÚ DEVELOP_DISTÚEGG_DIST)Ú ssl_support)Úlog)ÚDistutilsError)Ú translate)ÚWheelz^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)Ú PackageIndexÚdistros_for_urlÚparse_bdist_wininstÚinterpret_distro_nameézs$            rc Csxtj |¡}|\}}}}}}tj | d¡d¡}|dkrX|dkrXtj | d¡d¡}d|vrp| dd¡\}}||fS)Nú/éÿÿÿÿzsourceforge.netÚdownloadéþÿÿÿú#é)ÚurllibrÚurlparseÚunquoteÚsplit) ÚurlÚpartsÚschemeÚserverÚpathÚ parametersÚqueryÚfragmentr*r r r!Úegg_info_for_urlVs r>ccs\t|ƒ\}}t|||ƒD] }|Vq|rXt |¡}|rXt|| d¡|tdD] }|VqLdS)zEYield egg or source distribution objects that might be found at a URLr1)Ú precedenceN)r>Údistros_for_locationÚ EGG_FRAGMENTÚmatchrÚgroupr)r6Úmetadatar*r=ÚdistrBr r r!ras  ÿ rcCsä| d¡r|dd…}| d¡r8d|vr8t |||¡gS| d¡rxd|vrxt|ƒ}| ¡s^gSt||j|jtddgS| d ¡rªt|ƒ\}}}|durªt ||||t |ƒSt D]0}| |¡r®|dt |ƒ …}t |||ƒSq®gS) z:Yield egg or source distribution objects based on basenameú.egg.zipNr%z.eggú-z.whlr1)ÚlocationÚ project_nameÚversionr?r#) r'rZ from_locationrZ is_compatiblerIrJrrrrÚ EXTENSIONSÚlen)rHÚbasenamerDZwheelZwin_baser+ÚplatformÚextr r r!r@os2  û  ÿ r@cCstt|ƒtj |¡|ƒS)zEYield possible egg or source distribution objects based on a filename)r@rÚosr:rM)ÚfilenamerDr r r!Údistros_for_filenamesÿrRc cs|| d¡}|s,tdd„|dd…Dƒƒr,dStdt|ƒdƒD]8}t||d |d|…¡d ||d…¡|||dVq>dS)zØGenerate 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! rGcss|]}t d|¡VqdS)z py\d\.\d$N)ÚrerB)Ú.0Úpr r r!Ú ®óz(interpret_distro_name..éNr1)Ú py_versionr?rN)r5ÚanyÚrangerLrÚjoin)rHrMrDrYr?rNr7rUr r r!r—s $ýrccsdtƒ}|j}|dur8t |j|¡D]}||ƒ|Vq"n(|D]"}||ƒ}||vr<||ƒ|Vq.wrapperr)rlrmr rkr!Ú unique_valuesÍsrnz(<([^>]*\srel\s*=\s*['"]?([^'">]+)[^>]*)>c csºt |¡D]d}| ¡\}}tttj| ¡ d¡ƒƒ}d|vsDd|vr t  |¡D]}t j   |t | d¡ƒ¡VqNq dD]@}| |¡}|dkrtt  ||¡}|rtt j   |t | d¡ƒ¡VqtdS)zEFind rel="homepage" and rel="download" links in `page`, yielding URLsú,Zhomepager.r1)z Home PagezDownload URLr-N)ÚRELÚfinditerÚgroupsr]ÚmapÚstrÚstripr&r5ÚHREFr2rÚurljoinÚ htmldecoderCÚfindÚsearch)r6ÚpagerBÚtagÚrelZrelsÚposr r r!Úfind_external_linksÞs   rc@s(eZdZdZdd„Zdd„Zdd„ZdS) ÚContentCheckerzP A null content checker that defines the interface for checking content cCsdS)z3 Feed a block of data to the hash. Nr ©ÚselfÚblockr r r!ÚfeedöszContentChecker.feedcCsdS)zC Check the hash. Return False if validation fails. Tr ©r‚r r r!Úis_validüszContentChecker.is_validcCsdS)zu Call reporter with information about the checker (hash name) substituted into the template. Nr )r‚ÚreporterÚtemplater r r!ÚreportszContentChecker.reportN)Ú__name__Ú __module__Ú __qualname__Ú__doc__r„r†r‰r r r r!r€ñsr€c@sBeZdZe d¡Zdd„Zedd„ƒZdd„Z dd „Z d d „Z d S) Ú HashCheckerzK(?Psha1|sha224|sha384|sha256|sha512|md5)=(?P[a-f0-9]+)cCs||_t |¡|_||_dSrh)Ú hash_nameÚhashlibÚnewÚhashÚexpected)r‚rr“r r r!Ú__init__s zHashChecker.__init__cCsBtj |¡d}|stƒS|j |¡}|s0tƒS|fi| ¡¤ŽS)z5Construct a (possibly null) ContentChecker from a URLr-)r2rr3r€ÚpatternrzÚ groupdict)Úclsr6r=rBr r r!Úfrom_urls zHashChecker.from_urlcCs|j |¡dSrh)r’Úupdaterr r r!r„ szHashChecker.feedcCs|j ¡|jkSrh)r’Ú hexdigestr“r…r r r!r†#szHashChecker.is_validcCs||j}||ƒSrh)r)r‚r‡rˆÚmsgr r r!r‰&s zHashChecker.reportN) rŠr‹rŒrSÚcompiler•r”Ú classmethodr˜r„r†r‰r r r r!rŽ sÿ rŽcsDeZdZdZdLdd„ZdMd d „ZdNd d „ZdOd d„Zdd„Zdd„Z dd„Z dd„Z dd„Z dPdd„Z dd„ZdQ‡fdd„ Zdd „Zd!d"„Zd#d$„Zd%d&„Zd'd(„ZdRd)d*„ZdSd+d,„Zd-d.„Zd/Zd0d1„Zd2d3„ZdTd4d5„Zd6d7„Zd8d9„Zd:d;„Zdd?„Z e!dUd@dA„ƒZ"dBdC„Z#dDdE„Z$dFdG„Z%dHdI„Z&dJdK„Z'‡Z(S)Vrz;A distribution index that scans web pages for download URLsúhttps://pypi.org/simple/©Ú*NTcOsštj|g|¢Ri|¤Ž|dd| d¡ …|_i|_i|_i|_t d  t t |ƒ¡¡j |_ g|_|oxtjox|pxt ¡}|rŒt |¡|_n tjj|_dS)Nr,ú|)r r”r'Ú index_urlÚ scanned_urlsÚ fetched_urlsÚ package_pagesrSrœr\rsrrBÚallowsÚto_scanrZ is_availableZfind_ca_bundleZ opener_forÚopenerr2ÚrequestÚurlopen)r‚r¢ZhostsZ ca_bundleZ verify_sslriÚkwZuse_sslr r r!r”.sÿ ýzPackageIndex.__init__Fc Csâ||jvr|sdSd|j|<t|ƒs2| |¡dStt|ƒƒ}|r\| |¡sPdS| d|¡|sn|rn||jvr‚tt|j |ƒƒdS| |¡sšd|j|<dS|  d|¡d|j|<d}|  |||¡}|durÐdSt |t jjƒrø|jdkrø|  d|j¡d|j|j<d|j d d ¡ ¡vr(| ¡dS|j}| ¡}t |tƒsvt |t jjƒrXd }n|j d ¡phd }| |d ¡}| ¡t |¡D](} t j |t|   d¡ƒ¡} | !| ¡qˆ| "|j#¡rÞt$|ddƒdkrÞ| %||¡}dS)z.)ÚfilterrPr:rËrµr_ÚstarmapÚ scan_egg_link)r‚Z search_pathÚdirsZ egg_linksr r r!Úscan_egg_links–s þzPackageIndex.scan_egg_linkscCs¢ttj ||¡ƒ&}ttdttj|ƒƒƒ}Wdƒn1s>0Yt |ƒdkrXdS|\}}t tj ||¡ƒD]*}tjj|g|¢RŽ|_ t |_ | |¡qrdS)NrX)ÚopenrPr:r\rµrÖrsrtrurLr rHrr?r^)r‚r:rÕZ raw_linesÚlinesZegg_pathZ setup_pathrEr r r!rØ s4 zPackageIndex.scan_egg_linkcCs”d}| |j¡s|Stttjj|t|jƒd… d¡ƒƒ}t|ƒdksRd|dvrV|St |dƒ}t |dƒ}d|j   |  ¡i¡|<t|ƒt|ƒfS)N)NNr,rXr0r1rT)r(r¢rµrsr2rr4rLr5r r r¥Ú setdefaultr&r )r‚rÈZNO_MATCH_SENTINELr7ÚpkgÚverr r r!Ú_scan°s ÿ  zPackageIndex._scanc CsÀt |¡D]:}z"| tj |t| d¡ƒ¡¡Wq tyBYq 0q | |¡\}}|s\dSt ||ƒD]H}t |ƒ\}}|  d¡r¤|s¤|rš|d||f7}n |  |¡|  |¡qft dd„|¡S)z#Process the contents of a PyPI pager1r®ú.pyz #egg=%s-%scSsd| ddd¡S)Nz%sr1érX)rC)Úmr r r!ÚÜrWz,PackageIndex.process_index..)rvrqràr2rrwrxrCrrr>r'Úneed_version_infoÚscan_urlÚPYPI_MD5Úsub) r‚r6r{rBrÞrßÚnew_urlr*Úfragr r r!rÄÂs$"    ÿzPackageIndex.process_indexcCs| d|¡dS)NzPPage at %s links to .py file(s) without version info; an index scan is required.)Úscan_all©r‚r6r r r!råßsþzPackageIndex.need_version_infocGs<|j|jvr,|r"|j|g|¢RŽ| d¡| |j¡dS)Nz6Scanning index of all packages (this may take a while))r¢r¤rÊr¸ræ©r‚r›rir r r!rëås ÿzPackageIndex.scan_allcCsz| |j|jd¡|j |j¡s:| |j|jd¡|j |j¡sR| |¡t|j |jd¡ƒD]}| |¡qfdS)Nr,r ) rær¢Ú unsafe_namer¥r¾rcrIÚnot_found_in_indexrµ)r‚Ú requirementr6r r r!Ú find_packagesîs zPackageIndex.find_packagescsR| ¡| |¡||jD]"}||vr0|S| d||¡qtt|ƒ ||¡S)Nz%s does not match %s)Úprescanrñrcr·ÚsuperrÚobtain)r‚rðZ installerrE©Ú __class__r r!rôýs zPackageIndex.obtaincCsL| |jd|¡| ¡sH| ¡t |¡td|jjtj   |¡fƒ‚dS)z- checker is a ContentChecker zValidating %%s checksum for %sz7%s validation failed for %s; possible download problem?N) r‰r·r†r¿rPÚunlinkrr’r)r:rM)r‚ÚcheckerrQÚtfpr r r!Ú check_hashsþ þÿzPackageIndex.check_hashcCsN|D]D}|jdus0t|ƒr0| d¡s0tt|ƒƒr<| |¡q|j |¡qdS)z;Add `urls` to the list that will be prescanned for searchesNúfile:)r§r³r(rµrræÚappend)r‚Zurlsr6r r r!Úadd_find_linkssÿþý ü zPackageIndex.add_find_linkscCs"|jrtt|j|jƒƒd|_dS)z7Scan urls scheduled for prescanning (e.g. --find-links)N)r§rµrsrær…r r r!rò%szPackageIndex.prescancCs<||jr|jd}}n |jd}}|||jƒ| ¡dS)Nz#Couldn't retrieve index page for %rz3Couldn't find index page for %r (maybe misspelled?))rcr¸rÊrîrë)r‚rðÚmethr›r r r!rï+s þ zPackageIndex.not_found_in_indexcCs~t|tƒsjt|ƒ}|rR| | d¡||¡}t|ƒ\}}| d¡rN| |||¡}|Stj   |¡rb|St |ƒ}t |  ||¡ddƒS)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. r1rárHN)rºrr³Ú _download_urlrCr>r'Ú gen_setuprPr:rÉr"rÃÚfetch_distribution)r‚rÚtmpdirr8Úfoundr*r=r r r!r.5s    zPackageIndex.downloadc s܈ d|¡i‰d}d ‡‡‡‡‡fdd„ }|rHˆ ¡ˆ |¡||ƒ}|s^|dur^|||ƒ}|dur€ˆjdurxˆ ¡||ƒ}|durž|sžˆ |¡||ƒ}|dur¾ˆ dˆr´dp¶d|¡nˆ d|¡|j|jd SdS) a|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. zSearching for %sNcs’|dur ˆ}||jD]v}|jtkrFˆsF|ˆvrˆ d|¡dˆ|<q||vo\|jtkp\ˆ }|rˆ |jˆ¡}||_tj   |j¡r|SqdS)Nz&Skipping development or system egg: %sr1) rcr?rrÊrr.rHÚdownload_locationrPr:rÉ)ZreqÚenvrEÚtestÚloc©Ú develop_okr‚ZskippedÚsourcerr r!ryos$ÿþz-PackageIndex.fetch_distribution..findz:No local packages or working download links found for %s%sza source distribution of r®zBest match: %s)rH)N)r¸ròrñr§rÊZcloner) r‚rðrÚ force_scanr r Z local_indexrEryr rr!rWs2        ý zPackageIndex.fetch_distributioncCs"| ||||¡}|dur|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)rrH)r‚rðrr r rEr r r!Úfetch£szPackageIndex.fetchc Cst |¡}|r*dd„t|| d¡dƒDƒp,g}t|ƒdkrîtj |¡}tj |¡|krŠtj  ||¡}ddl m }|||ƒsŠt   ||¡|}ttj  |d¡dƒ<} |  d|dj|djtj |¡df¡Wdƒn1sà0Y|S|rtd ||fƒ‚ntd ƒ‚dS) NcSsg|]}|jr|‘qSr )rJ)rTÚdr r r!Ú ²sÿz*PackageIndex.gen_setup..r1r)Úsamefilezsetup.pyÚwzIfrom setuptools import setup setup(name=%r, version=%r, py_modules=[%r]) z†Can't unambiguously interpret project/version identifier %r; any dashes in the name or version should be escaped using underscores. %rzpCan't process plain .py files without an '#egg=name-version' suffix to enable automatic setup script generation.)rArBrrCrLrPr:rMÚdirnamer\Zsetuptools.command.easy_installrÚshutilÚcopy2rÛÚwriterIrJÚsplitextr) r‚rQr=rrBrÅrMÚdstrrÑr r r!r°s@  þý     þþÿ"þÿÿzPackageIndex.gen_setupi c Cs:| d|¡d}zt |¡}| |¡}t|tjjƒrLtd||j |j fƒ‚| ¡}d}|j }d}d|vr”|  d¡} t tt| ƒƒ}| |||||¡t|dƒ`} | |¡} | râ| | ¡|  | ¡|d7}| |||||¡q qâq | ||| ¡Wdƒn1s0Y|W|r"| ¡Sn|r4| ¡0dS) NzDownloading %szCan't download %s: %s %srr-zcontent-lengthzContent-LengthÚwbr1)r¸rŽr˜r¹rºr2r»r¼rr±r›Ú dl_blocksizeZget_allÚmaxrsÚintÚ reporthookrÛrÀr„rrúr¿) r‚r6rQÚfprør½ÚblocknumÚbsÚsizeZsizesrùrƒr r r!Ú _download_toÛsD   ÿ     .ýÿzPackageIndex._download_tocCsdSrhr )r‚r6rQrZblksizerr r r!rÿszPackageIndex.reporthookc Cs®| d¡rt|ƒSzt||jƒWSttjjfyˆ}zHd dd„|j Dƒ¡}|r`|  ||¡nt d||fƒ|‚WYd}~n*d}~0t j jy²}z|WYd}~Sd}~0t j jy}z4|rÚ|  ||j¡nt d||jfƒ|‚WYd}~n°d}~0tjjyT}z6|r,|  ||j¡nt d||jfƒ|‚WYd}~n^d}~0tjjtj fy¨}z2|r‚|  ||¡nt d||fƒ|‚WYd}~n d}~00dS)Nrûú cSsg|] }t|ƒ‘qSr )rt)rTÚargr r r!r rWz)PackageIndex.open_url..z%s %szDownload error for %s: %sz;%s returned a bad status line. The server might be down, %s)r(Ú local_openÚopen_with_authr¨rÚhttpÚclientÚ InvalidURLr\rirÊrr2r»r¼ÚURLErrorÚreasonZ BadStatusLineÚlineZ HTTPExceptionÚsocket)r‚r6ÚwarningÚvr›r r r!r¹sJ (ÿÿþÿüÿÿzPackageIndex.open_urlcCsæt|ƒ\}}|r0d|vr4| dd¡ dd¡}qnd}| d¡rJ|dd…}tj ||¡}|dksj| d ¡rv| ||¡S|d ksˆ| d ¡r”| ||¡S| d ¡rª|  ||¡S|d krÊt j   t j  |¡d¡S| |d¡| ||¡SdS)Nz..Ú.ú\Ú_Z__downloaded__rFr%Úsvnzsvn+Úgitzgit+zhg+rÑrXT)r>Úreplacer'rPr:r\r(Ú _download_svnÚ _download_gitÚ _download_hgr2r©Ú url2pathnamerr3r¶Ú_attempt_download)r‚r8r6rr)r=rQr r r!rÿ&s$        zPackageIndex._download_urlcCs| |d¡dS)NT)rÂrìr r r!ræCszPackageIndex.scan_urlcCs6| ||¡}d| dd¡ ¡vr.| |||¡S|SdS)Nr¬r­r®)r r¾r&Ú_download_html)r‚r6rQr½r r r!r8Fs zPackageIndex._attempt_downloadcCsnt|ƒ}|D]>}| ¡r t d|¡rF| ¡t |¡| ||¡SqLq | ¡t |¡td|ƒ‚dS)Nz ([^- ]+ - )?Revision \d+:zUnexpected HTML page found at ) rÛ���ru���rS���rz���r¿���rP���r÷���r4��r���)r‚���r6���r½���rQ���rÑ���r*��r ���r ���r!���r9��M��s����   zPackageIndex._download_htmlc�����������������C���s��t� dt¡�| dd¡d�}d}| ¡� d¡râd|v�râtj |¡\}}}}}} |sâ| d¡râd |d d�…�v�râ|d d�…� d d¡\}}t |ƒ\} } | râd | v�rº|  d d¡\} } d | | f�}nd | �}| }|||||| f}tj  |¡}|�  d||¡�t   d|||f�¡�|S�)Nz"SVN download support is deprecatedr0���r1���r���r®���zsvn:ú@z//r,���rX���ú:z --username=%s --password=%sz --username=z'Doing subversion checkout from %s to %szsvn checkout%s -q %s %s)ÚwarningsrÊ���Ú UserWarningr5���r&���r(���r2���r���r3���Ú _splituserÚ urlunparser¸���rP���Úsystem)r‚���r6���rQ���Zcredsr8���Únetlocr:���rU���ÚqrÇ���ÚauthÚhostÚuserZpwr7���r ���r ���r!���r4��\��s&����   zPackageIndex._download_svnc�����������������C���sp���t�j |�¡\}}}}}| dd¡d�}| dd¡d�}d�}d|v�rR| dd¡\}}t�j ||||df¡}�|�|fS�)Nú+r1���r-���r0���r���r:��r®���)r2���r���Úurlsplitr5���ÚrsplitÚ urlunsplit)r6���Ú pop_prefixr8���rA��r:���r<���rê���Úrevr ���r ���r!���Ú_vcs_split_rev_from_urlr��s����z$PackageIndex._vcs_split_rev_from_urlc�����������������C���sl���| �dd¡d�}|�j|dd\}}|� d||¡�t d||f�¡�|d�urh|� d|¡�t d ||f�¡�|S�) Nr0���r1���r���T©rJ��zDoing git clone from %s to %szgit clone --quiet %s %szChecking out %szgit -C %s checkout --quiet %s©r5���rL��r¸���rP���r@��©r‚���r6���rQ���rK��r ���r ���r!���r5��„��s���� þzPackageIndex._download_gitc�����������������C���sl���| �dd¡d�}|�j|dd\}}|� d||¡�t d||f�¡�|d�urh|� d|¡�t d ||f�¡�|S�) Nr0���r1���r���TrM��zDoing hg clone from %s to %szhg clone --quiet %s %szUpdating to %szhg --cwd %s up -C -r %s -qrN��rO��r ���r ���r!���r6��”��s���� þzPackageIndex._download_hgc�����������������G���s���t�j|g|¢R�Ž��d�S�rh���)r���r·���rí���r ���r ���r!���r·���¤��s����zPackageIndex.debugc�����������������G���s���t�j|g|¢R�Ž��d�S�rh���)r���r¸���rí���r ���r ���r!���r¸���§��s����zPackageIndex.infoc�����������������G���s���t�j|g|¢R�Ž��d�S�rh���)r���rÊ���rí���r ���r ���r!���rÊ���ª��s����zPackageIndex.warn)rž���rŸ���NT)F)F)F)N)N)FFFN)FF)N)F))rŠ���r‹���rŒ���r���r”���rÂ���r´���r¶���rÚ���rØ���rà���rÄ���rå���rë���rñ���rô���rú���rý���rò���rï���r.���r��r ��r���r��r ��r��r¹���rÿ���ræ���r8��r9��r4��Ú staticmethodrL��r5��r6��r·���r¸���rÊ���Ú __classcell__r ���r ���rõ���r!���r���+��sR�����þ  5      #��þ L )$ # r���z!&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?c�����������������C���s���|� �d¡}t |¡S�)Nr���)rC���r¬���Zunescape)rB���Zwhatr ���r ���r!���Ú decode_entity³��s���� rR��c�����������������C���s ���t�t|�ƒ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_subrR��)Útextr ���r ���r!���rx���¸��s���� rx���c��������������������s���‡�fdd„}|S�)Nc��������������������s���‡�‡fdd„}|S�)Nc��������������� ������s>���t� ¡�}t� ˆ¡�zˆ�|�i�|¤ŽW�t� |¡�S�t� |¡�0�d�S�rh���)r+��ÚgetdefaulttimeoutÚsetdefaulttimeout)ri���rj���Z old_timeout)rl���Útimeoutr ���r!���Ú_socket_timeoutÆ��s����  þz@socket_timeout.<locals>._socket_timeout.<locals>._socket_timeoutr ���)rl���rX��©rW��rk���r!���rX��Å��s����z'socket_timeout.<locals>._socket_timeoutr ���)rW��rX��r ���rY��r!���Úsocket_timeoutÄ��s���� rZ��c�����������������C���s2���t�j |�¡}| ¡�}t |¡}| ¡�}| dd¡S�)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®���)r2���r���r4���ÚencodeÚbase64Z b64encoderÁ���r3��)rC��Zauth_sZ auth_bytesZ encoded_bytesÚencodedr ���r ���r!���Ú _encode_authÓ��s ����  r_��c�������������������@���s(���e�Zd�ZdZdd„�Zdd„�Zdd„�ZdS�) Ú Credentialz: A username/password pair. Use like a namedtuple. c�����������������C���s���||�_�||�_d�S�rh���©ÚusernameÚpassword)r‚���rb��rc��r ���r ���r!���r”���í��s����zCredential.__init__c�����������������c���s���|�j�V��|�jV��d�S�rh���ra��r…���r ���r ���r!���Ú__iter__ñ��s����zCredential.__iter__c�����������������C���s ���dt�|�ƒ�S�)Nz%(username)s:%(password)s)Úvarsr…���r ���r ���r!���Ú__str__õ��s����zCredential.__str__N)rŠ���r‹���rŒ���r���r”���rd��rf��r ���r ���r ���r!���r`��è��s���r`��c�������������������@���s0���e�Zd�Zdd„�Zedd„�ƒZdd„�Zdd„�Zd S�) Ú PyPIConfigc�����������������C���sN���t� g�d¢d¡}tj |�|¡�tj tj d¡d¡}tj  |¡rJ|�  |¡�dS�)z% Load from ~/.pypirc )rb��rc��Ú repositoryr®���ú~z.pypircN) ÚdictÚfromkeysÚ configparserÚRawConfigParserr”���rP���r:���r\���Ú expanduserrÉ���rÀ���)r‚���ÚdefaultsÚrcr ���r ���r!���r”���ú��s ���� zPyPIConfig.__init__c��������������������s&���‡�fdd„ˆ� �¡�D�ƒ}ttˆ�j|ƒƒS�)Nc��������������������s ���g�|�]}ˆ� �|d�¡ ¡�r|‘qS�)rh��)r¾���ru���)rT���Úsectionr…���r ���r!���r����s���ÿz2PyPIConfig.creds_by_repository.<locals>.<listcomp>)Zsectionsrj��rs���Ú_get_repo_cred)r‚���Zsections_with_repositoriesr ���r…���r!���Úcreds_by_repository��s���� ÿzPyPIConfig.creds_by_repositoryc�����������������C���s6���|� �|d¡ ¡�}|t|� �|d¡ ¡�|� �|d¡ ¡�ƒfS�)Nrh��rb��rc��)r¾���ru���r`��)r‚���rq��Zrepor ���r ���r!���rr����s ����þzPyPIConfig._get_repo_credc�����������������C���s*���|�j� ¡�D�]\}}| |¡r |��S�q dS�)zŒ If the URL indicated appears to be a repository defined in this config, return the credential for that repository. N)rs��Úitemsr(���)r‚���r6���rh��Úcredr ���r ���r!���Úfind_credential��s���� zPyPIConfig.find_credentialN)rŠ���r‹���rŒ���r”���Úpropertyrs��rr��rv��r ���r ���r ���r!���rg��ù��s ���  rg��c�����������������C���s@��t�j |�¡}|\}}}}}}| d¡r2tj d¡‚|dv�rHt|ƒ\} } nd} | s„tƒ�  |�¡} | r„t | ƒ} | j |�f} t j dg| ¢R�Ž��| rÊdt| ƒ�} || ||||f} t�j | ¡}t�j |¡}| d| ¡�n t�j |�¡}| dt¡�||ƒ}| r<t�j |j¡\}}}}}}||kr<|| kr<||||||f} t�j | ¡|_|S�) z4Open a urllib2 request, handling HTTP authenticationr;��znonnumeric port: '')r%��ÚhttpsNz*Authenticating as %s for %s (from .pypirc)zBasic Z Authorizationz User-Agent)r2���r���r3���r'���r%��r&��r'��r>��rg��rv��rt���rb��r���r¸���r_��r?��r©���ZRequestZ add_headerÚ user_agentr6���)r6���r¨���Úparsedr8���rA��r:���Úparamsr<���rê���rC��Úaddressru��r¸���r7���ré���r©���r��Ús2Zh2Zpath2Zparam2Zquery2Zfrag2r ���r ���r!���r$����s8����          r$��c�����������������C���s ���|� �d¡\}}}�|r|nd|�fS�)zNsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.r:��N)Ú rpartition)rD��rE��Údelimr ���r ���r!���r>��N��s����r>��c�����������������C���s���|�S�rh���r ���)r6���r ���r ���r!���Ú fix_sf_urlY��s����r€��c�������������� ���C���s,��t�j |�¡\}}}}}}t�j |¡}tj |¡r<t�j |�¡S�|  d¡rütj  |¡rüg�}t  |¡D�]x} tj  || ¡} | dkr²t | dƒ} |  ¡�} W�d��ƒ�n1�s¢0����Y���qòntj  | ¡rÆ| d7�} | dj| d¡�q`d} | j|�d  |¡d } d \}}n d \}}} d d i}t | ¡}t�j |�||||¡S�)z7Read a local path, with special support for directoriesr,���z index.htmlÚrNz<a href="{name}">{name}</a>)r)���zB<html><head><title>{url}{files}r[)r6Úfiles)éÈZOK)r²zPath not foundz Not foundr­z text/html)r2rr3r©r7rPr:Úisfilerªr'rËrÍr\rÛrÀrüÚformatÚioÚStringIOr»r¼)r6r8r9r:Zparamr<rêrQr‚rÇÚfilepathrÚbodyrÆÚstatusÚmessager½Z body_streamr r r!r#]s.    & ÿ   r#)N)N)N)N)r)YrÚsysrPrSr†rr+r]rr_r<rlr¬Z http.clientr%Ú urllib.parser2Zurllib.requestZ urllib.errorÚ functoolsrrZ pkg_resourcesrrrrrr r r r r rrrrZ distutilsrZdistutils.errorsrÚfnmatchrZsetuptools.wheelrrœrAÚIrvrçrBr³r5rKÚ__all__Z_SOCKET_TIMEOUTZ_tmplr…Ú version_inforyr"rr>rr@rRrrgrnrprr€rŽrrèrSrRrxrZr_r`rmrgr©rªr$r>r€r#r r r r!ÚsŽ <      ÿ ÿ   ! þ $   !  &/