U 巀g@sdZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z mZddlmZddlmZmZddlmZmZmZmZdd lmZmZmZmZmZmZm Z d d d d dgZ!e"e#Z$dZ%dZ&deddde%dfZ'dZ(Gddde)Z*Gddde)Z+Gdd d e)Z,Gdd d e,Z-Gdd d e-Z.Gdd d e-Z/e.Z0e/Z1Gddde)Z2d)d!d"Z3d#d$Z4d%d&Z5d'd(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@s(eZdZdZddZddZddZdS) _CachezL A simple cache mapping names and .dist-info paths to distributions cCsi|_i|_d|_dS)zZ Initialise an instance. There is normally one for each DistributionPath. FN)namepath generatedselfr$J/opt/hc_python/lib/python3.8/site-packages/pip/_vendor/distlib/database.py__init__.sz_Cache.__init__cCs|j|jd|_dS)zC Clear the cache, setting it to its initial state. FN)rclearr r!r"r$r$r%r'6s  z _Cache.clearcCs2|j|jkr.||j|j<|j|jg|dS)z` Add a distribution to the cache. :param dist: The distribution to add. N)r r setdefaultkeyappendr#distr$r$r%add>s  z _Cache.addN)__name__ __module__ __qualname____doc__r&r'r-r$r$r$r%r)src@seZdZdZdddZddZdd ZeeeZd d Z d d Z ddZ e ddZ ddZddZdddZddZdddZdS)rzU Represents a set of distributions installed on a path (typically sys.path). NFcCsD|dkrtj}||_d|_||_t|_t|_d|_td|_ dS)a Create an instance from a path, optionally including legacy (distutils/ setuptools/distribute) distributions. :param path: The path to use, as a list of directories. If not specified, sys.path is used. :param include_egg: If True, this instance will look for and return legacy distributions as well as those based on PEP 376. NTdefault) sysr _include_dist _include_eggr_cache _cache_egg_cache_enabledr_scheme)r#r Z include_eggr$r$r%r&Ms zDistributionPath.__init__cCs|jSNr8r"r$r$r%_get_cache_enabledasz#DistributionPath._get_cache_enabledcCs ||_dSr:r;)r#valuer$r$r%_set_cache_enableddsz#DistributionPath._set_cache_enabledcCs|j|jdS)z, Clears the internal cache. N)r6r'r7r"r$r$r% clear_cacheis zDistributionPath.clear_cachec cst}|jD]}t|}|dkr&q |d}|r |js||jjD] }|Vq0|jrZ|jjD] }|VqNdS)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)r8rgrir6r valuesr5r7r+r$r$r%get_distributionss   z"DistributionPath.get_distributionscCsd}|}|js4|D]}|j|kr|}q|qnH|||jjkrZ|jj|d}n"|jr|||jjkr||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) lowerr8rgr)rir6rr5r7)r#rresultr,r$r$r%get_distributions    z!DistributionPath.get_distributionc csd}|dk rJz|jd||f}Wn$tk rHtd||fYnX|D]p}t|dsntd|qR|j}|D]H}t |\}}|dkr||kr|VqRqx||krx| |rx|VqRqxqRdS)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%s (%s)zinvalid name or version: %r, %rprovideszNo "provides": %s) r9matcher ValueErrorrrqhasattrrWrXrvrmatch) r#rrnrwr,providedpp_namep_verr$r$r%provides_distributions&   z&DistributionPath.provides_distributioncCs(||}|dkrtd|||S)z5 Return the path to a resource file. Nzno distribution named %r found)rt LookupErrorget_resource_path)r#r relative_pathr,r$r$r% get_file_paths  zDistributionPath.get_file_pathccsX|D]J}|j}||kr||}|dk r>||krR||Vq|D] }|VqFqdS)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)rqexportsrp)r#categoryrr,radvr$r$r%get_exported_entries(s   z%DistributionPath.get_exported_entries)NF)N)N)r.r/r0r1r&r<r>propertyZ cache_enabledr?rgri classmethodrorqrtrrrr$r$r$r%rHs  .  ( c@seZdZdZdZdZddZeddZeZ eddZ ed d Z d d Z ed dZ eddZeddZeddZeddZddZddZddZddZdS) 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. FcCsL||_|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) rErrrr)rnZlocatordigestextrascontextrKZ download_urlsdigests)r#rEr$r$r%r&Ms zDistribution.__init__cCs|jjS)zH The source archive download URL for this distribution. )rE source_urlr"r$r$r%r^szDistribution.source_urlcCsd|j|jfS)zX A utility property which displays the name and version in parentheses. rurrnr"r$r$r%name_and_versiongszDistribution.name_and_versioncCs.|jj}d|j|jf}||kr*|||S)z A set of distribution names and versions provided by this distribution. :return: A set of "name (version)" strings. ru)rErvrrnr*)r#plistsr$r$r%rvns  zDistribution.providescCs:|j}t||}td|j||t|j||j|jdS)Nz)%s: got requirements %r from metadata: %r)rrF) rEgetattrrWrXrrKget_requirementsrr)r#Zreq_attrmdZreqtsr$r$r%_get_requirementszs zDistribution._get_requirementscCs |dS)N run_requiresrr"r$r$r%rszDistribution.run_requirescCs |dS)N meta_requiresrr"r$r$r%rszDistribution.meta_requirescCs |dS)Nbuild_requiresrr"r$r$r%rszDistribution.build_requirescCs |dS)N test_requiresrr"r$r$r%rszDistribution.test_requirescCs |dS)N dev_requiresrr"r$r$r%rszDistribution.dev_requiresc Cst|}t|jj}z||j}Wn6tk rZtd|| d}||}YnX|j }d}|j D]D}t |\}} ||krqlz| | }WqWqltk rYqlXql|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)r rrErDrw requirementrrWr\splitr)rvrrz) r#reqrarDrwrrsr|r}r~r$r$r%matches_requirements(        z Distribution.matches_requirementcCs(|jrd|j}nd}d|j|j|fS)zC Return a textual representation of this instance, z [%s]r@z)rrrn)r#suffixr$r$r%__repr__s zDistribution.__repr__cCs>t|t|k rd}n$|j|jko8|j|jko8|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)typerrnr)r#otherrsr$r$r%__eq__s$zDistribution.__eq__cCst|jt|jt|jS)zH Compute hash in a way which matches the equality test. )hashrrnrr"r$r$r%__hash__szDistribution.__hash__N)r.r/r0r1Zbuild_time_dependency requestedr&rr download_urlrrvrrrrrrrrrrr$r$r$r%r;s4        ! cs0eZdZdZdZdfdd ZdddZZS) rz] This is the base class for installed distributions (whether PEP 376 or legacy). Ncs tt||||_||_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#rEr rF __class__r$r%r&s z"BaseInstalledDistribution.__init__cCsd|dkr|j}|dkr"tj}d}ntt|}d|j}||}t|dd}d||fS)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 Nr@z%s==ascii%s%s) hasherhashlibmd5rrbase64urlsafe_b64encoderstripdecode)r#datarprefixrr$r$r%get_hashs   z"BaseInstalledDistribution.get_hash)N)N)r.r/r0r1rr&r __classcell__r$r$rr%rscseZdZdZdZd'fdd ZddZdd Zd d Ze d d Z ddZ ddZ ddZ ddZd(ddZddZe ddZd)ddZdd Zd!d"Zd#d$Zd%d&ZejZZS)*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). sha256Nc sPg|_t||_}|dkr*td||rP|jrP||jjkrP|jj|j}nt|dkr| t }|dkrt| t }|dkr| t }|dkrtdt |ft |}t|dd}W5QRXtt|||||r|jr|j|| d}|dk |_tj|d}tj|rLt|d}|d} W5QRX| |_dS) Nzfinder unavailable for %szno %s found in %srArBr top_level.txtrbutf-8)modulesrrLr`rxr8r6r rErMr r r rTrUrVr rrr&r-rosrSexistsopenreadr splitlines) r#r rErFr`rardr|frrr$r%r&s4         zInstalledDistribution.__init__cCsd|j|j|jfS)Nz#rrnr r"r$r$r%r6szInstalledDistribution.__repr__cCsd|j|jfSNz%s %srr"r$r$r%__str__9szInstalledDistribution.__str__c Csg}|d}t|\}t|dF}|D]:}ddtt|dD}||\}}} |||| fq.W5QRXW5QRX|S)a" Get the list of installed files for the distribution :return: A list of tuples of path, hash and size. Note that hash and size might be ``None`` for some entries. The path is exactly as stored in the file (which is as in PEP 376). rrdcSsg|]}dqSr:r$).0ir$r$r% Ksz6InstalledDistribution._get_records..)get_distinfo_resourcerTrUrVrrangelenr*) r#resultsrardZ record_readerrowmissingr checksumsizer$r$r% _get_records<s  &z"InstalledDistribution._get_recordscCsi}|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#rsrar$r$r%rSs  zInstalledDistribution.exportsc Cs8i}|t}|r4t|}t|}W5QRX|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. )rrrTrUrVr)r#rsrardr$r$r%ras  z"InstalledDistribution.read_exportsc Cs.|t}t|d}t||W5QRXdS)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#rrfrr$r$r%rps  z#InstalledDistribution.write_exportsc Cs|d}t|R}t|d<}|D]0\}}||kr*|W5QRW5QRSq*W5QRXW5QRXtd|dS)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. rrz3no resource file with relative path %r is installedN)rrTrUrVrKeyError)r#rrardZresources_readerrelativeZ destinationr$r$r%r{s   6z'InstalledDistribution.get_resource_pathccs|D] }|VqdS)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#rsr$r$r%list_installed_filess z*InstalledDistribution.list_installed_filesFc Cs(tj|d}tj|j}||}tj|d}|d}td||rRdSt|}|D]}tj |sz| drd} } n4dtj |} t |d} | | } W5QRX||s|r||rtj||}||| | fq`||r tj||}||ddfW5QRX|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. r@r creating %sNz.pycz.pyoz%dr)rr rSdirname startswithrrWinforisdirrPgetsizerrrrelpathwriterow) r#pathsrdry_runbaseZbase_under_prefix record_pathwriterr hash_valuerfpr$r$r%write_installed_filess,       z+InstalledDistribution.write_installed_filesc Csg}tj|j}|d}|D]\}}}tj|sHtj||}||krRq$tj|sr||dddfq$tj |r$t tj |}|r||kr||d||fq$|r$d|kr| ddd}nd }t |d 2} || |} | |kr||d || fW5QRXq$|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 rrrisabsrSrr*isfilestrrrrrr) r# mismatchesrrr rrZ actual_sizerrZ actual_hashr$r$r%check_installed_filess.        z+InstalledDistribution.check_installed_filesc Csi}tj|jd}tj|rtj|ddd}|}W5QRX|D]8}|dd\}}|dkr|| |g |qL|||<qL|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. rrarencodingrr namespace) rr rSrcodecsrrrrr(r*)r#rs shared_pathrlinesliner)r=r$r$r%shared_locationss  z&InstalledDistribution.shared_locationsc Cstj|jd}td||r$dSg}dD].}||}tj||r,|d||fq,|ddD]}|d|qhtj |d d d }| d |W5QRX|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. rrN)rlibheadersscriptsrz%s=%srr$z namespace=%srrr ) rr rSrWrrr*getrrwrite) r#rrrrr)r nsrr$r$r%write_shared_locationss  z,InstalledDistribution.write_shared_locationscCsF|tkrtd||jft|j}|dkr.set_name_and_version) r rr8r7rErrn _get_metadatar-rrr&)r#r rFrrErr$r%r&Ws   zEggInfoDistribution.__init__c sd}ddfdd}d}}|drtj|rtj|d}tj|d}t|dd }tj|d } tj|d }|| }npt|} t| d  d } t| dd}z,| d} | d d}| d}Wnt k rd}YnXnf|drPtj|rBtj|d } || }tj|d}tj|d }t|dd }n t d||rl| ||dkr|dk rtj|rt|d} |  d}W5QRX|sg}n|}||_|S)NcSsg}|}|D]}|}|s"q|drszQEggInfoDistribution._get_metadata..parse_requires_data..ru) rstriprrWr\r r constraintsr*rrS)rreqsrrraZconsr$r$r%parse_requires_dataps(    z>EggInfoDistribution._get_metadata..parse_requires_datac sHg}z*t|dd}|}W5QRXWntk rBYnX|S)zCreate a list of dependencies from a requires.txt file. *req_path*: the path to a setuptools-produced requires.txt file. rar)rrrIOError)req_pathrrrr$r%parse_requires_pathsz>EggInfoDistribution._get_metadata..parse_requires_pathrHzEGG-INFOzPKG-INFOrA)r rDz requires.txtrzEGG-INFO/PKG-INFOutf8rBzEGG-INFO/requires.txtzEGG-INFO/top_level.txtrrGz,path must end with .egg-info or .egg, got %rr)rPrr rrSr zipimport zipimporterrget_datarrrZadd_requirementsrrrrr)r#r requiresrZtl_pathZtl_datar| meta_pathrErZzipfrCrrr$rr%rmsT             z!EggInfoDistribution._get_metadatacCsd|j|j|jfS)Nz!rr"r$r$r%rszEggInfoDistribution.__repr__cCsd|j|jfSrrr"r$r$r%rszEggInfoDistribution.__str__cCs`g}tj|jd}tj|r\|D]2\}}}||kr._md5cSs t|jSr:)rstatst_size)r r$r$r%_sizesz7EggInfoDistribution.list_installed_files.._sizer%rarrzNon-existent file: %srN) rr rSrrrrnormpathrWr\rPrr*)r#r)r,rrsrrr|r$r$r%rs"     $z(EggInfoDistribution.list_installed_filesFc cstj|jd}tj|rd}tj|ddd`}|D]T}|}|dkrPd}q6|s6tjtj|j|}||jr6|r|Vq6|Vq6W5QRXdS) 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 r%Trarrz./FN) rr rSrrrrr-r)r#absoluterskiprrr|r$r$r%rs   z'EggInfoDistribution.list_distinfo_filescCst|to|j|jkSr:)rhrr rr$r$r%r$szEggInfoDistribution.__eq__)N)F)r.r/r0r1rrr&rrrrrrrrrrr$r$rr%rNs[& c@s^eZdZdZddZddZdddZd d Zd d ZdddZ dddZ ddZ ddZ 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. cCsi|_i|_i|_dSr:)adjacency_list reverse_listrr"r$r$r%r&?szDependencyGraph.__init__cCsg|j|<g|j|<dS)zAdd the *distribution* to the graph. :type distribution: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` N)r1r2)r# distributionr$r$r%add_distributionDs z DependencyGraph.add_distributionNcCs6|j|||f||j|kr2|j||dS)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)r1r*r2)r#xylabelr$r$r%add_edgeNs zDependencyGraph.add_edgecCs&td|||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)rWrXrr(r*)r#r3rr$r$r% add_missing]szDependencyGraph.add_missingcCsd|j|jfSrrr+r$r$r% _repr_disthszDependencyGraph._repr_distrcCs||g}|j|D]h\}}||}|dk r|d|j|jfq>q|st|dkr|d|d|d|D]}|d |j|d q|d |d dS) 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 { rNz"%s" -> "%s" [label="%s"] z "%s" -> "%s" zsubgraph disconnected { zlabel = "Disconnected" zbgcolor = red z"%s"rz} )rr1itemsrr*r)r#rZskip_disconnectedZ disconnectedr,adjsrr7r$r$r%to_dotxs$         zDependencyGraph.to_dotcsg}i}|jD]\}}|dd||<qgt|ddD]\}}|sD|||=qDshq|D]\}}fdd|D||<qptdddD|q,|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. Ncs g|]\}}|kr||fqSr$r$)rrraZ to_remover$r%rsz4DependencyGraph.topological_sort..zMoving to result: %scSsg|]}d|j|jfqS)rur)rrr$r$r%rs)r1r@listr*rWrXr<keys)r#rsalistkrr$rCr%topological_sorts   z DependencyGraph.topological_sortcCs2g}|jD]\}}|||qd|S)zRepresentation of the graphr)r1r@r*r;rS)r#r>r,rAr$r$r%rszDependencyGraph.__repr__)N)r)T) r.r/r0r1r&r4r8r9r:r;rBrHrr$r$r$r%r0/s   r0r2c CsVt|}t}i}|D]L}|||jD]6}t|\}}td|||||g||fq*q|D]}|j |j B|j B|j B}|D]} z| | } Wn6tk rtd| | d}| |} YnX| j}d} ||kr>||D]N\}} z| |} Wntk rd} YnX| r||| | d} q>q| s||| qqh|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)rr0r4rvrrWrXr(r*rrrrrwrr\rr)rzr8r9)distsrDgraphr{r,r|rrnr#rrwZmatchedproviderrzr$r$r% make_graphsB       rLcCsv||krtd|jt|}|g}|j|}|rh|}|||j|D]}||krN||qNq.|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)rrrLr2popr*)rIr,rJdeptodorsuccr$r$r%get_dependent_distss   rRc Cs||krtd|jt|}t}|j|}tdd|D}|r|d}|||j|}|D]0}|d}||krh||krh||||qhq@|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. rMcss|]}|dVqdS)rNr$)rtr$r$r%rsz%get_required_dists..r)rrrLrKr1rNr-r*) rIr,rJrrPr_rZ pred_listpredr$r$r%get_required_dists s$     rUcKs4|dd}tf|}||_||_|p(d|_t|S)zO A convenience method for making a dist given just a name and version. summaryzPlaceholder for summary)rNr rrnrVr)rrnkwargsrVrr$r$r% make_dist(s    rX)r2)7r1 __future__rrrrTrloggingrrRr3r r@rrcompatrrnrrrEr r r r utilr rrrrrr__all__ getLoggerr.rWrZCOMMANDS_FILENAMEr rQrrrrrrrrYrZr0rLrRrUrXr$r$r$r%sZ  $ t7E^ 4