8f76ddlZddlmZddlZddlZddlZddlZddlZ ddlZn#e $rddl ZYnwxYwddl 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 l1m2Z2m3Z3ej4e5Z6ej7d Z8ej7d ej9Z:ej7d Z;dZGdde?Z@Gdde@ZAGdde@ZBGdde?ZCGdde@ZDGdde@ZEGdde@ZFGd d!e@ZGGd"d#e@ZHeHeDd$d%&d'(ZIeIjJZJGd)d*e?ZKdS),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} ||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. N@timeoutclose) DEFAULT_INDEXr list_packages)urlclients |/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/pip/_vendor/distlib/locators.pyget_all_distribution_namesr/*si  { c * * *F##%%wws AAc$eZdZdZdZexZxZZdS)RedirectHandlerzE A class to work around a bug in some Python 3.2.x releases. c6d}dD]}||vr ||}n|dSt|}|jdkrNt||}t |dr|||n|||<t j||||||S)N)locationurireplace_header)rschemer get_full_urlhasattrr6BaseRedirectHandlerhttp_error_302) selfreqfpcodemsgheadersnewurlkeyurlpartss r.r;zRedirectHandler.http_error_302Bs&  Cg~~  > FF## ?b S--//88Fw 011 &&&sF3333% "1$Rs29;; ;N)__name__ __module__ __qualname____doc__r;http_error_301http_error_303http_error_307rEr.r1r19s9;;;(8FENE^nnnrEr1ceZdZdZdZdZdZdZedzZddZ d Z d Z d Z d Z d Zee eZdZdZdZdZdZdZdZdZdZddZdS)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)rPdefaultci|_||_tt|_d|_t j|_dS)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__isC  #?#4#455  kmm rEc,g}|jsx |jd}||n#|jj$rY[wxYw|j|jx|S)z8 Return any errors which have occurred. F)rWemptygetappendEmpty task_done)r<resultes r. get_errorszLocator.get_errors|s+##%% $ KOOE** a    ;$     K ! ! # # # +##%% $ s/A AAc.|dS)z> Clear any errors which may have been logged. N)rar<s r. clear_errorszLocator.clear_errorss rEc8|jdSN)rSclearrcs r. clear_cachezLocator.clear_caches rEc|jSrf_schemercs r. _get_schemezLocator._get_schemes |rEc||_dSrfrj)r<values r. _set_schemezLocator._set_schemes  rEc td)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""DEEErEc td)J Return all the distribution names known to this locator. rqrrrcs r.get_distribution_nameszLocator.get_distribution_namess""DEEErEc|j||}nJ||jvr|j|}n3|||}||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. )rSrurd)r<rtr_s r. get_projectzLocator.get_projectsr ; &&t,,FF T[ [&FF      &&t,,F &DK  rEc,t|}tj|j}d}|d}||j}|r"t t||j}|j dkd|j v||||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 SMM%af-- $$V,,"++D,HII  I&uXHHJG#Z18%;:xA ArEc|}|rq||}||}||kr|}||krtd||ntd|||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_urls  A%%B%%BBww~~ 7tDDDD 3T4@@@ rEc"t||S)zZ Attempt to split a filename in project name, version and Python version. )r)r<filename project_names r.rzLocator.split_filenamesh 555rEc *d}d}t|\}}}}} } | drtd|| t | } | r| \} } nd\} } |}|r|ddkr |dd}|dr t|}t||j std |nd|d }n||j |}|rL|j |j |jt||||| d fd d |jDd}n#t$$rtd|YnwxYw||jstd|nt+j|x}}|jD]}||r|dt/| }|||}|std|n5|\}}}|r |||r!|||t||||| d fd}|r||d<n|r | r| |d| z<|S)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. cBt|t|kSrf)r )name1name2s r. same_projectz:Locator.convert_url_to_download_info..same_projects!%((N5,A,AA ArENzegg=z %s: version hint in fragment: %r)NN/rPzWheel not compatible: %sTr5z, c bg|],}dt|dd-S).N)joinlist).0vs r. z8Locator.convert_url_to_download_info..s2 L L L1$qu++!6!6 L L LrE)rtversionrr,python-versionzinvalid path for wheel: %szNot downloadable: %sz No match for project/version: %s)rtrrr,r %s_digest)rlower startswithrr HASHER_HASHmatchgroupsrr#r$rrtrrrrpyver Exceptionwarningrr}r~lenr)r<r,rrr_r7rrparamsqueryfragmalgodigestorigpathwheelincluderextrrtrrs r.convert_url_to_download_infoz$Locator.convert_url_to_download_infos@ B B B4 > > wrEFc4d}t|}|td|zt|j}||jx|_}t d|t|j | |j }t|dkrg}|j } |D]q} | dvr || sn'|s| | js|| F#t"$rt d|| YnwxYwt|dkrt'||j}|r+t d ||d } || }|r|jr |j|_|d i| t/|_i} |d i} |jD]}|| vr | || |<| |_d|_|S) a Find the most recent distribution which matches the given requirement. :param requirement: A requirement of the form 'foo (1.0)' or perhaps 'foo (>= 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!r7rU requirementrrtyperFrzrtr version_classr is_prereleaser\rrsortedrCextrasr[r download_urlsr)r<r prereleasesr_rr7rUversionsslistvclskrdsdr,s r.locatezLocator.locateas4 k * * 9"#@;#NOO ODK((!' !>!>> w '$w--2HIII##AF++ x==1  E(D  +++"==++,&,dd1gg.C,!LLOOO NN#>KKKD5zzA~~u&*555 + .666)!'*  x ) ! #+<<#;#;#?#?#O#OF Ai,,B+ % %"99WAcFFN  s =D&D0/D0)rQ)F)rFrGrHrIsource_extensionsbinary_extensionsexcluded_extensionsrrrXrardrhrlropropertyr7rurxrzrrrrrrrrMrEr.rOrOYs_P0# J/);$$$$&   Xk; / /F F F FFFF " A A A,666 GGGR..666666rErOc.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|jdi|||_t |d|_dS)z Initialise an instance. :param url: The URL to use for XML-RPC. :param kwargs: Passed to the superclass constructor. r&r'NrM)superrrXbase_urlrr-r<r,kwargs __class__s r.rXzPyPIRPCLocator.__init__sG -nd##,66v666 !#s333 rEcNt|jSrw)rr-r+rcs r.rxz%PyPIRPCLocator.get_distribution_namess 4;,,..///rEc$iid}|j|d}|D]k}|j||}|j||}t |j}|d|_|d|_|d|_ |dg|_ |d|_ t|}|r|d } | d |_ || |_||_|||<|D]e} | d } || } |d |t%| | |d | <fm|S) NrTrrtrlicensekeywordssummaryrr,rr)r-package_releases release_urls release_datarr7rtrr[rrrrrrrrrrr) r<rtr_rrrdatarrrr,rs r.ruzPyPIRPCLocator._get_projects,,;//d;; 4 4A;++D!44D;++D!44Dt{333H LHM#IH #xx 22H  $R 8 8H #xx 22H ))D 4Aw&*5k#"..t44 #  q  44Du+C!--d33F6N--a77;;C@@@-3F9%c** rErFrGrHrIrXrxru __classcell__rs@r.rrs` 4 4 4 4 4000 rErc.eZdZdZfdZdZdZxZS)PyPIJSONLocatorzw This locator uses PyPI's JSON interface. It's very limited in functionality and probably not worth using. c ptt|jdi|t||_dS)NrM)rrrXrrrs r.rXzPyPIJSONLocator.__init__s9-ot$$-77777$S)) rEc tdrwzNot available from this locatorrrrcs r.rxz&PyPIJSONLocator.get_distribution_names""CDDDrEcliid}t|jdt|z} |j|}|}tj|}t|j }|d}|d|_ |d|_ | d|_| dg|_| d |_t#|}||_|||j <|d D]} | d }|j||| |j|<|d |j t1||| |d |<|d D]\} } | |j krt|j } |j | _ | | _ t#| } || _| || <| D]} | d }| j||| | j|<|d | t1||| |d |<nY#t4$rL}|jt;|t<d|Yd}~nd}~wwxYw|S)Nrz%s/jsonrrrtrrrrrr,rreleaseszJSON fetch failed: %s) rrr rTopenreaddecodejsonloadsrr7rtrr[rrrrrrrrrrritemsrrWputrr exception)r<rtr_r,resprrrrrrinfosomdodistr`s r.ruzPyPIJSONLocator._get_projects,,dmYt%<==/ 9;##C((D99;;%%''D 4  A---BV9D6lBGiBJ),,BJ((:r22BK),,BJ##DDL!%F2: &  @ @5k"&&s+++$($4$4T$:$: S!v))"*cee<<@@EEE)-)9)9$)?)?y!#&&"#J-"5"5"7"7 D Dbj((dk2227% $S)) $ "'w!DDDu+C'++C000)-)9)9$)?)?EM#&6N--gsuu==AA#FFF-1-=-=d-C-CF9%c** D D. 9 9 9 KOOIaLL ) ) )   4a 8 8 8 8 8 8 8 8 9 sJ.K L1%AL,,L1rrs@r.rrsc*****EEE 3333333rErceZdZdZejdejejzejzZ ejdejejzZ dZ ejdejZ e dZdS)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|_|_|j|j}|r|d|_dSdS)zk Initialise an instance with the Unicode page contents and the URL they came from. rN)rrr,_basesearchgroup)r<rr,rs r.rXz Page.__init__ sW  #&&  J  di ( (  'GGAJJDMMM ' 'rEz[^a-z0-9$&+,/:;=?@.#%_\\|-]cd}t}|j|jD]}|d}|dp'|dp|dp|dp|dp|d}|d p|d p|d }t |j|}t|}|j d |}| ||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. crt|\}}}}}}t||t||||fS)zTidy up an URL.)rrr )r,r7rrrrrs r.cleanzPage.links..clean4sD8@ 5FFD&%vvuT{{%ud455 5rEr5rel1rel2rel3rel4rel5rel6rrurl3cLdt|dzS)Nz%%%2xr)ordr)rs r.zPage.links..BswQWWQZZ/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 5 5 Z((33 # #E##AV97& 7QvY7V97 !& 7-.vY F)5qy5AfIC$---C3--C.$$%H%H#NNC JJSz " " " "NNDAAA rEN)rFrGrHrIrecompileISXr!rrXr$rr'rMrEr.r r s BJTBD[24   E BJ? M ME ' ' ' 924@@I_rEr ceZdZdZejdddZdfd ZdZd Z d Z e j d e j Zd Zd ZdZdZdZe j dZdZxZS)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. cjtjt|S)N)fileobj)gzipGzipFilerrbs r.rzSimpleScrapingLocator.Ts%$- ;;;@@BBrEc|SrfrMr3s r.rzSimpleScrapingLocator.Us!rE)deflater1noneN c tt|jdi|t||_||_i|_t|_tj |_ t|_ d|_ ||_tj|_tj|_d|_dS)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.rXrrr( _page_cacher_seenr rV _to_fetch _bad_hostsskip_externals num_workers threadingRLock_lock_gplockplatform_check)r<r,r(r?rrs r.rXzSimpleScrapingLocator.__init__Xs 4#T**3==f===$S))  UU %%#&_&& !(( #rEcg|_t|jD]Q}tj|j}d|_||j|RdS)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_threadsssq  t'(( $ $A  444AAH GGIII M  # # # #  $ $rEc|jD]}|jd|jD]}|g|_dS)zu Tell all the threads to terminate (by sending a sentinel value) and wait for them to do so. N)rGr<rr)r<rs r. _wait_threadsz#SimpleScrapingLocator._wait_threadssY % %A N  t $ $ $ $  A FFHHHH rEc>iid}|j5||_||_t|jdt |z}|j|j|  t d||j ||j |n#|wxYw|`dddn #1swxYwY|S)Nrz%s/z Queueing %s)rCr_rrrr r;rgr:rNrrr<rrrP)r<rtr_r,s r.ruz"SimpleScrapingLocator._get_projectsN,, \   DK $D $-t)<==C J        " " $ $ $  ! ! # # # % ]C000""3'''##%%%""$$$$""$$$$                 s+A:DAC+D+DDDDz<\b(linux_(i\d86|x86_64|arm\w+)|win(32|_amd64)|macosx_?\d+)\bc6|j|S)zD Does an URL refer to a platform-specific download? )platform_dependentr)r<r,s r._is_platform_dependentz,SimpleScrapingLocator._is_platform_dependents&--c222rEc*|jr||rd}n|||j}td|||r:|j5||j|dddn #1swxYwY|S)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) rDrTrrrrrBrr_)r<r,rs r._process_downloadz'SimpleScrapingLocator._process_downloads   M4#>#>s#C#C MDD44S$:KLLD 13===  = = =))$+t<<< = = = = = = = = = = = = = = = s BB B ct|\}}}}}}||j|jz|jzrd}n|jr||jsd}n|||jsd}n_|dvrd}nX|dvrd}nQ||rd}n9| ddd} | dkrd}nd}t d |||||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>rrrTsplitrrr) r<linkreferrerr&r7rr_r_hosts r. _should_queuez#SimpleScrapingLocator._should_queues8 )1%aA ==/$2HH12 3 3 FF   )G)G FF$$T]33 FF 0 0 0FF 3 3 3FF  ( ( . . FF<<Q''*Dzz||{** :D#v ' ' ' rEc |j} |r||}| |jO|jD]\}}||jvr |j|||sM||||r6t d|||j |#t$rYwxYwn>#t$r1}|j t|Yd}~nd}~wwxYw|jn#|jwxYw|sdSo)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. TNzQueueing %s from %s)r<r[get_pager^r'r;rrVrcrrrrrrWr)r<r,pager_r&r`s r.rJzSimpleScrapingLocator._fetchs .$$&&C + %==--D| ((****&*Z % % ctz11% $ t 4 4 4(,(>(>t(D(D!=(,(:(:4c(J(J!=$*LL1Fc$R$R$R$(N$6$6t$<$<$<#7%%% $%2 . . .  ! -------- .((****((**** 1 sZC5C5&A]*>([^<]+)>>rEc iid}tj|jD]\}}}|D]}|||rtj||}t ddttj|dddf}| ||}|r| |||j sn|S)Nrrhr5) rjwalkr~rrrrr r}rrr|) r<rtr_rootdirsfilesfnr,rs r.ruzDirectoryLocator._get_projectbs,,!#!7!7   D$ @ @&&r400@dB//B$fb&227??23F3F&G&G&("b&233C <   rEc t}tj|jD]\}}}|D]}|||rtj||}tddttj |dddf}| |d}|r| |d|j sn|S)rwrhr5Nrt) rrjrr~rrrrr r}rrr|)r<r_rrrrr,rs r.rxz'DirectoryLocator.get_distribution_namesrs!#!7!7   D$ 1 1&&r4001dB//B$fb&227??23F3F&G&G&("b&233C <   rE) rFrGrHrIrXrrurxrrs@r.rzrzDso"??? rErzceZdZdZdZdZdS) 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. c tdrrrrcs r.rxz"JSONLocator.get_distribution_namesrrEc viid}t|}|r!|dgD] }|ddks |ddkrt|d|d|d d |j }|j}|d |_d |vr|d rd|d f|_|di|_|di|_|||j <|d |j t |d  |S)Nrrptypesdist pyversionsourcertrrzPlaceholder for summary)rr7r,rr requirementsexportsr) rr[rr7rrr dependenciesrrrrr)r<rtr_rrrrs r.ruzJSONLocator._get_projectsL,,%%  P"-- P P=G++tK/@H/L/L!ftI)-)2K*M*M(, 555] $U  t##X##($x."9DK"&((>2">">#xx 266 '+t|$v))$,>>BB4;OOOO rEN)rFrGrHrIrxrurMrEr.rrs? EEE rErc(eZdZdZfdZdZxZS)DistPathLocatorz This locator finds installed distributions in a path. It can be useful for adding to an :class:`AggregatingLocator`. c tt|jdi|t|tsJ||_dS)zs Initialise an instance. :param distpath: A :class:`DistributionPath` instance to search. NrM)rrrX isinstancerdistpath)r<rrrs r.rXzDistPathLocator.__init__sJ .ot$$-77777($455555  rEc |j|}|iid}n<|j|d|jt|jgid|jtdgii}|S)Nrrr)rget_distributionrrr)r<rtrr_s r.ruzDistPathLocator._get_projectso}--d33 < R00FF dsDO+<'='=>DL#tf++6F  rE)rFrGrHrIrXrurrs@r.rrsQ!!!!!       rErcjeZdZdZfdZfdZdZeej j eZ dZ dZ xZ S)AggregatingLocatorzI This class allows you to chain and/or merge a list of locators. c|dd|_||_tt|jdi|dS)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)rrlocatorsrrrX)r<rrrs r.rXzAggregatingLocator.__init__sKZZ//   0 $''0::6:::::rEctt||jD]}|dSrf)rrrhr)r<rrs r.rhzAggregatingLocator.clear_cachesP  $''33555} " "G    ! ! ! ! " "rEc6||_|jD] }||_ dSrf)rkrr7)r<rnrs r.rozAggregatingLocator._set_schemes- } # #G"GNN # #rEcBi}|jD]}||}|r|jr|di}|di}|||d}|r6|r4|D]\}} ||vr||xx| zcc<| ||< |d} |r| r| ||jd} n%d} |D] }|j|rd} n!| r|}n|S)NrrTF)rrzrr[updaterrUr) r<rtr_rrrrdfrrddfounds r.ruzAggregatingLocator._get_projectst}' ' G##D))A% :$"JJvr22E$jjB77GMM!$$$F++B**$)KKMM**DAq Bww "1 ()1I..B+2+ '***|+ $ %!"&&A#|11!44&(, %&!" rEct}|jD]*} ||z}#t$rY'wxYw|Sr)rrrxrs)r<r_rs r.rxz)AggregatingLocator.get_distribution_namess`}  G '88:::&     s 1 >>)rFrGrHrIrXrhrorrOr7fgetrurxrrs@r.rrs;;;;; """"" ### Xgn); 7 7F***X       rErzhttps://pypi.org/simple/r&r'legacyrc@eZdZdZd dZdZdZdZdZdZ d d Z dS) DependencyFinderz0 Locate dependencies for distributions. Nc^|pt|_t|jj|_dS)zf Initialise an instance, using the specified locator to locate distributions. N)default_locatorrr!r7)r<rs r.rXzDependencyFinder.__init__2s( 1/  !455 rEcjtd||j}||j|<||j||jf<|jD]m}t|\}}td||||j |t ||fndS)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<rrtprs r.add_distributionz!DependencyFinder.add_distribution:s  -t444x#'4 +/ D$,'( G GA2155MD' LL6gt L L L M $ $T355 1 1 5 5wo F F F F G GrEcFtd||j}|j|=|j||jf=|jD]_}t|\}}td||||j|}| ||f|s|j|=`dS)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<rrtrrss r.remove_distributionz$DependencyFinder.remove_distributionIs  /666x  t $ Jdl+ , ( (A2155MD' LL;T7D Q Q Q d#A HHgt_ % % % (M$'  ( (rEc |j|}nD#t$r7|d}|j|}YnwxYw|S)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)r7rUr"r^)r<reqtrUrts r. get_matcherzDependencyFinder.get_matcher[sj 0k))$//GG& 0 0 0::<<?Dk))$//GGG 0s>AAc||}|j}t}|j}||vrP||D]G\}} ||}n#t $rd}YnwxYw|r||nH|S)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<rrUrtr_rrproviderrs r.find_providerszDependencyFinder.find_providersks""4(({= 8  %-d^  !"#MM'22EE."""!EEE"JJx(((E sA A)(A)c |j|}t}|D]F}||}||js||G|r)|d||t |fd}ns|||j|=|D]<}|j|t|=| |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 unmatchedrrUr_s r.try_to_replacezDependencyFinder.try_to_replaces& 5!EE  ! !A&&q))G==!122 ! a     LL-5#I..0 1 1 1FF  $ $U + + + 5! > > %%h66::1====  ! !( + + +F rEFci|_i|_i|_i|_t |pg}d|vr)|d|t gdz}t |tr |x}}t d|nM|j ||x}}|td|zt d|d|_ t }t |g}t |g}|rb|}|j} | |jvr||n*|j| } | |kr||| ||j|jz} |j} t } |r(||vr$d D]!}d |z}||vr| t+|d |zz} "| | z| z}|D]}||}|s t d ||j ||}||s|j |d}|3t d ||d|fn|j|j}}||f|jvr|||||| vr9||vr5||t d|j|D]w}|j} | |jvr;|j|t |M|j| } | |kr||| |x|bt |j}|D]2}||v|_|jr t d|j3t d|||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)rNzUnable 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_extrasrrr rtodo install_distsrtrireqtssreqtsereqtsrCr` all_reqtsr providersrnrrrs r.findzDependencyFinder.findsp4   ++,, K     u % % % 3===>> >K k< 0 0 .& &D5 LL3U ; ; ; ;<..{;F/HH HD5|&'<{'JKKK LLu - - -55D6{{UG 1 D88::D8D4---%%d++++*40D==''eX>>>&);;F(FUUF Et}443EEC AK'''$ 0C"D"DD&0I D D //22  DLL!>>> $ 24 8 A:: //5(CCCDS1 DfDJ%%''(( 4 4D)-])BD &) 4 B!2444 '///hrErf)NF) rFrGrHrIrXrrrrrrrMrEr.rr-s6666 G G G((($ 0&&&PllllllrErrf)Lr1iorrloggingrjr}r(r@ ImportErrordummy_threadingrwr5rcompatrrrr r r r r rrr:rrrrdatabaserrrrrrutilrrrrrrrr rr!r"rr#r$ getLoggerrFrr)rr*rorlr*r/r1objectrOrrr r.rzrrrrrrrMrEr.rs    ((((''''''( 33333333333333333333333333333333@?????????44444444####################98888888''''''''  8 $ $bj.// "*2BD 9 9BJ?@@'     FFFFF)FFF@~~~~~f~~~B .....W...bBBBBBgBBBJ777776777twwwwwGwwwt?????w???D$$$$$'$$$Ng8VVVVVVVVv%$))*D25777# %%%  jjjjjvjjjjjs % 11