a  zes@sdZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z mZddlmZddlmZmZddlmZmZmZmZdd lmZmZmZmZmZmZm Z gd Z!e"e#Z$d Z%d Z&d eddde%dfZ'dZ(Gddde)Z*Gddde)Z+Gddde)Z,Gddde,Z-Gddde-Z.Gddde-Z/e.Z0e/Z1Gdd d e)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$^/opt/bitninja-python-dojo/embedded/lib/python3.9/site-packages/pip/_vendor/distlib/database.py__init__1sz_Cache.__init__cCs|j|jd|_dS)zC Clear the cache, setting it to its initial state. FN)rclearr r!r"r$r$r%r'9s  z _Cache.clearcCs2|j|jvr.||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%addAs  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|durtj}||_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&Os zDistributionPath.__init__cCs|jSNr8r"r$r$r%_get_cache_enabledcsz#DistributionPath._get_cache_enabledcCs ||_dSr:r;)r#valuer$r$r%_set_cache_enabledfsz#DistributionPath._set_cache_enabledcCs|j|jdS)z, Clears the internal cache. N)r6r'r7r"r$r$r% clear_cacheks zDistributionPath.clear_cachec csZt}|jD]F}t|}|dur&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)r8r^r`r6r valuesr5r7r+r$r$r%get_distributionss   z"DistributionPath.get_distributionscCsd}|}|js4|D]}|j|kr|}q|qnH|||jjvrZ|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) lowerr8r^r)r`r6rr5r7)r#rresultr,r$r$r%get_distributions    z!DistributionPath.get_distributionc csd}|durHz|jd||f}Wn"tyFtd||fYn0|D]p}t|dsltd|qP|j}|D]H}t |\}}|dur||kr|VqPqv||krv| |rv|VqPqvqPdS)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 ValueErrorrrhhasattrrUrVrmrmatch) r#rrernr,providedpp_namep_verr$r$r%provides_distributions*     z&DistributionPath.provides_distributioncCs(||}|durtd|||S)z5 Return the path to a resource file. Nzno distribution named %r found)rk LookupErrorget_resource_path)r#r relative_pathr,r$r$r% get_file_path!s  zDistributionPath.get_file_pathccsX|D]J}|j}||vr||}|dur>||vrR||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)rhexportsrg)r#categoryrr,r[dvr$r$r%get_exported_entries*s   z%DistributionPath.get_exported_entries)NF)N)N)r.r/r0r1r&r<r>propertyZ cache_enabledr?r^r` classmethodrfrhrkrvrzrr$r$r$r%rKs  ,  ) rc@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) rErrir)relocatordigestextrascontextrIZ download_urlsdigests)r#rEr$r$r%r&Os 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. rlrrer"r$r$r%name_and_versioniszDistribution.name_and_versioncCs.|jj}d|j|jf}||vr*|||S)z A set of distribution names and versions provided by this distribution. :return: A set of "name (version)" strings. rl)rErmrrer*)r#plistsr$r$r%rmps  zDistribution.providescCs8|j}td|t||}t|j||j|jdS)Nz%Getting requirements from metadata %r)rrF) rErUrVZtodictgetattrrIget_requirementsrr)r#Zreq_attrmdZreqtsr$r$r%_get_requirements|s   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}Wn4tyXtd|| d}||}Yn0|j }d}|j D]B}t |\}} ||krqjz| | }WqWqjtyYqj0qj|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 rrErDrn requirementrrUwarningsplitr)rmrrq) r#reqr[rDrnrrjrsrtrur$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)rrre)r#suffixr$r$r%__repr__s zDistribution.__repr__cCs>t|t|urd}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)typerrer)r#otherrjr$r$r%__eq__s   zDistribution.__eq__cCst|jt|jt|jS)zH Compute hash in a way which matches the equality test. )hashrrerr"r$r$r%__hash__szDistribution.__hash__N)r.r/r0r1Zbuild_time_dependency requestedr&rr download_urlrrmrrrrrrrrrrr$r$r$r%r=s4        " rcs0eZdZdZdZdfdd 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|dur|j}|dur"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%rsrcseZdZdZdZd'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 s~g|_t||_}|dur*td||rP|jrP||jjvrP|jj|j}n|dur| t }|durt| t }|dur| t }|durtdt |ft |}t|dd}Wdn1s0Ytt|||||r|jr|j|| d}|du|_tj|d}tj|rzt|d}|d} Wdn1sf0Y| |_dS) Nzfinder unavailable for %szno %s found in %srArBr top_level.txtrbutf-8)modulesrrJrZror8r6r rErKr r r rRrSrTr rrr&r-rosrQexistsopenreadr splitlines) r#r rErFrZr[r]rsfrrr$r%r&s8    *    .zInstalledDistribution.__init__cCsd|j|j|jfS)Nz#rrer r"r$r$r%r=s zInstalledDistribution.__repr__cCsd|j|jfSNz%s %srr"r$r$r%__str__AszInstalledDistribution.__str__c Csg}|d}t|z}t|dP}|D]:}ddtt|dD}||\}}} |||| fq.Wdn1s~0YWdn1s0Y|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). rr]cSsg|]}dqSr:r$).0ir$r$r% Sz6InstalledDistribution._get_records..N)get_distinfo_resourcerRrSrTrrangelenr*) r#resultsr[r]Z record_readerrowmissingr checksumsizer$r$r% _get_recordsDs  Nz"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#rjr[r$r$r%r{[s  zInstalledDistribution.exportscCsLi}|t}|rHt|}t|}Wdn1s>0Y|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)rrrRrSrTr)r#rjr[r]r$r$r%ris  &z"InstalledDistribution.read_exportscCsB|t}t|d}t||Wdn1s40YdS)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#r{rfrr$r$r%rxs  z#InstalledDistribution.write_exportsc Cs|d}t|t}t|dJ}|D]4\}}||kr*|WdWdSq*Wdn1st0YWdn1s0Ytd|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. rrNz3no resource file with relative path %r is installed)rrRrSrTrKeyError)r#ryr[r]Zresources_readerrelative destinationr$r$r%rxs   bz'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#rjr$r$r%list_installed_filess z*InstalledDistribution.list_installed_filesFc CsRtj|d}tj|j}||}tj|d}|d}td||rRdSt|}|D]}tj |sz| drd} } nHdtj |} t |d} | | } Wdn1s0Y||s|r||rtj||}||| | fq`||rtj||}||ddfWdn1sD0Y|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 rQdirname startswithrrUinforisdirrNgetsizerrrrelpathwriterow) r#pathsrdry_runbaseZbase_under_prefix record_pathwriterr hash_valuerfpr$r$r%write_installed_filess0      , 0z+InstalledDistribution.write_installed_filesc Cs0g}tj|j}|d}|D]\}}}tj|sJtj||}||krTq$tj|st||dddfq$tj |r$t tj |}|r||kr||d||fq$|r$d|vr| ddd}nd }t |d <} || |} | |kr ||d || fWd q$1s 0Yq$|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 rrrisabsrQrr*isfilestrrrrrr) r# mismatchesrrr rrZ actual_sizerrZ actual_hashr$r$r%check_installed_filess.        4z+InstalledDistribution.check_installed_filescCsi}tj|jd}tj|rtj|ddd}|}Wdn1sR0Y|D]8}|dd\}}|dkr| |g |q`|||<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. rr[rencodingNrr namespace) rr rQrcodecsrrrrr(r*)r#rj 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 |Wdn1s0Y|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 rQrUrrr*getrrwrite) r#rrrrr)r nsrr$r$r%write_shared_locationss  .z,InstalledDistribution.write_shared_locationscCsF|tvrtd||jft|j}|dur.set_name_and_version) r rr8r7rErre _get_metadatar-rrr&)r#r rFr rErr$r%r&bs   zEggInfoDistribution.__init__csd}ddfdd}d}}|drtj|rtj|d}tj|d}t|dd }tj|d } tj|d }|| }nnt|} t| d  d } t| dd}z,| d} | d d}| d}Wnt yd}Yn0nf|drNtj|r@tj|d } || }tj|d}tj|d }t|dd }n t d||rj| ||dur|durtj|rt|d} |  d}Wdn1s0Y|sg}n|}||_|S)NcSsg}|}|D]}|}|dr6td|qt|}|sPtd|q|jr`td|jst||j qd dd|jD}|d|j |fq|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 supportedz, css|]}d|VqdS)rNr$)rcr$r$r% rzQEggInfoDistribution._get_metadata..parse_requires_data..rl) rstriprrUrr r constraintsr*rrQ)rreqsrrr[Zconsr$r$r%parse_requires_datazs(   z>EggInfoDistribution._get_metadata..parse_requires_datacsZg}z>t|dd}|}Wdn1s60YWntyTYn0|S)zCreate a list of dependencies from a requires.txt file. *req_path*: the path to a setuptools-produced requires.txt file. r[rN)rrrIOError)req_pathrrrr$r%parse_requires_paths. z>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)rNrr rrQr zipimport zipimporterrget_datarrrZadd_requirementsrrrrr)r#r requiresrZtl_pathZtl_datars meta_pathrErZzipfrCrrr$rr%rwsX              .z!EggInfoDistribution._get_metadatacCsd|j|j|jfS)Nz!rr"r$r$r%rs zEggInfoDistribution.__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 r[rrzNon-existent file: %srN) rr rQrrrrnormpathrUrrNrr*)r#r$r'rrjrrrsr$r$r%rs"     8z(EggInfoDistribution.list_installed_filesFccstj|jd}tj|rd}tj|dddj}|D]T}|}|dkrPd}q6|s6tjtj|j|}||jr6|r|Vq6|Vq6Wdn1s0YdS) 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 Tr[rrz./FN) rr rQrrrrr(r)r#absoluterskiprrrsr$r$r%r s   z'EggInfoDistribution.list_distinfo_filescCst|to|j|jkSr:)r_rr r r$r$r%r.s  zEggInfoDistribution.__eq__)N)F)r.r/r0r1rrr&rrrrrr rr rrr$r$rr%rYsZ& rc@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&IszDependencyGraph.__init__cCsg|j|<g|j|<dS)zAdd the *distribution* to the graph. :type distribution: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` N)r,r-)r# distributionr$r$r%add_distributionNs z DependencyGraph.add_distributionNcCs6|j|||f||j|vr2|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)r,r*r-)r#xylabelr$r$r%add_edgeXs 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)rUrVrr(r*)r#r.rr$r$r% add_missinggszDependencyGraph.add_missingcCsd|j|jfSrrr+r$r$r% _repr_distrszDependencyGraph._repr_distrcCs||g}|j|D]h\}}||}|dur|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} )rr,itemsrr*r)r#rZskip_disconnected disconnectedr,adjsrr2r$r$r%to_dots(          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|]\}}|vr||fqSr$r$)rr}r[ to_remover$r%rrz4DependencyGraph.topological_sort..zMoving to result: %scSsg|]}d|j|jfqS)rlr)rr}r$r$r%rr)r,r;listr*rUrVr7keys)r#rjalistkr~r$r?r%topological_sorts$   z DependencyGraph.topological_sortcCs2g}|jD]\}}|||qd|S)zRepresentation of the graphr)r,r;r*r6rQ)r#r9r,r=r$r$r%rszDependencyGraph.__repr__)N)r)T) r.r/r0r1r&r/r3r4r5r6r>rErr$r$r$r%r+9s   r+r2c CsRt|}t}i}|D]L}|||jD]6}t|\}}td|||||g||fq*q|D]}|j |j B|j B|j B}|D]} z| | } Wn4tytd| | d}| |} Yn0| j}d} ||vr:||D]L\}} z| |} Wntyd} Yn0| 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)rr+r/rmrrUrVr(r*rrrrrnrrrr)rqr3r4)distsrDgraphrrr,rsrrerrrnmatchedproviderrqr$r$r% make_graphsN        rJcCsv||vrtd|jt|}|g}|j|}|rh|}|||j|D]}||vrN||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)rrrJr-popr*)rFr,rGdeptodor}succr$r$r%get_dependent_distss   rPcCsn||vrtd|jt|}g}|j|}|rj|d}|||j|D]}||vrP||qPq,|S)zRecursively 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 rKr)rrrJr,rLr*)rFr,rGrrNr}predr$r$r%get_required_distss   rRcKs8|dd}tfi|}||_||_|p,d|_t|S)zO A convenience method for making a dist given just a name and version. summaryzPlaceholder for summary)rLr rrerSr)rrekwargsrSrr$r$r% make_dist2s   rU)r2)7r1 __future__rrrrRrloggingrrPr3rr@rrcompatrrerrrEr r r r utilr rrrrrr__all__ getLoggerr.rUrZCOMMANDS_FILENAMErrOr rrrrrrrWrXr+rJrPrRrUr$r$r$r%sT  $ s7J] 6