\hdZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z mZddlmZddlmZmZddlmZmZmZmZdd lmZmZmZmZmZmZm Z gd Z!ejDe#Z$d Z%d Z&d eddde%dfZ'dZ(Gdde)Z*Gdde)Z+Gdde)Z,Gdde,Z-Gdde-Z.Gdde-Z/e.Z0e/Z1Gdd e)Z2d%d!Z3d"Z4d#Z5d$Z6y)&zPEP 376 implementation.)unicode_literalsN)DistlibException resources)StringIO) get_schemeUnsupportedVersionError)MetadataMETADATA_FILENAMEWHEEL_METADATA_FILENAMELEGACY_METADATA_FILENAME)parse_requirementcached_propertyparse_name_and_version read_exports write_exports CSVReader CSVWriter) DistributionBaseInstalledDistributionInstalledDistributionEggInfoDistributionDistributionPathzpydist-exports.jsonzpydist-commands.json INSTALLERRECORD REQUESTED RESOURCESSHAREDz .dist-infoc"eZdZdZdZdZdZy)_CachezL A simple cache mapping names and .dist-info paths to distributions c.i|_i|_d|_y)zZ Initialise an instance. There is normally one for each DistributionPath. FN)namepath generatedselfs _/root/niggaflix-v3/playground/venv/lib/python3.12/site-packages/pip/_vendor/distlib/database.py__init__z_Cache.__init__1s  cz|jj|jjd|_y)zC Clear the cache, setting it to its initial state. FN)r"clearr#r$r%s r'r+z _Cache.clear9s'  r)c|j|jvrO||j|j<|jj|jgj |yy)z` Add a distribution to the cache. :param dist: The distribution to add. N)r#r" setdefaultkeyappendr&dists r'addz _Cache.addAsN 99DII %#'DIIdii II 2 . 5 5d ; &r)N)__name__ __module__ __qualname____doc__r(r+r2r)r'r r ,sr+r?r%s r' clear_cachezDistributionPath.clear_cachels$  r)c#Kt}|jD]}tj|}||j d}|r |j s1577**u~~103 Z8(,QVVT::?$ C, C6AA!C^CNN32#MM# "3MBB Cs]BI*A H 4H 7I*8#H G>)CH 7I*>H H  I'A I"I*"I''I*c|jj }|jxr|jj }|s|r|j D]I}t |t r|jj|/|jj|K|rd|j_|rd|j_yyy)zk Scan the path for distributions and populate the cache with those that are found. TN)r>r$r=r?rx isinstancerr2)r&gen_distgen_eggr1s r'_generate_cachez DistributionPath._generate_caches {{,,,##EDOO,E,E(E w113 .d$9:KKOOD)OO''-  . (, %,0)r)cZ|jdd}dj||gtzS)ao The *name* and *version* parameters are converted into their filename-escaped form, i.e. any ``'-'`` characters are replaced with ``'_'`` other than the one in ``'dist-info'`` and the one separating the name from the version number. :parameter name: is converted to a standard distribution name by replacing any runs of non- alphanumeric characters with a single ``'-'``. :type name: string :parameter version: is converted to a standard version string. Spaces become dots, and all other non-alphanumeric characters (except dots) become dashes, with runs of multiple dashes condensed to a single dash. :type version: string :returns: directory name :rtype: string-_)replacer`r^)clsr"versions r'distinfo_dirnamez!DistributionPath.distinfo_dirnames,&||C%xxw(<77r)c#FK|js|jD]}|y|j|jjj D]}||j r.|jjj D]}|yyw)a5 Provides an iterator that looks for distributions and returns :class:`InstalledDistribution` or :class:`EggInfoDistribution` instances for each one of them. :rtype: iterator of :class:`InstalledDistribution` and :class:`EggInfoDistribution` instances N)r@rxr}r>r#valuesr=r?r0s r'get_distributionsz"DistributionPath.get_distributionss""113     " ((//1      OO00779DJ!sBB!cd}|j}|js+|jD]}|j|k(s|}|S|S|j ||j j vr|j j |d}|S|jr4||jj vr|jj |d}|S)a= Looks for a named distribution on the path. This function only returns the first result found, as no more than one value is expected. If nothing is found, ``None`` is returned. :rtype: :class:`InstalledDistribution`, :class:`EggInfoDistribution` or ``None`` Nr) lowerr@rxr.r}r>r"r=r?)r&r"resultr1s r'get_distributionz!DistributionPath.get_distributionszz|""113 88t#!F    "t{{'''))$/2 ""tt/C/C'C--d3A6 r)c#Kd}|" |jj|d|d}|j D]q}t |dst jd|&|j}|D];}t|\}}| ||k(s|S||k(s%|j|s7|qsy#t$rtd|d|wxYww)a Iterates over all distributions to find which distributions provide *name*. If a *version* is provided, it will be used to filter the results. This function only returns the first result found, since no more than one values are expected. If the directory is not found, returns ``None``. :parameter version: a version specifier that indicates the version required, conforming to the format in ``PEP-345`` :type name: string :type version: string N ()zinvalid name or version: , provideszNo "provides": %s) rAmatcher ValueErrorrrhasattrrdrerrmatch) r&r"rrr1providedpp_namep_vers r'provides_distributionz&DistributionPath.provides_distributions   8,,..D'/JK **, "D4, 0$7==! "A$:1$=MFE!T>"&J!!T>gmmE.B"&J! " "  8&(,g(788 8s.C !B.AC  C C $ C .C  C cf|j|}|td|z|j|S)z5 Return the path to a resource file. zno distribution named %r found)r LookupErrorget_resource_path)r&r" relative_pathr1s r' get_file_pathzDistributionPath.get_file_path+s;$$T* <>EF F%%m44r)c#K|jD]@}|j}||vs||}| ||vs ||(|jD]}|Byw)z Return all of the exported entries in a particular category. :param category: The category to search for entries. :param name: If specified, only entries with that name are returned. N)rexportsr)r&categoryr"r1rndvs r'get_exported_entriesz%DistributionPath.get_exported_entries4si**, D A1}hK#qyg XXZ   s$A A$A)NFrD)r3r4r5r6r(rFrIproperty cache_enabledrKrxr} classmethodrrrrrrr7r)r'rrKse-(#$/1CDM 4Cl1&88*,4'"R5 r)rceZdZdZdZ dZ dZedZeZ edZ edZ dZ edZ ed Zed Zed Zed Zd ZdZdZdZy)rz A base class for distributions, whether installed or from indexes. Either way, it must have some metadata, so that's all that's needed for construction. Fc||_|j|_|jj|_|j|_d|_d|_d|_d|_t|_ i|_ y)z Initialise an instance. :param metadata: The instance of :class:`Metadata` describing this distribution. N) rRr"rr.rlocatordigestextrascontextrX download_urlsdigests)r&rRs r'r(zDistribution.__init__Ysb ! MM 99??$''      U r)c.|jjS)zH The source archive download URL for this distribution. )rR source_urlr%s r'rzDistribution.source_urljs }}'''r)c:|jd|jdS)zX A utility property which displays the name and version in parentheses. rrr"rr%s r'name_and_versionzDistribution.name_and_versionss !IIt||44r)c|jj}|jd|jd}||vr|j ||S)z A set of distribution names and versions provided by this distribution. :return: A set of "name (version)" strings. rr)rRrr"rr/)r&plistss r'rzDistribution.provideszs<  &&DLL 1 E> LLO r)c|j}t||}tjd|j||t |j ||j|jS)Nz)%s: got requirements %r from metadata: %r)rrS) rRgetattrrdrer"rXget_requirementsrr)r&req_attrmdreqtss r'_get_requirementszDistribution._get_requirementss] ]]H% @$))u &   dkkt||  LN Nr)c$|jdS)N run_requiresrr%s r'rzDistribution.run_requires%%n55r)c$|jdS)N meta_requiresrr%s r'rzDistribution.meta_requires%%o66r)c$|jdS)Nbuild_requiresrr%s r'rzDistribution.build_requiress%%&677r)c$|jdS)N test_requiresrr%s r'rzDistribution.test_requiresrr)c$|jdS)N dev_requiresrr%s r'rzDistribution.dev_requiresrr)ct|}t|jj} |j |j }|j}d}|jD]*}t|\}} ||k7r |j| }|S|S#t $r=tjd||jd}|j |}YwxYw#t $rYwxYw)z Say if this instance matches (fulfills) a requirement. :param req: The requirement to match. :rtype req: str :return: True if it matches, else False. +could not read version %r - using name onlyrF)rrrRrQr requirementr rdrisplitr.rrr) r&reqrnrQrr"rrrrs r'matches_requirementz Distribution.matches_requirements c "DMM001 +nnQ]]3G{{ A215MFE~  u-   %' + NNH# N99;q>DnnT*G  + +  s$B9CACC C%$C%c~|jrd|jz}nd}d|jd|jd|dS)zC Return a textual representation of this instance, z [%s]rMz)rr"r)r&suffixs r'__repr__zDistribution.__repr__s4 ??t.FF-1YY fMMr)ct|t|urd}|S|j|jk(xr4|j|jk(xr|j|jk(}|S)a< See if this distribution is the same as another. :param other: The distribution to compare with. To be equal to one another. distributions must have the same type, name, version and source_url. :return: True if it is the same, else False. F)typer"rr)r&otherrs r'__eq__zDistribution.__eq__sg ;d4j (F ii5::->$,,%--2O>//U-=-==  r)ct|jt|jzt|jzS)zH Compute hash in a way which matches the equality test. )hashr"rrr%s r'__hash__zDistribution.__hash__s.DIIdll!33d4??6KKKr)N)r3r4r5r6build_time_dependency requestedr(rr download_urlrrrrrrrrrrrrr7r)r'rrGs " I5"(( L 55   N6677887766BN Lr)rc0eZdZdZdZdfd ZddZxZS)rz] This is the base class for installed distributions (whether PEP 376 or legacy). NcHtt| |||_||_y)a Initialise an instance. :param metadata: An instance of :class:`Metadata` which describes the distribution. This will normally have been initialised from a metadata file in the ``path``. :param path: The path of the ``.dist-info`` or ``.egg-info`` directory for the distribution. :param env: This is normally the :class:`DistributionPath` instance where this distribution was found. N)superrr(r# dist_path)r&rRr#rS __class__s r'r(z"BaseInstalledDistribution.__init__s# '7A r)c$| |j}|tj}d}ntt|}d|jz}||j }t j |jdjd}||S)a Get the hash of some data, using a particular hash algorithm, if specified. :param data: The data to be hashed. :type data: bytes :param hasher: The name of a hash implementation, supported by hashlib, or ``None``. Examples of valid values are ``'sha1'``, ``'sha224'``, ``'sha384'``, '``sha256'``, ``'md5'`` and ``'sha512'``. If no hasher is specified, the ``hasher`` attribute of the :class:`InstalledDistribution` instance is used. If the hasher is determined to be ``None``, MD5 is used as the hashing algorithm. :returns: The hash of the data. If a hasher was explicitly specified, the returned hash will be prefixed with the specified hasher followed by '='. :rtype: str rMz%s==ascii) hasherhashlibmd5rrbase64urlsafe_b64encoderstripdecode)r&datarprefixrs r'get_hashz"BaseInstalledDistribution.get_hashs& >[[F >[[FFWf-FT[[(F$$&))&188>EEgN((r)rD)r3r4r5r6rr(r __classcell__rs@r'rrs F )r)rceZdZdZdZdfd ZdZdZdZe dZ dZ d Z d Z d Zdd Zd Ze dZddZdZdZdZdZej0ZxZS)ra  Created with the *path* of the ``.dist-info`` directory provided to the constructor. It reads the metadata contained in ``pydist.json`` when it is instantiated., or uses a passed in Metadata instance (useful for when dry-run mode is being used). sha256cg|_tj|x|_}|t d|z|rH|j r<||j jvr$|j j|j}n||jt}||jt}||jt}|t dtd|tj|j5}t!|d}dddt"t$|O||||r'|j r|j j)||jd}|du|_t,jj/|d}t,jj1|rJt3|d5}|j5j7d } ddd j9|_yy#1swYxYw#1swY,xYw) Nzfinder unavailable for %szno z found in rNrOr top_level.txtrbutf-8)modulesrrYrmrr@r>r#rRrZr r r rarbrcr rrr(r2rosr`existsopenreadr splitlines) r&r#rRrSrmrnrurfrrs r'r(zInstalledDistribution.__init__$s (88>> f >84?@ @ 3%%$#**//*Azzt,55H   -.AyKK 78yKK 89y "3T";<<##AKKM2 Ef#F8D E #T3HdCH 3%% JJNN4 KK $$ GGLL / 77>>! a 0!vvxw/ 0??,DL  E E 0 0s>G67 H6G?H cVd|jd|jd|jdS)Nz|jd}tj|j5}t |5}|D] \}}||k(s |ccdddcdddS ddddddt d|z#1swYxYw#1swY#xYw)aW NOTE: This API may change in the future. Return the absolute path to a resource file with the given relative path. :param relative_path: The path, relative to .dist-info, of the resource of interest. :return: The absolute path where the resource is to be found. rr Nz3no resource file with relative path %r is installed)r rarbrcrKeyError)r&rrnruresources_readerrelative destinations r'rz'InstalledDistribution.get_resource_paths  & &{ 3    . +&&) +-=-=+)Hk=0** + + + ++ + + &(567 7  + + + +s5 BBB B'B)BB BBc#>K|jD]}|yw)z Iterates over the ``RECORD`` entries and returns a tuple ``(path, hash, size)`` for each line. :returns: iterator of (path, hash, size) N)r)r&rs r'list_installed_filesz*InstalledDistribution.list_installed_filess%'') FL sctjj|d}tjj|j}|j |}tjj|d}|j d}t jd||ryt|5}|D]}tjj|s|jdrdx} } nVdtjj|z} t|d5} |j| j} ddd|j |s|r1|j |r tjj||}|j!| | f|j |r tjj||}|j!|ddfddd|S#1swYxYw#1swY|SxYw)z Writes the ``RECORD`` file, using the ``paths`` iterable passed in. Any existing ``RECORD`` file is silently overwritten. prefix is used to determine when to write absolute paths. rMr creating %sNz.pycz.pyoz%dr)rr#r`dirname startswithrrdinforisdirr]getsizerrrrelpathwriterow) r&pathsrdry_runbasebase_under_prefix record_pathwriterr# hash_valuerfps r'write_installed_filesz+InstalledDistribution.write_installed_filessfb)wwtyy) OOF3ww||D"%,,X6  M;/  { # 3v :77==&$--8H*I(**J"''//$"77DdD)>R%)]]2779%= >??4(->151H77??46Dz4 89 :%%d+ ggook4@ OO["b1 2# 3$>> 3$s&0A)G6 G*9B'G6*G3 /G66Hchg}tjj|j}|jd}|j D]T\}}}tjj |s tjj ||}||k(rMtjj|s|j|dddftjj|sttjj|}|r||k7r|j|d||f|sd|vr|jddd}nd }t|d 5} |j| j|} | |k7r|j|d || fd d d W|S#1swYdxYw)  Checks that the hashes and sizes of the files in ``RECORD`` are matched by the files themselves. Returns a (possibly empty) list of mismatches. Each entry in the mismatch list will be a tuple consisting of the path, 'exists', 'size' or 'hash' according to what didn't match (existence is checked first, then size, then hash), the expected value and the actual value. rrTFr=rrNrr)rr#r(rr$isabsr`rr/isfilestrr,rrrr) r& mismatchesr1r3r#r5r actual_sizerr actual_hashs r'check_installed_filesz+InstalledDistribution.check_installed_filess wwtyy),,X6 &*&?&?&A I "D*d77==&ww||D$/{"77>>$'!!44"?@%!"''//$"78 K4/%%tVT;&GHj(!+!1!1#q!9!!<!%dD)IQ&*mmAFFHf&E &*4&--!%vz; GIII# I, IIs ;F''F1 ci}tjj|jd}tjj|rt j |dd5}|j j}dddD]C}|jdd\}}|dk(r"|j|gj|?|||<E|S#1swYSxYw) a A dictionary of shared locations whose keys are in the set 'prefix', 'purelib', 'platlib', 'scripts', 'headers', 'data' and 'namespace'. The corresponding value is the absolute path of that category for this distribution, and takes into account any paths selected by the user at installation time (e.g. via command-line arguments). In the case of the 'namespace' key, this would be a list of absolute paths for the roots of namespace packages in this distribution. The first time this property is accessed, the relevant information is read from the SHARED file in the .dist-info directory. rrnrencodingNr:r namespace) rr#r`r<codecsrrrrr-r/)r&r shared_pathrlinesliner.rHs r'shared_locationsz&InstalledDistribution.shared_locationssggll499h7 77>>+ &[#@ .A++- . (!ZZQ/ U+%%%c2.55e<"'F3K  (   . .s $CCc tjj|jd}tj d||ryg}dD]@}||}tjj ||s+|j |d|B|jddD]}|j d|ztj|d d 5}|jd j|ddd|S#1swY|SxYw) aa Write shared location information to the SHARED file in .dist-info. :param paths: A dictionary as described in the documentation for :meth:`shared_locations`. :param dry_run: If True, the action is logged but no file is actually written. :return: The path of the file written to. rr&N)rlibheadersscriptsrr:rEr7z namespace=%srrrC ) rr#r`rdr*r+r/getrFrwrite) r&r/r0rGrHr.r#nsrs r'write_shared_locationsz,InstalledDistribution.write_shared_locations sggll499h7  M;/ B 4C:Dww}}U3Z( T23 4))K, .B LL", - .[[cG < & GGDIIe$ % & &s !C99Dc|tvrtd|d|jtj|j}|td|jz|j |S)N#invalid path for a dist-info file: rzUnable to get a finder for %s) DIST_FILESrr#rrYrZ)r&r#rms r'r z+InstalledDistribution.get_distinfo_resource%se z !"15tyy$BC C**4995 >"#BTYY#NO O{{4  r)c |jtjdk\r}|jtjdd\}}||jjtjdk7r)t d|d|j d|jd|tvrt d |d |jtjj|j|S) a Returns a path located under the ``.dist-info`` directory. Returns a string representing the path. :parameter path: a ``'/'``-separated path relative to the ``.dist-info`` directory or an absolute path; If *path* is an absolute path and doesn't start with the ``.dist-info`` directory path, a :class:`DistlibException` is raised :type path: str :rtype: str rNzdist-info file z does not belong to the rz distributionrUr) rZrseprr#rr"rrVr`)r&r#rs r'rz'InstalledDistribution.get_distinfo_file.s 99RVV  !%)ZZ%7%< " d499??266#:2#>>&&*DIIt||EFF z !"15tyy$BC Cww||DIIt,,r)c#NKtjj|j}|jD]e\}}}tjj |s tjj ||}|j |jsb|gyw)z Iterates over the ``RECORD`` entries and returns paths for each line if the path is pointing to a file located in the ``.dist-info`` directory or one of its subdirectories. :returns: iterator of paths N)rr#r(rr;r`r))r&r1r#rrs r'list_distinfo_filesz)InstalledDistribution.list_distinfo_filesKsvwwtyy)$($5$5$7  D(D77==&ww||D$/tyy)  s BB%B%cXt|txr|j|jk(SrD)rzrr#r&rs r'rzInstalledDistribution.__eq__[s'5"78,II+ -r))NNF)r3r4r5r6rr(rrrrrrrrr$r7rArJrSr rr\robjectrrrs@r'rrsF -D03.    &7(!F"H42!-: - Hr)rcpeZdZdZdZiZd fd ZdZdZdZ dZ dZ d d Z d Z ejZxZS) raCreated with the *path* of the ``.egg-info`` directory or file provided to the constructor. It reads the metadata contained in the file itself, or if the given path happens to be a directory, the metadata is read from the file ``PKG-INFO`` under that directory.Tcd}||_||_|rf|jrZ||jjvrB|jj|j}|||j |j nX|j|}|||j |j |r'|jr|jj|tt|/|||y)NcJ||_|j|_||_yrD)r"rr.r)rnrs r'set_name_and_versionz:EggInfoDistribution.__init__..set_name_and_versionnsAFGGIAEAIr)) r#rr@r?rRr"r _get_metadatar2rrr()r&r#rSrerRrs r'r(zEggInfoDistribution.__init__ls    3%%$#..2E2E*E~~**4099H x}}h6F6F G))$/H !x}}h6F6F Gs))""4( !41(D#Fr)cd}dfd}dx}}|jdrKtjj|rtjj |d}tjj |d}t |d}tjj |d} tjj |d }|| }nIt j|} t| jd jd } t | d } | jd } | jdjd}| jd}n|jdrtjj|rhtjj |d} || }tjj |d}tjj |d }t |d}ntd|z|r|j||U|Stjj|r4t|d5} | j!jd}ddd|sg}n|j#}||_|S#t$rd}YwxYw#1swY8xYw)Ncg}|j}|D]}|j}|s|jdrtj d||St |}|stj d|d|j rtj d|js|j|jdjd|jD}|j|jd|d|S) zCreate a list of dependencies from a requires.txt file. *data*: the contents of a setuptools-produced requires.txt file. [z.Unexpected line: quitting requirement scan: %rz#Not recognised as a requirement: %rz4extra requirements in requires.txt are not supportedrc3&K|] }d|z yw)z%s%sNr7).0cs r' zQEggInfoDistribution._get_metadata..parse_requires_data..s$GAVaZ$Grr) rstripr)rdrirr constraintsr/r"r`)rreqsrHrIrnconss r'parse_requires_dataz>EggInfoDistribution._get_metadata..parse_requires_datas DOO%E <zz|??3'NNH$PK&d+NN#H$O88NN$34}}KK'99$G$GGDKKQVVT :;) <*Kr)cg} tj|dd5}|j}ddd|S#1swY|SxYw#t$rY|SwxYw)zCreate a list of dependencies from a requires.txt file. *req_path*: the path to a setuptools-produced requires.txt file. rnrN)rFrrIOError)req_pathrqr6rss r'parse_requires_pathz>EggInfoDistribution._get_metadata..parse_requires_pathsg D [[38:B.rwwy9D:K :K K s+A =A AA A AArUzEGG-INFOzPKG-INFOrN)r#rQz requires.txtrzEGG-INFO/PKG-INFOutf8rOzEGG-INFO/requires.txtzEGG-INFO/top_level.txtrrTz,path must end with .egg-info or .egg, got %rr)r]rr#r+r`r zipimport zipimporterrget_datarruradd_requirementsrrrrr)r&r#requiresrwtl_pathtl_datar meta_pathrRrvzipfrPrrrss @r'rfz!EggInfoDistribution._get_metadatasI < ! ' == ww}}T"GGLLz2GGLLJ7 #8D77<<>:'',,q/:.x8!,,T2"MM"56==fEG#GHE$==)@AD"mm,DELL!G24;;w3GHH]]; 'ww}}T"77<<n=.x8ww||D*5'',,t_=T(;H"$,.2$34 4   % %h / ?"rww~~g'>'4(7Affhoog6G7G((*G 3$#H$$77s$AJ)# J:) J76J7:KcVd|jd|jd|jdS)Nzr3r#rs r'rAz)EggInfoDistribution.check_installed_filess ggll499.CD 77>>+ &"779 E a;&ww~~d+%%tXtU&CD  E r)c d}d}tjj|jd}g}tjj|rt j |dd5}|D]}|j }tjjtjj|j|}tjj|s(tjd||jdrtjj|r|j|||||f d d d |j|d d f|S#1swYxYw) z Iterates over the ``installed-files.txt`` entries and returns a tuple ``(path, hash, size)`` for each line. :returns: a list of (path, hash, size) ct|d} |j}|jtj|j S#|jwxYw)Nr)rrcloserr hexdigest)r#rcontents r'_md5z6EggInfoDistribution.list_installed_files.._md5sLT4 A &&( ;;w'113 3 s AA#c@tj|jSrD)rstatst_size)r#s r'_sizez7EggInfoDistribution.list_installed_files.._size s774=(( (r)rrnrrCzNon-existent file: %sr'N) rr#r`rrFrronormpathrdrir]r+r/)r&rrr3rrrIrs r'r$z(EggInfoDistribution.list_installed_filess 4 )ggll499.CD  77>>+ &[#@ >A >D::>!,'>B::&67$77==+ q$q'58&<= > > MM;d3 4  > >s+CE0/"E00E9c# Ktjj|jd}tjj|rd}t j |dd5}|D]}|j }|dk(rd}|rtjjtjj|j|}|j|js|r|| dddyy#1swYyxYww) a  Iterates over the ``installed-files.txt`` entries and returns paths for each line if the path is pointing to a file located in the ``.egg-info`` directory or one of its subdirectories. :parameter absolute: If *absolute* is ``True``, each returned path is transformed into a local absolute path. Otherwise the raw value from ``installed-files.txt`` is returned. :type absolute: boolean :returns: iterator of paths rTrnrrCz./FN) rr#r`rrFrrorr))r&absoluter3skiprrIrs r'r\z'EggInfoDistribution.list_distinfo_files sggll499.CD 77>>+ &D[#@ +A +D:: "z " [label="z"] z" zsubgraph disconnected { zlabel = "Disconnected" zbgcolor = red z"%s"rOz} )rQritemsrr/r")r&rskip_disconnected disconnectedr1adjsrrs r'to_dotzDependencyGraph.to_dots+  *+--335 HJD$4yA~&7##D) $ H u$GG!YY E;<GG 5::FG  H H!S%6%: GG/ 0 GG. / GG% &$ *+   GGEN r)c :g}i}|jjD] \}}|dd||< g}t|jddD]\}}|r |j|||=|sn|jD]$\}}|Dcgc]\}}||vs ||fc}}||<&tj d|Dcgc]}|j d|jd c}|j||t|jfScc}}wcc}w)aa Perform a topological sort of the graph. :return: A tuple, the first element of which is a topologically sorted list of distributions, and the second element of which is a list of distributions that cannot be sorted because they have circular dependencies and so form a cycle. NzMoving to result: %srr) rrlistr/rdrer"rrkeys)r&ralistkr to_removerrns r'topological_sortz DependencyGraph.topological_sorts#''--/ DAqtE!H IU[[]+A. !1$$Q'a !  H1/0Gtq!AY4FQFGa H LL/CLMaqvvqyy9M O MM) $ tEJJL))) HMs DD;#D cg}|jjD]%\}}|j|j|'dj |S)zRepresentation of the graphrO)rrr/rr`)r&rr1rs r'rzDependencyGraph.__repr__sM--335 0JD$ MM$... / 0yy  r)rD)r)T) r3r4r5r6r(rrrrrrrrr7r)r'rrIs6  - + F3 !@*>!r)rc0t|}t}i}|D]m}|j||jD]K}t |\}}t j d||||j|gj||fMo|D]}|j|jz|jz|jz}|D]s} |j| } | j"}d} ||vr8||D]0\}} | j%|} | s|j'|| | d} n| rb|j)|| u|S#t$r=t jd| | j!d}|j|} YwxYw#t$rd} YwxYw)a6Makes a dependency graph from the given distributions. :parameter dists: a list of distributions :type dists: list of :class:`distutils2.database.InstalledDistribution` and :class:`distutils2.database.EggInfoDistribution` instances :rtype: a :class:`DependencyGraph` instance zAdd to provided: %s, %s, %srrFT)rrrrrrdrer-r/rrrrrr rirr.rrr)distsrQgraphrr1rr"rr}rrmatchedproviderrs r' make_graphrs F  EHB t$ BA215MD' LL6gt L   b ) 0 0'4 A BB-%%(:(::))*,0,=,=> -C / ..-;;DGx)1$ %GX& ' g 6tXs;"& !!$,3 --: L/+ /L"$yy{1~ ...  /3& %&s%D>7F>AFF F F c:||vrtd|jzt|}|g}|j|}|rN|j }|j ||j|D]}||vs|j ||rN|j d|S)zRecursively generate a list of distributions from *dists* that are dependent on *dist*. :param dists: a list of distributions :param dist: a distribution, member of *dists* for which we are interested 1given distribution %r is not a member of the listr)rr"rrpopr/)rr1rdeptodorsuccs r'get_dependent_distsrs 5 -/3yy 9: : u E &C   d #D  HHJ 1 &&q) "D3 D! " GGAJ Jr)c||vrtd|jzt|}t}|j|}td|D}|rn|j d}|j ||j|}|D]3}|d}||vs ||vs|j ||j|5|rn|S)aRecursively generate a list of distributions from *dists* that are required by *dist*. :param dists: a list of distributions :param dist: a distribution, member of *dists* for which we are interested in finding the dependencies. rc3&K|] }|d yw)rNr7)rkts r'rmz%get_required_dists..8s"qt"rnr)rr"rrXrrr2r/) rr1rrrrlr pred_listpreds r'get_required_distsr)s 5 -/3yy 9: : u E %C    %D "T" "D  HHJqM  ((+  "DQA|   D!  "  Jr)c |jdd}tdi|}||_||_|xsd|_t |S)zO A convenience method for making a dist given just a name and version. summaryzPlaceholder for summaryr7)rr r"rrr)r"rkwargsrrs r' make_distrFsHjj$=>G  F BBGBJ55BJ  r))r:)7r6 __future__rrrFrarloggingrr_r;ryrMrrcompatrrrr rRr r r r utilrrrrrrr__all__ getLoggerr3rdrCOMMANDS_FILENAMErVr^r`r rrrrrrfrgrrrrrr7r)r'rs '   )811FFF    8 $(*,h +X7  y vy xYL6YLx4) 4)nF5FR _3_D'$M!fM!`3l4: r)