8fdZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z mZddlmZddlmZmZddlmZmZmZmZdd lmZmZmZmZmZmZm Z gd Z!ej"e#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%Z6dS)'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$eZdZdZdZdZdZdS)_CachezL A simple cache mapping names and .dist-info paths to distributions c0i|_i|_d|_dS)zZ Initialise an instance. There is normally one for each DistributionPath. FN)namepath generatedselfs |/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/pip/_vendor/distlib/database.py__init__z_Cache.__init__1s  cx|j|jd|_dS)zC Clear the cache, setting it to its initial state. FN)r"clearr#r$r%s r'r+z _Cache.clear9s3  r)c|j|jvrD||j|j<|j|jg|dSdS)z` Add a distribution to the cache. :param dist: The distribution to add. N)r#r" setdefaultkeyappendr&dists r'addz _Cache.addAsW 9DI % %#'DIdi I 2 . . 5 5d ; ; ; ; ; & %r)N)__name__ __module__ __qualname____doc__r(r+r2r)r'r r ,sK<<<<r+r?r%s r' clear_cachezDistributionPath.clear_cachels2  r)c#Kt}|jD]P}tj|}||d}|r|js9t |j}|D]}||}|r |j|vr$ |jr|trtttg}|D]0}tj||} || } | rn1tj| 5} t%| d} dddn #1swxYwYt&d|j||jt-|j| |Vnm|jrf|drQt&d|j||jt1|j|V#t2$rS} d}t&||j| d dl}|||j| fzd Yd} ~ d} ~ wwxYwRdS) zD Yield .dist-info and/or .egg(-info) distributions. NlegacyfileobjschemezFound %s)metadataenv) .egg-info.eggzBUnable to read distribution at %s, perhaps due to bad metadata: %sr) stacklevel)setr#rfinder_for_pathfind is_containersortedr<endswith DISTINFO_EXTr r r posixpathjoin contextlibclosing as_streamr loggerdebugr2new_dist_classr=old_dist_class Exceptionwarningwarningswarn)r&seenr#finderrrsetentrypossible_filenamesmetadata_filename metadata_pathpydiststreamrRemsgrjs r'_yield_distributionsz%DistributionPath._yield_distributionsssuuI, C, CD.t44F~ BA AN !+&&D$ C$ CKK&&AFdNN C);enn\.J.J;-/F4.*2D%%-,5N %'8-:-:M%+[[%?%?F%& %&%'/0@0@0B0BCCAv'/7?(A(A(AHAAAAAAAAAAAAAAA Z888(((,QV6>157777777*;u~~10303; Z888(((,QVT::::: CCC^CNN3222#OOOMM# "3MBBBBBBBB CA$ C, C, CsE A)H6&HD:. H:D> >HD> CH I%AI  I%cR|jj }|jo |jj }|s|r|D]L}t |t r|j|2|j|M|r d|j_|rd|j_dSdSdS)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 {,,#EDO,E(E  1w 11133 . .d$9::.KOOD))))O''---- -(, % 1,0))) 1 1 1 1r)cl|dd}d||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_dirnames2&||C%%xxw((<77r)c# K|js|D]}|VdS||jjD]}|V|jr%|jjD]}|VdSdS)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" 1133       " " " (//11      O07799DJJJJ  r)c^d}|}|js'|D]}|j|kr|}nnh|||jjvr|jj|d}n-|jr&||jjvr|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||" 71133  8t##!FE$  " " "t{''')$/2" 7tt/C'C'C-d3A6 r)c#Kd}|E |j|d|d}n##t$rtd|d|wxYw|D]|}t |dst d|.|j}|D]D}t|\}}| ||kr|Vn##||kr| |r|VnE}dS)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_distributionsB   8,..DDD'''/JKK 8 8 8&&(,gg(7888 8**,, " "D4,, " 0$7777=! " "A$:1$=$=MFE!T>>"&JJJ!E*"T>>gmmE.B.B>"&JJJ!E# " "s ) A c~||}|td|z||S)z5 Return the path to a resource file. Nzno distribution named %r found)r LookupErrorget_resource_path)r&r" relative_pathr1s r' get_file_pathzDistributionPath.get_file_path+sD$$T** <>EFF F%%m444r)c#K|D]A}|j}||vr4||}|||vr ||V&|D]}|VBdS)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_entries4s**,, D A1}}hK#qyyg XXZZ   r))NFrD)r3r4r5r6r(rFrIproperty cache_enabledrKrxr} classmethodrrrrrrr7r)r'rrKs----(###$$$H/1CDDM   4C4C4Cl111&88[8*,4'"'"'"'"R555      r)rceZdZdZdZ dZ dZedZeZ edZ edZ dZ edZ ed Zed Zed Zed Zd ZdZdZdZdS)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|_|j|_|j|_d|_d|_d|_d|_t|_ i|_ dS)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__Ysd ! M 9??$$'      UU 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 !IIIt|||44r)ct|jj}|jd|jd}||vr|||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.provideszsA  &DLLL 1 E>> LLOOO r)c|j}t||}td|j||t |||j|jS)Nz)%s: got requirements %r from metadata: %r)rrS) rRgetattrrdrer"rXget_requirementsrr)r&req_attrmdreqtss r'_get_requirementszDistribution._get_requirementssk ]H%% @$)u & & &   dkt|  L LNN Nr)c,|dS)N run_requiresrr%s r'rzDistribution.run_requires%%n555r)c,|dS)N meta_requiresrr%s r'rzDistribution.meta_requires%%o666r)c,|dS)Nbuild_requiresrr%s r'rzDistribution.build_requiress%%&6777r)c,|dS)N test_requiresrr%s r'rzDistribution.test_requiresrr)c,|dS)N dev_requiresrr%s r'rzDistribution.dev_requiresrr)ct|}t|jj} ||j}nZ#t $rMtd|| d}||}YnwxYw|j }d}|j D]B}t|\}} ||kr | | }n#t $rY?wxYw|S)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 " "DM011 +nnQ]33GG& + + + NNH# N N N99;;q>DnnT**GGG  + {  A2155MFE~~  u--*     s$AABB C"" C/.C/cV|jr d|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__s? ? t.FFF-1YYY fffMMr)ct|t|urd}n0|j|jko|j|jko|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__sZ ;;d4jj ( (FFi5:->$,%-2O>/U-==  r)c~t|jt|jzt|jzS)zH Compute hash in a way which matches the equality test. )hashr"rrr%s r'__hash__zDistribution.__hash__s0DIdl!3!33d4?6K6KKKr)N)r3r4r5r6build_time_dependency requestedr(rr download_urlrrrrrrrrrrrrr7r)r'rrGsz " I5"((X( L 55X5   X NNN66X677X788X877X766X6BNNN   LLLLLr)rc0eZdZdZdZdfd ZddZxZS)rz] This is the base class for installed distributions (whether PEP 376 or legacy). Ncttt||||_||_dS)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__s6 '..77AAA r)c.||j}|tj}d}ntt|}d|jz}||}t j|dd}||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 NrMz%s==ascii) hasherhashlibmd5rrbase64urlsafe_b64encoderstripdecode)r&datarprefixrs r'get_hashz"BaseInstalledDistribution.get_hashs& >[F >[FFFWf--FT[(F$$&&)&1188>>EEgNN((r)rD)r3r4r5r6rr(r __classcell__rs@r'rrsb F      ))))))))r)rceZdZdZdZdfd ZdZdZdZe dZ d Z d Z d Z d ZddZdZe dZddZdZdZdZdZejZxZS)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). sha256Ncxg|_tj|x|_}|t d|z|r-|jr&||jjvr|jj|j}n|| t}|| t}|| t}|t dtd|tj|5}t!|d}dddn #1swxYwYt#t$|||||r!|jr|j|| d}|du|_t,j|d}t,j|rjt3|d5}|d } dddn #1swxYwY| |_dSdS) 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 (8>>> f >84?@@ @  E3% E$#*/*A*Azt,5HH   -..AyKK 788yKK 899y j"3"3"3TT";<<<#AKKMM22 Ef#F8DDD E E E E E E E E E E E E E E E #T**33HdCHHH  !3% ! JNN4 KK $ $$ GLL / / 7>>!   -a 0!vvxxw// 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0??,,DLLL - -s$=DD"D (HHHc8d|jd|jd|jdS)Nzz6InstalledDistribution._get_records..\s@@@t@@@r)N)get_distinfo_resourcerarbrcrrangelenr/) r&resultsrnru record_readerrowmissingr#checksumsizes r' _get_recordsz"InstalledDistribution._get_recordsMsX  & &x 0 0   . . ;&&))) ;]);;C@@U3s88Q-?-?@@@G+.=(D(DNND(D#9:::: ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;s6CAB* C*B. .C1B. 2CCCcji}|t}|r|}|S)a Return the information exported by this distribution. :return: A dictionary of exports, mapping an export category to a dict of :class:`ExportEntry` instances describing the individual export entries, and keyed by name. )rEXPORTS_FILENAMEr)r&rrns r'rzInstalledDistribution.exportsds;  & &'7 8 8  )&&((F r)ci}|t}|rMtj|5}t |}dddn #1swxYwY|S)z Read exports data from a file in .ini format. :return: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries. N)rrrarbrcr)r&rrnrus r'rz"InstalledDistribution.read_exportsrs  & &'7 8 8  .#AKKMM22 .f%f-- . . . . . . . . . . . . . . . sA!!A%(A%c|t}t|d5}t||ddddS#1swxYwYdS)a Write a dictionary of exports to a file in .ini format. :param exports: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries. wN)get_distinfo_filerrr)r&rrfrs r'rz#InstalledDistribution.write_exportss # #$4 5 5 "c]] &a '1 % % % & & & & & & & & & & & & & & & & & &sA  A A cr|d}tj|5}t |5}|D]'\}}||kr|ccdddcdddS( dddn #1swxYwYdddn #1swxYwYt d|z)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)rrarbrcrKeyError)r&rrnruresources_readerrelative destinations r'rz'InstalledDistribution.get_resource_paths  & &{ 3 3   . . +&&))) +-=-=++)Hk=00*** + + + + + + + + + + + + + + +1+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + &(5677 7sAB B B7B9 BB B B BB #B c#@K|D]}|VdS)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_filess8''))  FLLLL  r)Fcrtj|d}tj|j}||}tj|d}|d}t d||rdSt|5}|D]}tj |s| drdx} } nqdtj |z} t|d5} | | } dddn #1swxYwY||s|r5||r tj||}||| | f||r tj||}||ddfdddn #1swxYwY|S)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_filessqfb))wty)) OOF33w||D"%%,,X66  M;///  4 { # # 3v : :7==&&>$--8H*I*I>(**J"'//$"7"77DdD))>R%)]]27799%=%= >>>>>>>>>>>>>>>??4((7->7151H1H77??466Dz4 89999%%d++ A gook4@@ OO["b1 2 2 2# 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3$s8=A1H,.(E" H,"E& &H,)E& *B6H,,H03H0cg}tj|j}|d}|D]\}}}tj|s tj||}||krMtj|s||dddftj |rttj |}|r ||kr||d||f|rd|vr| ddd}nd }t|d 5} || |} | |kr||d || fd d d n #1swxYwY|S)  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& mismatchesr4r6r#r8r actual_sizerr actual_hashs r'check_installed_filesz+InstalledDistribution.check_installed_filess' wty)),,X66 &*&?&?&A&A I I "D*d7==&& 0w||D$//{""7>>$'' I!!44"?@@@@%% I!"'//$"7"788  IK4//%%tVT;&GHHHH Ij((!+!1!1#q!9!9!!<!%dD))IQ&*mmAFFHHf&E&E &*44&--!%vz; GIIIIIIIIIIIIIIIIII s8AG  G G ci}tj|jd}tj|rt j|dd5}|}dddn #1swxYwY|D]P}|dd\}}|dkr*| |g |K|||<Q|S) 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_locationss gll49h77 7>>+ & & ([#@@@ .A++-- . . . . . . . . . . . . . . . ( (!ZZQ// U+%%%%c2..55e<<<<"'F3KK s'BBBc:tj|jd}td||rdSg}dD]I}||}tj||r||d|J|ddD]}|d|ztj |d d 5}| d |dddn #1swxYwY|S) 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=rHr7z namespace=%srrrF ) rr#r`rdr-r.r/getrIrwrite) r&r2r3rJrKr.r#nsrs r'write_shared_locationsz,InstalledDistribution.write_shared_locations sUgll49h77  M;///  4B 4 4C:Dw}}U3Z(( 4 TT2333))K,, . .B LL", - - - - [cG < < < & GGDIIe$$ % % % & & & & & & & & & & & & & & &s)DDDc|tvrtd|d|jtj|j}|td|jz||S)N#invalid path for a dist-info file: rzUnable to get a finder for %s) DIST_FILESrr#rrYrZ)r&r#rms r'rz+InstalledDistribution.get_distinfo_resource%sw z ! !""15tyy$BCC C*4955 >"#BTY#NOO O{{4   r)c |tjdkr{|tjdd\}}||jtjdkr#t d|d|jd|jd|tvrt d |d |jtj |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 distributionrXr) rZrseprr#rr"rrYr`)r&r#rs r'rz'InstalledDistribution.get_distinfo_file.s 99RV   ! !%)ZZ%7%7%< " d49??26#:#:2#>>>&&&*ddDIIIt|||EFFF z ! !""15tyy$BCC Cw||DIt,,,r)c#BKtj|j}|D]c\}}}tj|s tj||}||jr|VddS)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&r4r#rrs r'list_distinfo_filesz)InstalledDistribution.list_distinfo_filesKswty))$($5$5$7$7   D(D7==&& 0w||D$//ty))    r)cLt|to|j|jkSrD)rzrr#r&rs r'rzInstalledDistribution.__eq__[s&5"788,I+ -r))NNF)r3r4r5r6rr(rrrrrrrrr'r:rDrMrVrrr_robjectrrrs@r'rrs`F - - - - - -D000333.  _     & & &777(!!!!F"""H_42!!!---: --- HHHHHr)rcfeZdZdZdZiZd fd ZdZdZdZ dZ d Z dd 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.TNcd}||_||_|rD|jr=||jjvr/|jj|j}|||j|jnO||}|||j|j|r!|jr|j|tt| |||dS)NcT||_||_||_dSrD)r"rr.r)rnrs r'set_name_and_versionz:EggInfoDistribution.__init__..set_name_and_versionns#AFGGIIAEAIIIr)) r#rr@r?rRr"r _get_metadatar2rrr()r&r#rSrhrRrs r'r(zEggInfoDistribution.__init__ls       )3% )$#.2E*E*E~*409H x}h6F G G G G))$//H ! x}h6F G G G )s) )""4((( !4((11(D#FFFFFr)c4d}dfd}dx}}|drtj|rtj|d}tj|d}t |d}tj|d} tj|d }|| }nt j|} t| d  d } t | d } | d } | d d}| d}n#t$rd}YnwxYw|drtj|rktj|d} || }tj|d}tj|d }t |d}ntd|z|r| ||p|ntj|rOt|d5} |  d}dddn #1swxYwY|sg}n|}||_|S)Nc:g}|}|D]}|}|s|drtd|nt |}|std|y|jrtd|js||j d d|jD}||j d|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|zV dS)z%s%sNr7)r cs r' zQEggInfoDistribution._get_metadata..parse_requires_data..s&$G$GAVaZ$G$G$G$G$G$Gr)rr) rstripr,rdrirr constraintsr/r"r`)rreqsrKrLrnconss r'parse_requires_dataz>EggInfoDistribution._get_metadata..parse_requires_datas4 DOO%%E < <zz||??3''NNH$PPPE%d++NN#H$OOO84NN$3444}<KK''''99$G$G$G$G$GGGDKKQVVVTTT :;;;;Kr)cg} tj|dd5}|}dddn #1swxYwYn#t$rYnwxYw|S)zCreate a list of dependencies from a requires.txt file. *req_path*: the path to a setuptools-produced requires.txt file. rnrN)rIrrIOError)req_pathrrr9rts r'parse_requires_pathz>EggInfoDistribution._get_metadata..parse_requires_paths D [388:B..rwwyy99D:::::::::::::::    Ks3AA AA  A A  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_datarrvradd_requirementsrrrrr)r&r#requiresrxtl_pathtl_datar meta_pathrRrwzipfrPrrrts @r'riz!EggInfoDistribution._get_metadatas>   <     ! ' ==  4w}}T"" $GLLz22GLLJ77 #8DDD7<<>::',,q/::..x88!,T22"MM"566==fEEGG#GHEEE$==)@AAD"mm,DEELL!!G224;;w3G3GHHHH$$$#HHH$ ]]; ' ' 4w}}T"" >7<<n==..x88w||D*55',,t_==T(;;;HH"$,.2$344 4  0  % %h / / / ?"rw~~g'>'>"'4((7Affhhoog66G777777777777777 +GG((**G s%>AF F)(F)9(K--K14K1c8d|jd|jd|jdS)Nz>+ & & E"7799 E E a;&&w~~d++E%%tXtU&CDDDr)c d}d}tj|jd}g}tj|r._md5s`T4  A &&((  ;w''1133 3s ;Ac4tj|jSrD)rstatst_size)r#s r'_sizez7EggInfoDistribution.list_installed_files.._size s74==( (r)rrnrrFzNon-existent file: %sr*N) rr#r`rrIrrpnormpathrdrir]r.r/)r&rrr6rrrLrs r'r'z(EggInfoDistribution.list_installed_filess 4 4 4 ) ) )gll49.CDD  7>>+ & & 5[#@@@ >A > >D::<>!,,%'>BBB::&677%$7==++> q$$q''5588&<=== > > > > > > > > > > > > > > > > MM;d3 4 4 4 s%C5E''E+.E+Fc#Ktj|jd}tj|rd}t j|dd5}|D]}|}|dkrd}|sgtjtj|j|}||jr |r|V|V ddddS#1swxYwYdSdS) 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 rTrnrrFz./FN) rr#r`rrIrrprr,)r&absoluter6skiprrLrs r'r_z'EggInfoDistribution.list_distinfo_files sQgll49.CDD 7>>+ & & +D[#@@@ +A + +D::<C>cLt|to|j|jkSrD)rzrr#ras r'rzEggInfoDistribution.__eq__=s&5"566,I+ -r)rDrb)r3r4r5r6rrMr(rirrrDr'r_rrcrrrs@r'rrcs// IGGGGGG,\\\|AAA333&$$$L++++:--- HHHHHr)rcNeZdZdZdZdZddZdZdZdd Z dd Z d Z d Z dS)DependencyGrapha Represents a dependency graph between distributions. The dependency relationships are stored in an ``adjacency_list`` that maps distributions to a list of ``(other, label)`` tuples where ``other`` is a distribution and the edge is labeled with ``label`` (i.e. the version specifier, if such was provided). Also, for more efficient traversal, for every distribution ``x``, a list of predecessors is kept in ``reverse_list[x]``. An edge from distribution ``a`` to distribution ``b`` means that ``a`` depends on ``b``. If any missing dependencies are found, they are stored in ``missing``, which is a dictionary that maps distributions to a list of requirements that were not provided by any other distributions. c0i|_i|_i|_dSrD)adjacency_list reverse_listrr%s r'r(zDependencyGraph.__init__Ys  r)c.g|j|<g|j|<dS)zAdd the *distribution* to the graph. :type distribution: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` N)rr)r& distributions r'add_distributionz DependencyGraph.add_distribution^s$ -/L)*,,'''r)Nc|j|||f||j|vr"|j||dSdS)aAdd an edge from distribution *x* to distribution *y* with the given *label*. :type x: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type y: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type label: ``str`` or ``None`` N)rr/r)r&xylabels r'add_edgezDependencyGraph.add_edgehsa A%%q%j111 D%a( ( (  a ' ' * * * * * ) (r)ctd|||j|g|dS)a Add a missing *requirement* for the given *distribution*. :type distribution: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type requirement: ``str`` z %s missing %rN)rdrerr-r/)r&rrs r' add_missingzDependencyGraph.add_missingwsF  _lK@@@  b1188EEEEEr)c$|jd|jSrrr0s r' _repr_distzDependencyGraph._repr_distrr)rc||g}|j|D]\}}||}||d|d}|d|zt|z|||dz}|d}||ddd|S)zPrints only a subgraphNz []z rrR)rrr/r@ repr_noderextendr`)r&r1leveloutputrr suboutputsubss r'rzDependencyGraph.repr_nodes//$''( /5 $ $LE5??5))D $(DD%%%0 MM&5.3t994 5 5 5ueai88I??4((D MM$qrr( # # # #yy   r)Tc g}|d|jD]\}}t|dkr|s|||D]W\}}|*|d|jd|jd|d1|d|jd|jdX|st|dkr|d |d |d |D]4}|d |jz|d 5|d|ddS)a9Writes a DOT output for the graph to the provided file *f*. If *skip_disconnected* is set to ``True``, then all distributions that are not dependent on any other distribution are skipped. :type f: has to support ``file``-like operations :type skip_disconnected: ``bool`` zdigraph dependencies { rN"z" -> "z " [label="z"] z" zsubgraph disconnected { zlabel = "Disconnected" zbgcolor = red z"%s"rRz} )rTritemsrr/r")r&rskip_disconnected disconnectedr1adjsrrs r'to_dotzDependencyGraph.to_dots  *+++-3355 H HJD$4yyA~~&7~##D))) $ H H u$GGG!YYY EEE;<<<<GGG 5:::FGGGG  H ! S%6%6%:%: GG/ 0 0 0 GG. / / / GG% & & &$  *+++ GGENNN r)cg}i}|jD]\}}|dd||< gt|ddD]\}}|s|||= snf|D]\}}fd|D||<tddD||t|fS)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. NTc&g|] \}}|v ||fSr7r7)r rrn to_removes r'rz4DependencyGraph.topological_sort..s+GGGtq!AY4F4FQF4F4F4Fr)zMoving to result: %sc2g|]}|jd|jdS)rrr)r rs r'rz4DependencyGraph.topological_sort..s)MMMaqvvvqyyy9MMMr))rrlistr/rdrerkeys)r&ralistkrrs @r'topological_sortz DependencyGraph.topological_sortsF'--//  DAqtE!HH %IU[[]]++AAA. ! !1!$$Q'''a   H H1GGGGqGGGa LL/MM9MMM O O O MM) $ $ $ % tEJJLL))))r)cg}|jD]-\}}|||.d|S)zRepresentation of the graphrR)rrr/rr`)r&rr1rs r'rzDependencyGraph.__repr__s\-3355 0 0JD$ MM$.... / / / /yy   r)rD)r)T) r3r4r5r6r(rrrrrrrrr7r)r'rrIs   --- + + + + F F F333 ! ! ! !@***>!!!!!r)rr:cjt|}t}i}|D]{}|||jD]\}t |\}}t d|||||g||f]||D]}|j |j z|j z|j z}|D]} | | } nZ#t$rMt d| | d}| |} YnwxYw| j}d} ||vrT||D]K\}} | |} n#t$rd} YnwxYw| r||| | d} nL| s||| |S)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   EHBB t$$$ B BA2155MD' LL6gt L L L   b ) ) 0 0'4 A A A A B --%(::)*,0,=> - -C / ..--* / / /L"$$$yy{{1~ ....  /;DGx)1$  %GX& ' g 6 62&&& %&tXs;;;"& -!!$,,,3 -4 Ls%CAD43D4E(( E7 6E7 cP||vrtd|jzt|}|g}|j|}|rT|}|||j|D]}||vr|||T|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 -/3y 9:: : u  E &C  d #D " HHJJ 1 &q) " "D3 D!!! "GGAJJJ Jr)c||vrtd|jzt|}t}|j|}td|D}|r}|d}|||j|}|D]<}|d}||vr.||vr*||||=|}|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|] }|dV dS)rNr7)r ts r'roz%get_required_dists..8s&""qt""""""r)r)rr"rrXrrr2r/) rr1rrrrlr pred_listpreds r'get_required_distsr)s 5 -/3y 9:: : u  E %%C   %D ""T""" " "D " HHJJqM  (+  " "DQA||   D!!! " Jr)c |dd}tdi|}||_||_|pd|_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_distrFsTjj$=>>G   F  BBGBJ55BJ   r))r:)7r6 __future__rrrIrarloggingrr_r;rzrMrrcompatrrrr rRr r r r utilrrrrrrr__all__ getLoggerr3rdrCOMMANDS_FILENAMErYr^rcr rrrrrrfrgrrrrrr7r)r'rsj ''''''   ))))))))88888888111111111111FFFFFFFFFFFFFFFFFF     8 $ $(*,h +X7  <<<<y y y y y vy y y xYLYLYLYLYL6YLYLYLx4)4)4)4)4) 4)4)4)nFFFFF5FFFR _____3___D'$M!M!M!M!M!fM!M!M!`3333l4:     r)