\h7 ddlZddlmZddlZddlZddlZddlZddlZ ddlZddl Z ddl m Z ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZddlmZm Z m!Z!ddl"m#Z#m$Z$ddl%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-dd l.m/Z/m0Z0dd l1m2Z2m3Z3ejhe5Z6ejnd Z8ejnd ejrZ:ejnd Z;dZGdde?Z@Gdde@ZAGdde@ZBGdde?ZCGdde@ZDGdde@ZEGdde@ZFGd d!e@ZGGd"d#e@ZHeHeDd$d%&d'(ZIeIjZJGd)d*e?ZKy#e $rddl ZY]wxYw),N)BytesIO)DistlibException)urljoinurlparse urlunparse url2pathname pathname2urlqueuequoteunescape build_openerHTTPRedirectHandler text_typeRequest HTTPErrorURLError) DistributionDistributionPath make_dist)MetadataMetadataInvalidError)cached_property ensure_slashsplit_filenameget_project_dataparse_requirementparse_name_and_version ServerProxynormalize_name) get_schemeUnsupportedVersionError)Wheel is_compatiblez^(\w+)=([a-f0-9]+)z;\s*charset\s*=\s*(.*)\s*$ztext/html|application/x(ht)?mlzhttps://pypi.org/pypic|t}t|d} |j|dS#|dwxYw)z Return all distribution names known by an index. :param url: The URL of the index. :return: A list of all known distribution names. @timeoutclose) DEFAULT_INDEXr list_packages)urlclients _/root/niggaflix-v3/playground/venv/lib/python3.12/site-packages/pip/_vendor/distlib/locators.pyget_all_distribution_namesr/*sD  { c *F##%wws 4Ac"eZdZdZdZexZxZZy)RedirectHandlerzE A class to work around a bug in some Python 3.2.x releases. cd}dD] }||vs||}n|yt|}|jdk(r>t|j|}t |dr|j |n||<t j||||||S)N)locationurireplace_header)rschemer get_full_urlhasattrr6BaseRedirectHandlerhttp_error_302) selfreqfpcodemsgheadersnewurlkeyurlpartss r.r;zRedirectHandler.http_error_302Bs& Cg~   > F# ??b S--/8Fw 01&&sF3% "11$Rs29; ;N)__name__ __module__ __qualname____doc__r;http_error_301http_error_303http_error_307rEr.r1r19s;(8FENE^nrEr1ceZdZdZdZdZdZdZedzZddZ dZ d Z d Z d Z d Zee eZd ZdZdZdZdZdZdZdZdZddZy)LocatorzG A base class for locators - things that locate distributions. )z.tar.gzz.tar.bz2z.tarz.zipz.tgzz.tbz)z.eggz.exe.whl)z.pdfN)rPci|_||_tt|_d|_t j|_y)a^ Initialise an instance. :param scheme: Because locators look for most recent versions, they need to know the version scheme to use. This specifies the current PEP-recommended scheme - use ``'legacy'`` if you need to support existing distributions on PyPI. N) _cacher7rr1openermatcherr Queueerrors)r<r7s r.__init__zLocator.__init__is9  #?#45  kkm rEc@g}|jjsb |jjd}|j||jj |jjsb|S#|jj$rYwxYw)z8 Return any errors which have occurred. F)rVemptygetappendEmpty task_done)r<resultes r. get_errorszLocator.get_errors|s++##% KKOOE* a  KK ! ! # ++##% ;;$$  s,BBBc$|jy)z> Clear any errors which may have been logged. N)r`r<s r. clear_errorszLocator.clear_errorss rEc8|jjyN)rRclearrbs r. clear_cachezLocator.clear_caches rEc|jSre_schemerbs r. _get_schemezLocator._get_schemes ||rEc||_yreri)r<values r. _set_schemezLocator._set_schemes  rEctd)a= For a given project, get a dictionary mapping available versions to Distribution instances. This should be implemented in subclasses. If called from a locate() request, self.matcher will be set to a matcher for the requirement to satisfy, otherwise it will be None. Please implement in the subclassNotImplementedError)r<names r. _get_projectzLocator._get_projects""DEErEctd)J Return all the distribution names known to this locator. rprqrbs r.get_distribution_nameszLocator.get_distribution_namess""DEErEc|j|j|}|S||jvr|j|}|S|j|j|}||j|<|S)z For a given project, get a dictionary mapping available versions to Distribution instances. This calls _get_project to do all the work, and just implements a caching layer on top. )rRrtrc)r<rsr^s r. get_projectzLocator.get_projectsy ;; &&t,F T[[ [[&F      &&t,F &DKK  rEc6t|}tj|j}d}|j d}|j |j }|rt t||j}|jdk(d|jv||||fS)zu Give an url a score which can be used to choose preferred URLs for a given project release. TrPhttpszpypi.org) r posixpathbasenamepathendswithdownloadable_extensionsr$r# wheel_tagsr7netloc)r<r,tr} compatibleis_wheelis_downloadables r. score_urlzLocator.score_urls SM%%aff- $$V,"++D,H,HI &uXHJG#Z188%;:xA ArEc|}|r^|j|}|j|}||kDr|}||k7rtjd|||Stjd|||S)a{ Choose one of two URLs where both are candidates for distribution archives for the same version of a distribution (for example, .tar.gz vs. zip). The current implementation favours https:// URLs over http://, archives from PyPI over those from other locations, wheel compatibility (if a wheel) and then the archive name. zNot replacing %r with %rzReplacing %r with %r)rloggerdebug)r<url1url2r^s1s2s r. prefer_urlzLocator.prefer_urlsk %B%BBw~ 7tD  3T4@ rEct||S)zZ Attempt to split a filename in project name, version and Python version. )r)r<filename project_names r.rzLocator.split_filenamesh 55rEcd}d}t|\}}}}} } | jjdrtj d|| t j | } | r| j\} } nd\} } |}|r |ddk(r|dd}|jdr t|}t||jstj d |n|d }n||j|}|rw|j|j|jt||||| d fd j!|j"Dcgc]}d j!t%|dd!c}d}n|j|j*stj d|nt-j.|x}}|j*D]}}|j|s|dt1| }|j3||}|stj d|n.|\}}}|r |||r|||t||||| d fd}|r||d<n|r | r| |d| z<|Scc}w#t&$rtj)d|Y4wxYw)a See if a URL is a candidate for a download URL for a project (the URL has typically been scraped from an HTML page). If it is, a dictionary is returned with keys "name", "version", "filename" and "url"; otherwise, None is returned. c0t|t|k(Sre)r )name1name2s r. same_projectz:Locator.convert_url_to_download_info..same_projects!%(N5,AA ArENzegg=z %s: version hint in fragment: %r)NN/rPzWheel not compatible: %sTr5z, .)rsversionrr,python-versionzinvalid path for wheel: %szNot downloadable: %sz No match for project/version: %s)rsrrr,r %s_digest)rlower startswithrr HASHER_HASHmatchgroupsrr#r$rrsrrrjoinpyverlist Exceptionwarningrr|r}lenr)r<r,rrr^r7rr~paramsqueryfragmalgodigestorigpathwheelincludevrextrrsrrs r.convert_url_to_download_infoz$Locator.convert_url_to_download_infos} B4 wrEcd}t|}|td|zt|j}|j |j x|_}t jd|t|j|j|j}t|dkDrg}|j} |D]?} | dvr |j| sn%|s| | js|j!| At|dkDrt'||j(}|r t jd ||d } || }|r|j*r|j*|_|j-d ij- t/|_i} |j-d i} |j0D]}|| vs| || |<| |_d|_|S#t"$rt j%d|| Y= 1.0, < 2.0, != 1.3)' :param prereleases: If ``True``, allow pre-release versions to be located. Otherwise, pre-release versions are not returned. :return: A :class:`Distribution` instance, or ``None`` if no such distribution could be located. NzNot a valid requirement: %rzmatcher: %s (%s)rrrzerror matching %s with %rr)rCzsorted list: %srrr)rrr!r7rT requirementrrtyperFryrsr version_classr is_prereleaser[rrsortedrCextrasrZr download_urlsr)r<r prereleasesr^rr7rTversionsslistvclskrdsdr,s r.locatezLocator.locateas k * 9"#@;#NO ODKK(!' !>> w '$w-2H2HI##AFF+ x=1 E((D ++"==+&d1g.C.C!LLO 5zA~u&**5 .6)!'* xx ! #+<<#;#?#?#OF Ai,B++ %"9WAcF %FN  )!NN#>Ks7G G54G5)default)F)rFrGrHrIsource_extensionsbinary_extensionsexcluded_extensionsrrrWr`rcrgrkrnpropertyr7rtrwryrrrrrrrrMrEr.rOrOYsP0# J/);$& k; /F FF " A,6 GR..6rErOc.eZdZdZfdZdZdZxZS)PyPIRPCLocatorz This locator uses XML-RPC to locate distributions. It therefore cannot be used with simple mirrors (that only mirror file content). c ^tt| di|||_t |d|_y)z Initialise an instance. :param url: The URL to use for XML-RPC. :param kwargs: Passed to the superclass constructor. r&r'NrM)superrrWbase_urlrr-r<r,kwargs __class__s r.rWzPyPIRPCLocator.__init__s, nd,6v6 !#s3 rEcHt|jjSrv)rr-r+rbs r.rwz%PyPIRPCLocator.get_distribution_namess4;;,,.//rEciid}|jj|d}|D]8}|jj||}|jj||}t |j }|d|_|d|_|jd|_ |jdg|_ |jd|_ t|}|s|d } | d |_ |j| |_||_|||<|D]L} | d } |j| } |d j#|t%j'| | |d | <N;|S) NrTrrsrlicensekeywordssummaryrr,rr)r-package_releases release_urls release_datarr7rsrrZrrrrrrrrrrr) r<rsr^rrrdatarrrr,rs r.rtzPyPIRPCLocator._get_projectsZ,;;//d; 4A;;++D!4D;;++D!4Dt{{3H LHM#IH #xx 2H  $R 8H #xx 2H )DAw&*5k#"..t4 #  q  4Du+C!--d3F6N--a7;;C@-3F9%c* 4! 4* rErFrGrHrIrWrwrt __classcell__rs@r.rrs 40 rErc.eZdZdZfdZdZdZxZS)PyPIJSONLocatorzw This locator uses PyPI's JSON interface. It's very limited in functionality and probably not worth using. c Ltt| di|t||_y)NrM)rrrWrrrs r.rWzPyPIJSONLocator.__init__s! ot-77$S) rEctdrvzNot available from this locatorrqrbs r.rwz&PyPIJSONLocator.get_distribution_names""CDDrEciid}t|jdt|z} |jj |}|j j }tj|}t|j}|d}|d|_ |d|_ |jd|_|jdg|_|jd |_t#|}||_|||j<|d D]} | d }|j&j)||j+| |j,|<|d j/|jt1j)||j+| |d |<|d j3D]\} } | |jk(rt|j} |j| _ | | _ t#| } || _| || <| D]} | d }| j&j)||j+| | j,|<|d j/| t1j)||j+| |d |< |S#t4$rE}|j6j9t;|t<j?d|Yd}~|Sd}~wwxYw)Nrz%s/jsonrrrsrrrrrr,rreleaseszJSON fetch failed: %s) rrr rSopenreaddecodejsonloadsrr7rsrrZrrrrrrrrrrritemsrrVputrr exception)r<rsr^r,resprrrrrrinfosomdodistr_s r.rtzPyPIJSONLocator._get_projects,dmmYt%<=/ 9;;##C(D99;%%'D 4 A-BV9D6lBGiBJ),BJ((:r2BK),BJ#DDL!%F2:: &  @5k""&&s+$($4$4T$: S!v))"**ce<@@E)-)9)9$)?y!#&  @#$J-"5"5"7 Dbjj(dkk277% $S) $ "'w!DDu+C''++C0)-)9)9$)?EMM#&6N--gsu=AA#F-1-=-=d-CF9%c* D D4  9 KKOOIaL )   4a 8 8  9sI.J K(#:K##K(rrs@r.rrs*E 3rErc"eZdZdZej dej ejzejzZ ej dej ejzZ dZ ej dej Z e dZy)Pagez4 This class represents a scraped HTML page. z (rel\s*=\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\s ]*))\s+)? href\s*=\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\s ]*)) (\s+rel\s*=\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\s ]*)))? z!]+)c||_|x|_|_|jj |j}|r|j d|_yy)zk Initialise an instance with the Unicode page contents and the URL they came from. rN)rrr,_basesearchgroup)r<rr,rs r.rWz Page.__init__ sH  #&&  JJ  dii ( GGAJDM rEz[^a-z0-9$&+,/:;=?@.#%_\\|-]cd}t}|jj|jD]}|j d}|dxs!|dxs|dxs|dxs |dxs|d}|d xs |d xs|d }t |j |}t|}|jjd |}|j||ft|d d}|S)z Return the URLs of all the links on a page together with information about their "rel" attribute, for determining which ones to treat as downloads and which ones to queue for further scraping. cZt|\}}}}}}t||t||||fS)zTidy up an URL.)rrr )r,r7rr~rrrs r.cleanzPage.links..clean4s;8@ 5FFD&%vvuT{%ud45 5rEr5rel1rel2rel3rel4rel5rel6rrurl3c<dt|jdzS)Nz%%%2xr)ordr)rs r.zPage.links..BswQWWQZ/HrEc |dS)NrrM)rs r.rzPage.links..Fs adrET)rCreverse) r_hreffinditerr groupdictrrr _clean_resubrr)r<rr^rrrelr,s r.linksz Page.links-s 5 ZZ((3 #E#AV97& 7QvY7V97 !& 7-.vY F)5qy5AfIC$---C3-C..$$%H#NC JJSz " #NDA rEN)rFrGrHrIrecompileISXrr rWr!rr$rMrEr.r r s BJJTTBDD[244  E BJJ? ME ' 9244@IrEr ceZdZdZej dddZdfd ZdZdZ dZ e jd e jZd Zd Zd Zd ZdZe jdZdZxZS)SimpleScrapingLocatorz A locator which scrapes HTML pages to locate downloads for a distribution. This runs multiple threads to do the I/O; performance is at least as good as pip's PackageFinder, which works in an analogous fashion. c\tjt|jS)N)fileobj)gzipGzipFilerrbs r.rzSimpleScrapingLocator.Ts$-- ;@@BrEc|SrerMr0s r.rzSimpleScrapingLocator.Us!rE)deflater.nonec dtt| di|t||_||_i|_t|_tj|_ t|_ d|_ ||_tj |_tj |_d|_y)a Initialise an instance. :param url: The root URL to use for scraping. :param timeout: The timeout, in seconds, to be applied to requests. This defaults to ``None`` (no timeout specified). :param num_workers: The number of worker threads you want to do I/O, This defaults to 10. :param kwargs: Passed to the superclass. FNrM)rr+rWrrr( _page_cacher_seenr rU _to_fetch _bad_hostsskip_externals num_workers threadingRLock_lock_gplockplatform_check)r<r,r(r;rrs r.rWzSimpleScrapingLocator.__init__Xs #T3=f=$S)  U %#&__& !( #rEcg|_t|jD]T}tj|j }d|_|j|jj|Vy)z Threads are created only when get_project is called, and terminate before it returns. They are there primarily to parallelise I/O (i.e. fetching web pages). )targetTN) _threadsranger;r<Thread_fetchdaemonstartr[)r<irs r._prepare_threadsz&SimpleScrapingLocator._prepare_threadsss[  t''( $A   4AAH GGI MM  #  $rEc|jD]}|jjd|jD]}|jg|_y)zu Tell all the threads to terminate (by sending a sentinel value) and wait for them to do so. N)rCr8rr)r<rs r. _wait_threadsz#SimpleScrapingLocator._wait_threadssL %A NN  t $ % A FFH  rEc"iid}|j5||_||_t|jdt |z}|j j|jj|j tjd||jj||jj|j|`ddd|S#|jwxYw#1swY|SxYw)Nrz%s/z Queueing %s)r?r^rrrr r7rfr6rJrrr8rrrL)r<rsr^r,s r.rtz"SimpleScrapingLocator._get_projects, \\  DK $D $--t)<=C JJ       " " $  ! ! # % ]C0""3'##%""$   ""$  s%A5DA C/D/DDDz<\b(linux_(i\d86|x86_64|arm\w+)|win(32|_amd64)|macosx_?\d+)\bc8|jj|S)zD Does an URL refer to a platform-specific download? )platform_dependentr )r<r,s r._is_platform_dependentz,SimpleScrapingLocator._is_platform_dependents&&--c22rEc0|jr|j|rd}n|j||j}tj d|||r3|j 5|j|j|ddd|S|S#1swY|SxYw)a% See if an URL is a suitable download for a project. If it is, register information in the result dictionary (for _get_project) about the specific version it's for. Note that the return value isn't actually used other than as a boolean value. Nzprocess_download: %s -> %s) r@rPrrrrr>rr^)r<r,rs r._process_downloadz'SimpleScrapingLocator._process_downloads   4#>#>s#CD44S$:K:KLD 13=  =))$++t< = t  = s "B  Bct|\}}}}}}|j|j|jz|jzrd}n|j r|j |jsd}nm|j |jsd}nO|dvrd}nH|dvrd}nA|j|rd}n-|jddd} | jdk(rd}nd}tjd |||||S) z Determine whether a link URL from a referring page and with a particular "rel" attribute should be queued for scraping. F)homepagedownload)httpr{ftp:rr localhostTz#should_queue: %s (%s) from %s -> %s) rrrrrr:rrrPsplitrrr) r<linkreferrerr#r7rr~_r^hosts r. _should_queuez#SimpleScrapingLocator._should_queues )1%aA ==//$2H2HH112 3F  )GF$$T]]3F 0 0F 3 3F  ( ( .F<<Q'*Dzz|{* :D#v ' rEc |jj} |r|j|}| |jjM|jD]\}}||j vs |j j ||j|sE|j|||r2tjd|||jj||jj|sy#t$rYwxYw#t$r.}|jjt|Yd}~_d}~wwxYw#|jjwxYw)z Get a URL to fetch from the work queue, get the HTML page, examine its links for download candidates and candidates for further scraping. This is a handy method to run in a thread. NzQueueing %s from %s)r8rZget_pager]r$r7rrRr_rrrrrrVr)r<r,pager[r#r_s r.rFzSimpleScrapingLocator._fetchs1..$$&C +==-D| ((*&*ZZ % ctzz1% $ t 4(,(>(>t(D(,(:(:4c(J$*LL1Fc$R$(NN$6$6t$< %((*1$8% $% .  ! -- .((*sTD D0A1D!D D  D D  D E$E=E EE E&c$t|\}}}}}}|dk(r=tjjt |rt t |d}||jvr(|j|}tjd|||S|jddd}d}||jvrtjd|||St|d d i } tjd ||jj||j } tjd|| j!} | j#dd} t$j'| r| j)} | j+} | j#d}|r|j,|}|| } d}t.j1| }|r|j3d} | j5|} t9| | }||j| <||j|<|S#t6$r| j5d} YHwxYw#t:$r0}|j<dk7rtj?d||Yd}~ed}~wt@$r^}tj?d|||jB5|jjE|dddn #1swYnxYwYd}~d}~wtF$r!}tj?d||Yd}~d}~wwxYw#||j|<wxYw)a Get the HTML for an URL, possibly from an in-memory cache. XXX TODO Note: this cache is never actually cleared. It's assumed that the data won't get stale over the lifetime of a locator instance (not necessarily true for the default_locator). filez index.htmlzReturning %s from cache: %srXrrNzSkipping %s due to bad host %szAccept-encodingidentity)rAz Fetching %sr'z Fetched %sz Content-Typer5zContent-Encodingzutf-8zlatin-1izFetch failed: %s: %s)$rosr~isdirr rrr6rrrZr9rrSrr(rrZHTML_CONTENT_TYPErgeturlrdecodersCHARSETr rr UnicodeErrorr rr?rrr>rr)r<r,r7rr~r]r^r^r=rrA content_type final_urlrencodingdecoderrr_s r.razSimpleScrapingLocator.get_pages)1 %aA V  l4.@ A,s+\:C $"" "%%c*F LL6V DT Q<<Q'*DFt& =sDIJ Gc,=z+JK!3LL4;;++C+FDLLs3"iikG#*;;~r#BL(..|<$(KKM #yy{#*;;/A#B#&*mmH&=G#*4=D#*#NN<8'(wwqzH:#';;x#8D"&dI!66<((3-3D$$S)  ,:#';;y#9D:!Ivv}(()?aH2$$%;S!D2++D1222 E$$%;S!DDE-3D$$S)sC>H5H)H5H2/H51H22H55 K;>&I)$K>) K;5#KJ=4 K=K K K> K;K61K>6K;;K>>Lz]*>([^<]+)>rEc iid}tj|jD]\}}}|D]}|j||stjj ||}t ddttjj|dddf}|j||}|s|j|||jr|S|S)Nrrdr5) rfwalkr{r~r~rrr rzrrry) r<rsr^rootdirsfilesfnr,rs r.rtzDirectoryLocator._get_projectbs,!#!7  D$ @&&r40dB/B$fb&2277??23F&G&("b&23C <>   rEc t}tj|jD]\}}}|D]}|j ||stj j ||}tddttj j|dddf}|j|d}|s|j|d|jr|S|S)rvrdr5Nrs) rrfrr{r~r~rrr rzrrry)r<r^rrrrr,rs r.rwz'DirectoryLocator.get_distribution_namesrs!#!7  D$ 1&&r40dB/B$fb&2277??23F&G&("b&23C <>   rE) rFrGrHrIrWr~rtrwrrs@r.rwrwDs"? rErwceZdZdZdZdZy) JSONLocatora This locator uses special extended metadata (not available on PyPI) and is the basis of performant dependency resolution in distlib. Other locators require archive downloads before dependencies can be determined! As you might imagine, that can be slow. ctdrrqrbs r.rwz"JSONLocator.get_distribution_namesrrEc iid}t|}|r|jdgD]}|ddk7s|ddk7rt|d|d|jd d |j }|j}|d |_d |vr|d r d|d f|_|jdi|_|jdi|_|||j<|dj|jtj|d |S)Nrrptypesdist pyversionsourcersrrzPlaceholder for summary)rr7r,rr requirementsexportsr) rrZrr7rrr dependenciesrrrrr)r<rsr^rrrrs r.rtzJSONLocator._get_projects,% "- P=G+tK/@H/L!ftI)-)2K*M(, 5]] $U  t#X#($x."9DK"&((>2">#xx 26 '+t||$v))$,,>BB4;O% P& rEN)rFrGrHrIrwrtrMrEr.rrs E rErc(eZdZdZfdZdZxZS)DistPathLocatorz This locator finds installed distributions in a path. It can be useful for adding to an :class:`AggregatingLocator`. c ^tt| di|t|tsJ||_y)zs Initialise an instance. :param distpath: A :class:`DistributionPath` instance to search. NrM)rrrW isinstancerdistpath)r<rrrs r.rWzDistPathLocator.__init__s/ ot-77($4555  rEc |jj|}|iid}|S|j|d|jt|jgid|jtdgii}|S)Nrrr)rget_distributionrrr)r<rsrr^s r.rtzDistPathLocator._get_projectss}}--d3 < R0F  dsDOO+<'=>DLL#tf+6F  rE)rFrGrHrIrWrtrrs@r.rrs! rErcxeZdZdZfdZfdZdZeejjeZ dZ dZ xZ S)AggregatingLocatorzI This class allows you to chain and/or merge a list of locators. ch|jdd|_||_tt|di|y)a Initialise an instance. :param locators: The list of locators to search. :param kwargs: Passed to the superclass constructor, except for: * merge - if False (the default), the first successful search from any of the locators is returned. If True, the results from all locators are merged (this can be slow). mergeFNrM)rrlocatorsrrrW)r<rrrs r.rWzAggregatingLocator.__init__s1ZZ/     $0:6:rEcltt| |jD]}|jyre)rrrgr)r<rrs r.rgzAggregatingLocator.clear_caches0  $35}} "G    ! "rEcB||_|jD] }||_ yre)rjrr7)r<rmrs r.rnzAggregatingLocator._set_schemes# }} #G"GN #rEc0i}|jD]}|j|}|s|jr|jdi}|jdi}|j ||jd}|r1|r/|j D]\}} ||vr||xx| zcc<| ||<|jd} |s| s| j ||j d} n(d} |D]!}|j j|sd} n| s|}|S|S)NrrTF)rryrrZupdaterrTr) r<rsr^rrrrdfrrddfounds r.rtzAggregatingLocator._get_projects$}}' G##D)A::"JJvr2E$jjB7GMM!$F+B$)KKM*DAq Bw "1 ()1 *  I.B2 '*||+ $ %!"&A#||11!4(, %&!" Q' P rEct}|jD]} ||jz}|S#t$rY&wxYwr)rrrwrr)r<r^rs r.rwz)AggregatingLocator.get_distribution_namessQ}} G '88::   '  s 2 >>)rFrGrHrIrWrgrnrrOr7fgetrtrwrrs@r.rrs:; " # gnn)); 7F*X rErzhttps://pypi.org/simple/r&r'legacyrc>eZdZdZd dZdZdZdZdZdZ d d Z y) DependencyFinderz0 Locate dependencies for distributions. Ncj|xst|_t|jj|_y)zf Initialise an instance, using the specified locator to locate distributions. N)default_locatorrr!r7)r<rs r.rWzDependencyFinder.__init__2s& 1/  !4!45 rEcttjd||j}||j|<||j||j f<|j D]]}t|\}}tjd||||jj|tj||f_y)z Add a distribution to the finder. This will update internal information about who provides what. :param dist: The distribution to add. zadding distribution %szAdd to provided: %s, %s, %sN) rrrC dists_by_namedistsrprovidesrprovidedrrr)r<rrsprs r.add_distributionz!DependencyFinder.add_distribution:s  -t4xx#'4 +/ D$,,'( GA215MD' LL6gt L MM $ $T35 1 5 5wo F GrEcftjd||j}|j|=|j||j f=|j D]Z}t|\}}tjd||||j|}|j||f|rN|j|=\y)z Remove a distribution from the finder. This will update internal information about who provides what. :param dist: The distribution to remove. zremoving distribution %sz Remove from provided: %s, %s, %sN) rrrCrrrrrrremove)r<rrsrrss r.remove_distributionz$DependencyFinder.remove_distributionIs  /6xx   t $ JJdll+ , (A215MD' LL;T7D Q d#A HHgt_ %MM$'  (rEc |jj|}|S#t$r2|jd}|jj|}Y|SwxYw)z Get a version matcher for a requirement. :param reqt: The requirement :type reqt: str :return: A version matcher (an instance of :class:`distlib.version.Matcher`). r)r7rTr"rZ)r<reqtrTrss r. get_matcherzDependencyFinder.get_matcher[s[ 0kk))$/G  ' 0::<?Dkk))$/G  0s7AAc|j|}|j}t}|j}||vr5||D]-\}} |j |}|s|j ||S|S#t $rd}Y'wxYw)z Find the distributions which can fulfill a requirement. :param reqt: The requirement. :type reqt: str :return: A set of distribution which can fulfill the requirement. F)rrCrrrr"r) r<rrTrsr^rrproviderrs r.find_providerszDependencyFinder.find_providersks""4({{== 8 %-d^ !"#MM'2EJJx(   /"!E"sA// A=<A=c|j|}t}|D]@}|j|}|j|jr0|j |B|r"|j d||t |fd}|S|j||j|=|D]5}|jj|tj |7|j|d}|S)a Attempt to replace one provider with another. This is typically used when resolving dependencies from multiple sources, e.g. A requires (B >= 1.0) while C requires (B >= 1.1). For successful replacement, ``provider`` must meet all the requirements which ``other`` fulfills. :param provider: The provider we are trying to replace with. :param other: The provider we're trying to replace. :param problems: If False is returned, this will contain what problems prevented replacement. This is currently a tuple of the literal string 'cantreplace', ``provider``, ``other`` and the set of requirements that ``provider`` couldn't fulfill. :return: True if we can replace ``other`` with ``provider``, else False. cantreplaceFT) reqtsrrrrr frozensetrrr) r<rotherproblemsrlist unmatchedrrTr^s r.try_to_replacezDependencyFinder.try_to_replaces& 5!E  !A&&q)G==!1!12 a  !  LL-5#I.0 1F  $ $U + 5! > %%h6::1= >  ! !( +F rEci|_i|_i|_i|_t |xsg}d|vr!|j d|t gdz}t |tr|x}}tjd|nE|jj||x}}|td|ztjd|d|_ t }t |g}t |g}|rd|j}|j} | |jvr|j!|n'|j| } | |k7r|j#|| ||j$|j&z} |j(} t } |r'||vr#dD]}d |z}||vs | t+|d |zz} | | z| z}|D]}|j-|}|stjd ||jj||}||s|jj|d}|*tjd ||j/d |fn|j|j0}}||f|jvr|j/||j/||| vr5||vr1|j/|tjd|j2|D]x}|j} | |jvr4|jj5|t j/|Q|j| } | |k7sf|j#|| |z|rdt |jj7}|D]8}||v|_|j8stjd|j2:tjd|||fS)a Find a distribution and all distributions it depends on. :param requirement: The requirement specifying the distribution to find, or a Distribution instance. :param meta_extras: A list of meta extras such as :test:, :build: and so on. :param prereleases: If ``True``, allow pre-release versions to be returned - otherwise, don't return prereleases unless they're all that's available. Return a set of :class:`Distribution` instances and a set of problems. The distributions returned should be such that they have the :attr:`required` attribute set to ``True`` if they were from the ``requirement`` passed to ``find()``, and they have the :attr:`build_time_dependency` attribute set to ``True`` unless they are post-installation dependencies of the ``requirement``. The problems should be a tuple consisting of the string ``'unsatisfied'`` and the requirement which couldn't be satisfied by any distribution known to the locator. z:*:)z:test:z:build:z:dev:zpassed %s as requirement)rzUnable to locate %rz located %sT)testbuilddevz:%s:z %s_requireszNo providers found for %rzCannot satisfy %r unsatisfiedzAdding %s to install_distsz#%s is a build-time dependency only.zfind done for %s)rrrrrrrrrrrrr requestedrrCrr run_requires meta_requiresbuild_requiresgetattrrrrname_and_versionrvaluesbuild_time_dependency)r<r meta_extrasrrrrtodo install_distsrsrireqtssreqtsereqtsrCr_ all_reqtsr providersrnrrrs r.findzDependencyFinder.finds4   ++, K    u % 3=> >K k< 0& &D5 LL3U ;<<..{;F/H HD5|&'<{'JKK LLu -5D6{UG 88:D88D4---%%d+**40D=''eX>&&););;F((FUFt}43EC AK''$ 0C"DDE&0I D //2  LL! $ 2 24 8 A: //5(CD+ D)fDJJ%%'( 4D)-])BD &)) B!224 4  '/hrEre)NF) rFrGrHrIrWrrrrrrrMrEr.rr-s-6 G($ 0&PlrErre)Lr.iorrloggingrfr|r%r< ImportErrordummy_threadingrtr5rcompatrrrr r r r r rrr:rrrrdatabaserrrrrrutilrrrrrrrr rr!r"rr#r$ getLoggerrFrr&rr'rkrhr*r/r1objectrOrrr r+rwrrrrrrrMrEr.rs    ( 3333@?4###9'   8 $bjj./ "**2BDD 9BJJ?@'  F)F@~f~B .W.bBgBJ767twGwt?w?D$'$Ng8VVv%)*D257# %   jvjy ('(sE55 FF