a (šReΛã@sŒdZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl ZddlZddlZddlZddlmZddlZddlmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#ddl$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+dd l,m-Z-e .d ¡Z/e .d ej0¡Z1e .d ¡Z2e .d ej0¡j3Z4d 5¡Z6gd¢Z7dZ8dZ9e9j:dj:ej;ŽedZdd„Z?dBdd„Z@dCdd„ZAdDdd„ZBdedfd d!„ZCd"d#„ZDe .d$ej0¡ZEeDd%d&„ƒZFGd'd(„d(ƒZGGd)d*„d*eGƒZHGd+d,„d,eƒZIe .d-¡jJZKd.d/„ZLd0d1„ZMdEd2d3„ZNd4d5„ZOGd6d7„d7ƒZPGd8d9„d9e jQƒZRejSjTfd:d;„ZUdd?„ZWd@dA„ZXdS)Fz#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)Úlog)ÚDistutilsError)Ú translate)ÚWheel©Úunique_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)Ú PackageIndexÚdistros_for_urlÚparse_bdist_wininstÚinterpret_distro_nameézdS)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! rIcss|]}t d|¡VqdS)z py\d\.\d$N)ÚrerD)Ú.0Úpr!r!r"Ú ¯óz(interpret_distro_name..éNr3)Ú py_versionrArS)r7ÚanyÚrangerPrÚjoin)rJrQrFr^rArSr9rZr!r!r"r˜s $ýrcstˆƒ‡fdd„ƒ}|S)zs Wrap a function returning an iterable such that the resulting iterable only ever yields unique items. cstˆ|i|¤ŽƒS©Nr)ÚargsÚkwargs©Úfuncr!r"ÚwrapperÁszunique_values..wrapperr)rfrgr!rer"Ú unique_values»srhz(<([^>]*\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ú,Zhomepager0r3)z Home PagezDownload URLr/N)ÚRELÚfinditerÚgroupsÚsetÚmapÚstrÚstripr'r7ÚHREFr4rÚurljoinÚ htmldecoderEÚfindÚsearch)r8ÚpagerDÚtagÚrelZrelsÚposr!r!r"Úfind_external_linksÌs   rzc@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"ÚreportðszContentChecker.reportN)Ú__name__Ú __module__Ú __qualname__Ú__doc__rrr„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 |¡|_||_dSrb)Ú hash_nameÚhashlibÚnewÚhashÚexpected)r}rŠrŽr!r!r"Ú__init__þs zHashChecker.__init__cCsBtj |¡d}|stƒS|j |¡}|s0tƒS|fi| ¡¤ŽS)z5Construct a (possibly null) ContentChecker from a URLr/)r4rr5r{ÚpatternruÚ groupdict)Úclsr8r?rDr!r!r"Úfrom_urls zHashChecker.from_urlcCs|j |¡dSrb)rÚupdater|r!r!r"rszHashChecker.feedcCs|j ¡|jkSrb)rÚ hexdigestrŽr€r!r!r"rszHashChecker.is_validcCs||j}||ƒSrb)rŠ)r}r‚rƒÚmsgr!r!r"r„s zHashChecker.reportN) r…r†r‡rXÚcompilerrÚ classmethodr“rrr„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/©Ú*NTcOsrtj|g|¢Ri|¤Ž|dd| d¡ …|_i|_i|_i|_t d  t t |ƒ¡¡j |_ g|_tjj|_dS)Nr.ú|)r rr(Ú index_urlÚ scanned_urlsÚ fetched_urlsÚ package_pagesrXr—rarnrrDÚallowsÚto_scanr4ÚrequestÚurlopenÚopener)r}rÚhostsZ ca_bundleZ verify_sslrcÚkwr!r!r"rszPackageIndex.__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.)ÚfilterrUr<rÊr±Ú itertoolsÚstarmapÚ scan_egg_link)r}Ú 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)Nr])ÚopenrUr<rar±rÕrnrorprPr rJrrAr´)r}r<rÔZ raw_linesÚlinesZegg_pathZ setup_pathrGr!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.r]r2r3rT)r)rr±rnr4rr6rPr7r r r Ú setdefaultr'r )r}rÇZNO_MATCH_SENTINELr9Ú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 pager3rªú.pyz #egg=%s-%scSsd| ddd¡S)Nz%sr3ér])rE)Úmr!r!r"ÚÂr\z,PackageIndex.process_index..)rqrkrár4rrrrsrErrzr@r(Úneed_version_infoÚscan_urlÚPYPI_MD5Úsub) r}r8rvrDrß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}r8r!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))rrŸrÉrµrç©r}r–rcr!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»ÚkeyrKÚnot_found_in_indexr±)r}Ú requirementr8r!r!r"Ú find_packagesÔs zPackageIndex.find_packagescsR| ¡| |¡||jD]"}||vr0|S| d||¡qtt|ƒ ||¡S)Nz%s does not match %s)Úprescanrórðr³ÚsuperrÚobtain)r}ròÚ installerrG©Ú __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³rr¼rUÚunlinkrrr*r<rQ)r}ÚcheckerrVÚtfpr!r!r"Ú check_hashìsþ þÿ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}Úurlsr8r!r!r"Úadd_find_linksüsÿþý ü zPackageIndex.add_find_linkscCs"|jrtt|j|jƒƒd|_dS)z7Scan urls scheduled for prescanning (e.g. --find-links)N)r¢r±rnrç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?))rðrµ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. r3rârJN)r·rr¯Ú _download_urlrEr@r(Ú gen_setuprUr<rÈr#rÁÚfetch_distribution)r}rÚtmpdirr:Úfoundr+r?r!r!r"r0s    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: %sr3) rðrArrÉrr0rJÚdownload_locationrUr<rÈ)ÚreqÚenvrGÚtestÚloc©Ú develop_okr}ÚskippedÚsourcerr!r"rtUs$ÿþz-PackageIndex.fetch_distribution..findz:No local packages or working download links found for %s%sza source distribution of rªzBest match: %s)rJ)N)rµrôrór¢rÉÚcloner) r}ròrÚ force_scanrrZ local_indexrGrtr!r r"r=s2        ý 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)rrJ)r}ròrrrrGr!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!)rL)rYÚdr!r!r"Ú ˜sÿz*PackageIndex.gen_setup..r3r)Ú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.)rCrDrrErPrUr<rQÚdirnameraZsetuptools.command.easy_installrÚshutilÚcopy2rÜÚwriterKrLÚsplitextr) r}rVr?rrDrÄrQÚ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Úwbr3)rµr‰r“r¶r·r4r¸r¹rr­r–Ú dl_blocksizeÚget_allÚmaxrnÚintÚ reporthookrÜr½rrrýr¼) r}r8rVÚfprûrºÚblocknumÚbsÚsizeÚsizesrür~r!r!r"Ú _download_toÁsD   ÿ     .ýÿzPackageIndex._download_tocCsdSrbr!)r}r8rVr%Zblksizer'r!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!)ro)rYÚargr!r!r"rïr\z)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Ú InvalidURLrarcrÉrr4r¸r¹ÚURLErrorÚreasonÚ BadStatusLineÚlineÚ HTTPExceptionÚsocket)r}r8Ú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__rHr&Úsvnzsvn+Úgitzgit+zhg+rÐr]T)r@Úreplacer(rUr<rar)Ú _download_svnÚ _download_gitÚ _download_hgr4r£Ú url2pathnamerr5r²Ú_attempt_download)r}r:r8rr*r?rVr!r!r"r s$        zPackageIndex._download_urlcCs| |d¡dS)NT)rÀrír!r!r"rç)szPackageIndex.scan_urlcCs6| ||¡}d| dd¡ ¡vr.| |||¡S|SdS)Nr¨r©rª)r)r»r'Ú_download_html)r}r8rVrºr!r!r"rC,s zPackageIndex._attempt_downloadcCsnt|ƒ}|D]>}| ¡r t d|¡rF| ¡t |¡| ||¡SqLq | ¡t |¡td|ƒ‚dS)Nz ([^- ]+ - )?Revision \d+:zUnexpected HTML page found at ) rÜ���rp���rX���ru���r¼���rU���rú���r?��r���)r}���r8���rº���rV���rÐ���r4��r!���r!���r"���rD��3��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 deprecatedr2���r3���r���rª���zsvn:ú@z//r.���r]���ú:z --username=%s --password=%sz --username=z'Doing subversion checkout from %s to %szsvn checkout%s -q %s %s)ÚwarningsrÉ���Ú UserWarningr7���r'���r)���r4���r���r5���Ú _splituserÚ urlunparserµ���rU���Úsystem)r}���r8���rV���Úcredsr:���Únetlocr<���rZ���ÚqrÆ���ÚauthÚhostÚuserÚpwr9���r!���r!���r"���r?��B��s&����   zPackageIndex._download_svnc�����������������C���sp���t�j |�¡\}}}}}| dd¡d�}| dd¡d�}d�}d|v�rR| dd¡\}}t�j ||||df¡}�|�|fS�)Nú+r3���r/���r2���r���rE��rª���)r4���r���Úurlsplitr7���ÚrsplitÚ urlunsplit)r8���Ú pop_prefixr:���rM��r<���r>���rë���Úrevr!���r!���r"���Ú_vcs_split_rev_from_urlX��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�) Nr2���r3���r���T©rW��zDoing git clone from %s to %szgit clone --quiet %s %szChecking out %szgit -C %s checkout --quiet %s©r7���rY��rµ���rU���rK��©r}���r8���rV���rX��r!���r!���r"���r@��j��s���� þzPackageIndex._download_gitc�����������������C���sl���| �dd¡d�}|�j|dd\}}|� d||¡�t d||f�¡�|d�urh|� d|¡�t d ||f�¡�|S�) Nr2���r3���r���TrZ��zDoing hg clone from %s to %szhg clone --quiet %s %szUpdating to %szhg --cwd %s up -C -r %s -qr[��r\��r!���r!���r"���rA��z��s���� þzPackageIndex._download_hgc�����������������G���s���t�j|g|¢R�Ž��d�S�rb���)r���r³���rî���r!���r!���r"���r³���Š��s����zPackageIndex.debugc�����������������G���s���t�j|g|¢R�Ž��d�S�rb���)r���rµ���rî���r!���r!���r"���rµ�����s����zPackageIndex.infoc�����������������G���s���t�j|g|¢R�Ž��d�S�rb���)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ñ���r0���r��r��r��r��r)��r#��r¶���r��rç���rC��rD��r?��Ú staticmethodrY��r@��rA��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���)rE���r¨���Úunescape)rD���Úwhatr!���r!���r"���Ú decode_entity™��s���� ra��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_subra��)Útextr!���r!���r"���rs���ž��s���� rs���c��������������������s���‡�fdd„}|S�)Nc��������������������s���‡�‡fdd„}|S�)Nc��������������� ������s>���t� ¡�}t� ˆ¡�zˆ�|�i�|¤ŽW�t� |¡�S�t� |¡�0�d�S�rb���)r6��ÚgetdefaulttimeoutÚsetdefaulttimeout)rc���rd���Z old_timeout)rf���Útimeoutr!���r"���Ú_socket_timeout¬��s����  þz@socket_timeout.<locals>._socket_timeout.<locals>._socket_timeoutr!���)rf���rg��©rf��re���r"���rg��«��s����z'socket_timeout.<locals>._socket_timeoutr!���)rf��rg��r!���rh��r"���Úsocket_timeoutª��s���� ri��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ª���)r4���r���r6���ÚencodeÚbase64Ú b64encoder¿���r>��)rO��Zauth_sZ auth_bytesZ encoded_bytesÚencodedr!���r!���r"���Ú _encode_auth¹��s ����  ro��c�������������������@���s(���e�Zd�ZdZdd„�Zdd„�Zdd„�ZdS�) Ú Credentialz: A username/password pair. Use like a namedtuple. c�����������������C���s���||�_�||�_d�S�rb���©ÚusernameÚpassword)r}���rr��rs��r!���r!���r"���r���Ó��s����zCredential.__init__c�����������������c���s���|�j�V��|�jV��d�S�rb���rq��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���rt��rv��r!���r!���r!���r"���rp��Î��s���rp��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 )rr��rs��Ú repositoryrª���ú~z.pypircN) ÚdictÚfromkeysÚ configparserÚRawConfigParserr���rU���r<���ra���Ú expanduserrÈ���r½���)r}���ÚdefaultsÚrcr!���r!���r"���r���à��s ���� zPyPIConfig.__init__c��������������������s&���‡�fdd„ˆ� �¡�D�ƒ}ttˆ�j|ƒƒS�)Nc��������������������s ���g�|�]}ˆ� �|d�¡ ¡�r|‘qS�)rx��)r»���rp���)rY���Úsectionr€���r!���r"���r��í��s���ÿz2PyPIConfig.creds_by_repository.<locals>.<listcomp>)Úsectionsrz��rn���Ú_get_repo_cred)r}���Zsections_with_repositoriesr!���r€���r"���Úcreds_by_repositoryë��s���� ÿzPyPIConfig.creds_by_repositoryc�����������������C���s6���|� �|d¡ ¡�}|t|� �|d¡ ¡�|� �|d¡ ¡�ƒfS�)Nrx��rr��rs��)r»���rp���rp��)r}���r��Úrepor!���r!���r"���rƒ��ô��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)r„��Úitemsr)���)r}���r8���rx��Úcredr!���r!���r"���Úfind_credentialû��s���� zPyPIConfig.find_credentialN)r…���r†���r‡���r���Úpropertyr„��rƒ��rˆ��r!���r!���r!���r"���rw��ß��s ���  rw��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 authenticationrF��znonnumeric port: '')r.��ÚhttpsNz*Authenticating as %s for %s (from .pypirc)zBasic Ú Authorizationz User-Agent)r4���r���r5���r(���r.��r/��r0��rI��rw��rˆ��ro���rr��r���rµ���ro��rJ��r£���ÚRequestÚ add_headerÚ user_agentr8���)r8���r¥���Úparsedr:���rM��r<���Úparamsr>���rë���rO��Úaddressr‡��rµ���r9���rê���r£���r$��Ús2Úh2Zpath2Zparam2Zquery2Zfrag2r!���r!���r"���r-����s8����          r-��c�����������������C���s ���|� �d¡\}}}�|r|nd|�fS�)zNsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.rE��N)Ú rpartition)rP��rQ��Údelimr!���r!���r"���rI��4��s����rI��c�����������������C���s���|�S�rb���r!���)r8���r!���r!���r"���Ú fix_sf_url?��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}rj)r8Úfiles)éÈÚOK)r®zPath not foundz Not foundr©z text/html)r4rr5r£rBrUr<Úisfiler¤r(rÊrÌrarÜr½rÿÚformatÚioÚStringIOr¸r¹)r8r:r;r<Úparamr>rërVr˜rÆÚfilepathr$ÚbodyrÅÚstatusÚmessagerºZ body_streamr!r!r"r,Cs.    & ÿ   r,)N)N)N)r)YrˆÚsysrUrXrrr6rlr‹rÖrGr|r¨Ú http.clientr.Ú urllib.parser4Úurllib.requestÚ urllib.errorÚ functoolsrrÚ pkg_resourcesrrrrrr r r r r rrrÚ distutilsrÚdistutils.errorsrÚfnmatchrZsetuptools.wheelrZ setuptools.extern.more_itertoolsrr—rCÚIrqrèrDr¯r7rOÚ__all__Z_SOCKET_TIMEOUTZ_tmplrœÚ version_inforŽr#rr@rrBrWrrhrjrzr{r‰rrérbrarsrirorpr}rwr£r¤r-rIr–r,r!r!r!r"ÚsŒ <      ÿ ÿ   ! þ #  !  &/