a Ðöøcžã@sždZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z ddlmZmZmZmZddlZddlmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!ddlm"Z"ddl#m$Z$dd l%m&Z&dd l'm(Z(dd l)m*Z*dd l+m,Z,dd l-m.Z.e/Z0e 1d¡Z2e 1dej3¡Z4e 1d¡Z5e 1dej3¡j6Z7d 8¡Z9gd¢Z:dZ;dZŽedZ?dd„Z@dd„ZAdd„ZBdHdd„ZCdId d!„ZDdJd"d#„ZEdedfd$d%„ZFdKd&d'„ZGd(d)„ZHe 1d*ej3¡ZIeHd+d,„ƒZJGd-d.„d.ƒZKGd/d0„d0eKƒZLGd1d2„d2eƒZMe 1d3¡jNZOd4d5„ZPd6d7„ZQdLd8d9„ZRd:d;„ZSGdd?„d?ejUƒZVejWjXfd@dA„ZYdBdC„ZZeRe;ƒeYƒZYdDdE„Z[dFdG„Z\dS)Mz#PyPI and direct package downloadingéN©Úwraps)Úsix)ÚurllibÚ http_clientÚ configparserÚmap) Ú 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)Úget_all_headers)Úunescape)Ú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é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! rMcss|]}t d|¡VqdS)z py\d\.\d$N)ÚrerH)Ú.0Úpr&r&r'Ú ­óz(interpret_distro_name..éNr8)Ú py_versionrErW)r;ÚanyÚrangerTr Újoin)rNrUrJrbrErWr=r^r&r&r'r –s $ýr ccsftƒ}|j}|dur:tj |j|¡D]}||ƒ|Vq$n(|D]"}||ƒ}||vr>||ƒ|Vq>dS)zHList unique elements, preserving order. Remember all elements ever seen.N)ÚsetÚaddrÚmovesÚ filterfalseÚ __contains__)ÚiterableÚkeyÚseenZseen_addÚelementÚkr&r&r'Úunique_everseenºs rpcstˆƒ‡fdd„ƒ}|S)zs Wrap a function returning an iterable such that the resulting iterable only ever yields unique items. cstˆ|i|¤ŽƒS©N)rp)ÚargsÚkwargs©Úfuncr&r'ÚwrapperÒszunique_values..wrapperr)rurvr&rtr'Ú unique_valuesÌsrwz(<([^>]*\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ú,Zhomepager5r8)z Home PagezDownload URLr4N)ÚRELÚfinditerÚgroupsrfrÚstrÚstripr,r;ÚHREFrr#ÚurljoinÚ htmldecoderIÚfindÚsearch)r<ÚpagerHÚtagÚrelZrelsÚposr&r&r'Úfind_external_linksÝs   r‡c@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 |¡|_||_dSrq)Ú 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 URLr4)rr#r9rˆÚpatternr‚Ú groupdict)Úclsr<rCrHr&r&r'Úfrom_urls zHashChecker.from_urlcCs|j |¡dSrq)ršÚupdater‰r&r&r'rŒszHashChecker.feedcCs|j ¡|jkSrq)ršÚ hexdigestr›rr&r&r'rŽ"szHashChecker.is_validcCs||j}||ƒSrq)r—)rŠrrÚmsgr&r&r'r‘%s zHashChecker.reportN) r’r“r”r\ÚcompilerrœÚ classmethodr rŒrŽr‘r&r&r&r'r– sÿ r–cs<eZdZdZdJdd„ZdKd d „ZdLd d „ZdMd d„Zdd„Zdd„Z dd„Z dd„Z dNdd„Z dd„Z dO‡fdd„ Zdd„Zdd „Zd!d"„Zd#d$„Zd%d&„ZdPd'd(„ZdQd)d*„Zd+d,„Zd-Zd.d/„Zd0d1„ZdRd2d3„Zd4d5„Zd6d7„Zd8d9„Zd:d;„Zdd?„ƒZ!d@dA„Z"dBdC„Z#dDdE„Z$dFdG„Z%dHdI„Z&‡Z'S)Trz;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)Nr3ú|)rrœr-Ú index_urlÚ scanned_urlsÚ fetched_urlsÚ package_pagesr\r¤rerrrHÚallowsÚto_scanrZ is_availableZfind_ca_bundleZ opener_forÚopenerrÚrequestÚurlopen)rŠrªÚhostsZ ca_bundleZ verify_sslrrÚ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ÐdSd|j|j <d|j  dd¡ ¡vr| ¡dS|j }| ¡}t|tƒsNt|tjjƒr0d }n|j  d ¡p@d }| |d ¡}| ¡t |¡D](} tj |t|  d ¡ƒ¡} | | ¡q`|  |j!¡r¶t"|d dƒdkr¶| #||¡}dS)z.)ÚfilterrYr@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)Nra)ÚopenrYr@rer¾rárr|r}rTrrNr rErg)rŠr@ràZ raw_linesÚlinesZegg_pathZ setup_pathrKr&r&r'räœs4 zPackageIndex.scan_egg_linkc ṡfdd„}t |¡D]8}z |tj |t| d¡ƒ¡ƒWqtyLYq0q||ƒ\}}|rÄt||ƒD]H}t |ƒ\}} |  d¡r¨| s¨|rž|d||f7}n ˆ  |¡ˆ  |¡qjt  dd„|¡SdSd S) z#Process the contents of a PyPI pagecsŒ| ˆj¡rˆtttjj|tˆjƒd… d¡ƒƒ}t|ƒdkrˆd|dvrˆt |dƒ}t |dƒ}dˆj   |  ¡i¡|<t|ƒt|ƒfSdS)Nr3rar7r8rT)NN)r.rªr¾rrr#r:rTr;rrr­Ú setdefaultr,r)rÓr=ÚpkgÚverrr&r'Úscan¯s ÿ  z(PackageIndex.process_index..scanr8ú.pyz #egg=%s-%scSsd| ddd¡S)Nz%sr8éra)rI)Úmr&r&r'ÚÒr`z,PackageIndex.process_index..r·N)r~rzrr#rr€rIr$r‡rDr-Úneed_version_infoÚscan_urlÚPYPI_MD5Úsub) rŠr<rƒrírHrërìÚnew_urlr0Úfragr&rr'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Šr<r&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£rrr&r&r'røÝs ÿzPackageIndex.scan_allcCsz| |j|jd¡|j |j¡s:| |j|jd¡|j |j¡sR| |¡t|j |jd¡ƒD]}| |¡qfdS)Nr3r&) rórªÚ unsafe_namer­rÄrlrOÚnot_found_in_indexr¾)rŠÚ requirementr<r&r&r'Ú find_packagesæs zPackageIndex.find_packagescsR| ¡| |¡||jD]"}||vr0|S| d||¡qtt|ƒ ||¡S)Nz%s does not match %s)ÚprescanrþrlrÀÚsuperrÚobtain)rŠrýÚ installerrK©Ú __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ÅrYÚunlinkrršr/r@rU)rŠÚcheckerrZÚ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ŠÚurlsr<r&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¾rrórr&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?))rlrÁ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. r8rîrNN)rÇrr¼Ú _download_urlrIrDr-Ú gen_setuprYr@rÔr(rÍÚfetch_distribution)rŠr%Útmpdirr>Úfoundr0rCr&r&r'r5-s    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: %sr8) rlrErrÕr r5rNÚdownload_locationrYr@rÔ)ÚreqÚenvrKÚtestÚloc©Ú develop_okrŠÚskippedÚsourcerr&r'rgs$ÿþz-PackageIndex.fetch_distribution..findz:No local packages or working download links found for %s%sza source distribution of r·zBest match: %s)rN)N)rÁrÿrþr¯rÕÚcloner) rŠrýrÚ force_scanrrZ local_indexrKrr&rr'rOs2        ý 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)rrN)rŠrýrrrrKr&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&)rP)r]Údr&r&r'Ú ªsÿz*PackageIndex.gen_setup..r8r)Ú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.)rGrHr rIrTrYr@rUÚdirnamereZsetuptools.command.easy_installr!ÚshutilÚcopy2rèÚwriterOrPÚsplitextr) rŠrZrCrrHrÐrUÚdstr!rÜr&r&r'r¨s@  þý     þþÿ"þÿÿzPackageIndex.gen_setupi c Cs:| d|¡d}zt |¡}| |¡}t|tjjƒrLtd||j |j fƒ‚| ¡}d}|j }d}d|vr”t |dƒ} t tt| ƒƒ}| |||||¡t|dƒ`} | |¡} | râ| | ¡|  | ¡|d7}| |||||¡q qâq | ||| ¡Wdƒn1s0Y|W|r"| ¡Sn|r4| ¡0dS) NzDownloading %szCan't download %s: %s %srr4zcontent-lengthzContent-LengthÚwbr8)rÁr–r rÂrÇrrÈrÉrrºr£Ú dl_blocksizerÚmaxrÚintÚ reporthookrèrÆrŒr&rrÅ) rŠr<rZÚfprrÃÚblocknumÚbsÚsizeÚsizesrr‹r&r&r'Ú _download_toÓsD   ÿ     .ýÿzPackageIndex._download_tocCsdSrqr&)rŠr<rZr/Zblksizer1r&r&r'r-÷szPackageIndex.reporthookc Cs | d¡rt|ƒSzt||jƒWSttjfy„}zFd dd„|jDƒ¡}|r^|  ||¡nt d||fƒ‚WYd}~n d}~0t j j y®}z|WYd}~Sd}~0t j jyü}z2|rÖ|  ||j¡nt d||jfƒ‚WYd}~n¨d}~0tjyJ}z4|r$|  ||j¡nt d||jfƒ‚WYd}~nZd}~0tjtj fyš}z0|rv|  ||¡nt d||fƒ‚WYd}~n d}~00dS)Nr ú cSsg|] }t|ƒ‘qSr&)r|)r]Ú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$rÚ InvalidURLrerrrÕrrrÈrÉÚURLErrorÚreasonÚ BadStatusLineÚlineÚ HTTPExceptionÚsocket)rŠr<ÚwarningÚvr£r&r&r'rÂús> &ÿþÿÿ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__rLr+Úsvnzsvn+Úgitzgit+zhg+rÜraT)rDÚreplacer-rYr@rer.Ú _download_svnÚ _download_gitÚ _download_hgrr±Ú url2pathnamer#r9r¿Ú_attempt_download)rŠr>r<rr/rCrZr&r&r'rs$        zPackageIndex._download_urlcCs| |d¡dS)NT)rÌrùr&r&r'ró:szPackageIndex.scan_urlcCs6| ||¡}d| dd¡ ¡vr.| |||¡S|SdS)Nrµr¶r·)r3rÄr,Ú_download_html)rŠr<rZrÃr&r&r'rK=s zPackageIndex._attempt_downloadcCsnt|ƒ}|D]>}| ¡r t d|¡rF| ¡t |¡| ||¡SqLq | ¡t |¡td|ƒ‚dS)Nz ([^- ]+ - )?Revision \d+:zUnexpected HTML page found at ) rè���r}���r\���r‚���rÅ���rY���r��rG��r���)rŠ���r<���rÃ���rZ���rÜ���r<��r&���r&���r'���rL��D��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 deprecatedr7���r8���r���r·���zsvn:ú@z//r3���ra���ú:z --username=%s --password=%sz --username=z'Doing subversion checkout from %s to %szsvn checkout%s -q %s %s)ÚwarningsrÕ���Ú UserWarningr;���r,���r.���r���r#���r9���Ú _splituserÚ urlunparserÁ���rY���Úsystem)rŠ���r<���rZ���Úcredsr>���Únetlocr@���r^���ÚqrÒ���ÚauthÚhostÚuserÚpwr=���r&���r&���r'���rG��S��s&����   zPackageIndex._download_svnc�����������������C���sp���t�j |�¡\}}}}}| dd¡d�}| dd¡d�}d�}d|v�rR| dd¡\}}t�j ||||df¡}�|�|fS�)Nú+r8���r4���r7���r���rM��r·���)r���r#���Úurlsplitr;���ÚrsplitÚ urlunsplit)r<���Ú pop_prefixr>���rU��r@���rB���r÷���Úrevr&���r&���r'���Ú_vcs_split_rev_from_urli��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�) Nr7���r8���r���T©r_��zDoing git clone from %s to %szgit clone --quiet %s %szChecking out %szgit -C %s checkout --quiet %s©r;���ra��rÁ���rY���rS��©rŠ���r<���rZ���r`��r&���r&���r'���rH��{��s���� þzPackageIndex._download_gitc�����������������C���sl���| �dd¡d�}|�j|dd\}}|� d||¡�t d||f�¡�|d�urh|� d|¡�t d ||f�¡�|S�) Nr7���r8���r���Trb��zDoing hg clone from %s to %szhg clone --quiet %s %szUpdating to %szhg --cwd %s up -C -r %s -qrc��rd��r&���r&���r'���rI��‹��s���� þzPackageIndex._download_hgc�����������������G���s���t�j|g|¢R�Ž��d�S�rq���)r���rÀ���rú���r&���r&���r'���rÀ���›��s����zPackageIndex.debugc�����������������G���s���t�j|g|¢R�Ž��d�S�rq���)r���rÁ���rú���r&���r&���r'���rÁ���ž��s����zPackageIndex.infoc�����������������G���s���t�j|g|¢R�Ž��d�S�rq���)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ü���r5���r��r��r��r*��r3��r-��rÂ���r��ró���rK��rL��rG��Ú staticmethodra��rH��rI��rÀ���rÁ���rÕ���Ú __classcell__r&���r&���r��r'���r���*��sP�����þ  3   +   #��þ L )$ # r���z!&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?c�����������������C���s���|� �d¡}t|ƒS�)Nr���)rI���r���)rH���Úwhatr&���r&���r'���Ú decode_entityª��s���� rh��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_subrh��)Útextr&���r&���r'���r€���¯��s���� r€���c��������������������s���‡�fdd„}|S�)Nc��������������������s���‡�‡fdd„}|S�)Nc��������������� ������s>���t� ¡�}t� ˆ¡�zˆ�|�i�|¤ŽW�t� |¡�S�t� |¡�0�d�S�rq���)r>��ÚgetdefaulttimeoutÚsetdefaulttimeout)rr���rs���Z old_timeout)ru���Útimeoutr&���r'���Ú_socket_timeout½��s����  þz@socket_timeout.<locals>._socket_timeout.<locals>._socket_timeoutr&���)ru���rn��©rm��rt���r'���rn��¼��s����z'socket_timeout.<locals>._socket_timeoutr&���)rm��rn��r&���ro��r'���Úsocket_timeout»��s���� rp��c�����������������C���s2���t�j |�¡}| ¡�}t |¡}| ¡�}| dd¡S�)aq�� A function compatible with Python 2.3-3.3 that will 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:���ÚencodeÚbase64Ú b64encoderË���rF��)rW��Zauth_sZ auth_bytesZ encoded_bytesÚencodedr&���r&���r'���Ú _encode_authÊ��s ����  rv��c�������������������@���s(���e�Zd�ZdZdd„�Zdd„�Zdd„�ZdS�) Ú Credentialz: A username/password pair. Use like a namedtuple. c�����������������C���s���||�_�||�_d�S�rq���©ÚusernameÚpassword)rŠ���ry��rz��r&���r&���r'���rœ���å��s����zCredential.__init__c�����������������c���s���|�j�V��|�jV��d�S�rq���rx��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œ���r{��r}��r&���r&���r&���r'���rw��à��s���rw��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 )ry��rz��Ú repositoryr·���ú~z.pypircN) ÚdictÚfromkeysr���ÚRawConfigParserrœ���rY���r@���re���Ú expanduserrÔ���rÆ���)rŠ���ÚdefaultsÚrcr&���r&���r'���rœ���ò��s ���� zPyPIConfig.__init__c��������������������s&���‡�fdd„ˆ� �¡�D�ƒ}ttˆ�j|ƒƒS�)Nc��������������������s ���g�|�]}ˆ� �|d�¡ ¡�r|‘qS�)r��)rÄ���r}���)r]���Úsectionr���r&���r'���r ��ÿ��s���ÿz2PyPIConfig.creds_by_repository.<locals>.<listcomp>)Úsectionsr��r���Ú_get_repo_cred)rŠ���Zsections_with_repositoriesr&���r���r'���Úcreds_by_repositoryý��s���� ÿzPyPIConfig.creds_by_repositoryc�����������������C���s6���|� �|d¡ ¡�}|t|� �|d¡ ¡�|� �|d¡ ¡�ƒfS�)Nr��ry��rz��)rÄ���r}���rw��)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Š���r<���r��Úcredr&���r&���r'���Úfind_credential ��s���� zPyPIConfig.find_credentialN)r’���r“���r”���rœ���ÚpropertyrŠ��r‰��rŽ��r&���r&���r&���r'���r~��ñ��s ���  r~��c�����������������C���s>��t�j |�¡}|\}}}}}}| d¡r0t d¡‚|dv�rFt|ƒ\} } 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 authenticationrN��znonnumeric port: '')ÚhttpÚhttpsNz*Authenticating as %s for %s (from .pypirc)zBasic Ú Authorizationz User-Agent)r���r#���r9���r-���r���r8��rQ��r~��rŽ��r|���ry��r���rÁ���rv��rR��r±���ÚRequestÚ add_headerÚ user_agentr<���)r<���r°���Úparsedr>���rU��r@���ÚparamsrB���r÷���rW��Úaddressr��rÁ���r=���rö���r±���r.��Ús2Úh2Úpath2Zparam2Zquery2Zfrag2r&���r&���r'���r7����s8����          r7��c�����������������C���s ���|� �d¡\}}}�|r|nd|�fS�)zJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.rM��N)Ú rpartition)rX��rY��Údelimr&���r&���r'���rQ��F��s����rQ��c�����������������C���s���|�S�rq���r&���)r<���r&���r&���r'���Ú fix_sf_urlP��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 directoriesr3���z index.htmlÚrNz<a href="{name}">{name}</a>)r/���zB<html><head><title>{url}{files}rq)r<Úfiles)éÈÚOK)r»zPath not foundz Not foundr¶z text/html)rr#r9r±rJrYr@Úisfiler²r-rÖrØrerèrÆr ÚformatrÚStringIOrÈrÉ)r<r>r?r@ÚparamrBr÷rZr rÒÚfilepathr.ÚbodyrÑÚstatusÚmessagerÃZ body_streamr&r&r'r6Ts.    & ÿ   r6)N)N)N)N)r!)]r•ÚsysrYr\r$r>rsr˜rârOÚ functoolsrZsetuptools.externrZsetuptools.extern.six.movesrrrrr"Ú pkg_resourcesr r r r r rrrrrrrrrÚ distutilsrÚdistutils.errorsrÚfnmatchrZsetuptools.py27compatrZsetuptools.py33compatrZsetuptools.wheelrÚtypeÚ __metaclass__r¤rGÚIr~rôrHr¼r;rSÚ__all__Z_SOCKET_TIMEOUTZ_tmplr¤Ú version_infor•r(rrDrrFr[r rprwryr‡rˆr–rrõrirhr€rprvrwrƒr~r±r²r7rQržr6r&r&r&r'Ús†  <        ÿ   ! þ $   !  &/