ž 7’Reò¿c@s6dZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z mZddlmZddlmZmZddlmZmZdd lmZmZmZmZmZmZmZd d d d dgZej e!ƒZ"dZ#dZ$deddde#dfZ%dZ&Gdd„de'ƒZ(Gdd„de'ƒZ)Gdd „d e'ƒZ*Gdd „d e*ƒZ+Gdd „d e+ƒZ,Gdd „d e+ƒZ-e,Z.e-Z/Gdd„de'ƒZ0d d!d"„Z1d#d$„Z2d%d&„Z3d'd(„Z4dS()uPEP 376 implementation.i(uunicode_literalsNi(uDistlibExceptionu resources(uStringIO(u get_schemeuUnsupportedVersionError(uMetadatauMETADATA_FILENAME(uparse_requirementucached_propertyuparse_name_and_versionu read_exportsu write_exportsu CSVReaderu CSVWriteru DistributionuBaseInstalledDistributionuInstalledDistributionuEggInfoDistributionuDistributionPathupydist-exports.jsonupydist-commands.jsonu INSTALLERuRECORDu REQUESTEDu RESOURCESuSHAREDu .dist-infocBs>|EeZdZdZdd„Zdd„Zdd„ZdS( u_CacheuL A simple cache mapping names and .dist-info paths to distributions cCsi|_i|_d|_dS(uZ Initialise an instance. There is normally one for each DistributionPath. NF(unameupathuFalseu generated(uself((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu__init__0s  u_Cache.__init__cCs'|jjƒ|jjƒd|_dS(uC Clear the cache, setting it to its initial state. NF(unameuclearupathuFalseu generated(uself((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyuclear8s  u _Cache.clearcCsH|j|jkrD||j|j<|jj|jgƒj|ƒndS(u` Add a distribution to the cache. :param dist: The distribution to add. N(upathunameu setdefaultukeyuappend(uselfudist((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyuadd@su _Cache.addN(u__name__u __module__u __qualname__u__doc__u__init__uclearuadd(u __locals__((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu_Cache,s  u_CachecBsË|EeZdZdZdddd„Zdd„Zdd„Ze eeƒZ dd „Z d d „Z d d „Z edd„ƒZdd„Zdd„Zddd„Zdd„Zddd„ZdS(uDistributionPathuU Represents a set of distributions installed on a path (typically sys.path). cCsg|dkrtj}n||_d|_||_tƒ|_tƒ|_d|_ t dƒ|_ dS(u  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. udefaultNT( uNoneusysupathuTrueu _include_distu _include_eggu_Cacheu_cacheu _cache_eggu_cache_enabledu get_schemeu_scheme(uselfupathu include_egg((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu__init__Ns        uDistributionPath.__init__cCs|jS(N(u_cache_enabled(uself((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu_get_cache_enabledbsu#DistributionPath._get_cache_enabledcCs ||_dS(N(u_cache_enabled(uselfuvalue((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu_set_cache_enabledesu#DistributionPath._set_cache_enabledcCs|jjƒ|jjƒdS(u, Clears the internal cache. N(u_cacheuclearu _cache_egg(uself((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu clear_cachejs uDistributionPath.clear_cachec cs¢tƒ}x’|jD]‡}tj|ƒ}|d kr:qn|jdƒ}| s|j r`qnt|jƒ}x(|D] }|j|ƒ}| sv|j|kr§qvn|jrG|j t ƒrGt j |t ƒ}|j|ƒ}|sìqvntd|jƒddƒ} tjd|jƒ|j|jƒt|jd| d|ƒVqv|jrv|j d ƒrvtjd|jƒ|j|jƒt|j|ƒVqvqvWqWd S( uD Yield .dist-info and/or .egg(-info) distributions. uufileobjuschemeulegacyuFound %sumetadatauenvu .egg-infou.eggN(u .egg-infou.egg(usetupathu resourcesufinder_for_pathuNoneufindu is_containerusortedu _include_distuendswithu DISTINFO_EXTu posixpathujoinuMETADATA_FILENAMEuMetadatau as_streamuloggerudebuguaddunew_dist_classu _include_egguold_dist_class( uselfuseenupathufinderurursetuentryu metadata_pathupydistumetadata((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu_yield_distributionsrs:      u%DistributionPath._yield_distributionscCs©|jj }|jo |jj }|s/|r¥xF|jƒD]8}t|tƒrd|jj|ƒq<|jj|ƒq<W|rd|j_n|r¥d|j_q¥ndS(uk Scan the path for distributions and populate the cache with those that are found. NT( u_cacheu generatedu _include_eggu _cache_eggu_yield_distributionsu isinstanceuInstalledDistributionuadduTrue(uselfugen_distugen_eggudist((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu_generate_cache˜s  u DistributionPath._generate_cachecCs)|jddƒ}dj||gƒtS(uo 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: stringu-u_(ureplaceujoinu DISTINFO_EXT(uclsunameuversion((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyudistinfo_dirname«su!DistributionPath.distinfo_dirnameccs†|js(xv|jƒD] }|VqWnZ|jƒx|jjjƒD] }|VqEW|jr‚x"|jjjƒD] }|VqpWndS(u5 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(u_cache_enabledu_yield_distributionsu_generate_cacheu_cacheupathuvaluesu _include_eggu _cache_egg(uselfudist((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyuget_distributionsÁs     u"DistributionPath.get_distributionscCs·d}|jƒ}|jsNx•|jƒD]}|j|kr(|}Pq(q(Wne|jƒ||jjkr|jj|d}n2|jr³||j jkr³|j j|d}n|S(u= 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`` iN( uNoneuloweru_cache_enabledu_yield_distributionsukeyu_generate_cacheu_cacheunameu _include_eggu _cache_egg(uselfunameuresultudist((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyuget_distribution×s     u!DistributionPath.get_distributionc csïd}|dk r`y |jjd||fƒ}Wq`tk r\td||fƒ‚Yq`Xnxˆ|jƒD]z}|j}xh|D]`}t|ƒ\}}|dkr¿||krã|VPqãqƒ||krƒ|j|ƒrƒ|VPqƒqƒWqmWdS(u 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 u%s (%s)uinvalid name or version: %r, %rN( uNoneu_schemeumatcheru ValueErroruDistlibExceptionuget_distributionsuprovidesuparse_name_and_versionumatch( uselfunameuversionumatcherudistuprovidedupup_nameup_ver((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyuprovides_distributionñs$       u&DistributionPath.provides_distributioncCs;|j|ƒ}|dkr.td|ƒ‚n|j|ƒS(u5 Return the path to a resource file. uno distribution named %r foundN(uget_distributionuNoneu LookupErroruget_resource_path(uselfunameu relative_pathudist((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu get_file_paths uDistributionPath.get_file_pathccs€xy|jƒD]k}|j}||kr ||}|dk rY||kru||Vquqxx|jƒD] }|VqfWq q WdS(uÙ 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(uget_distributionsuexportsuNoneuvalues(uselfucategoryunameudisturuduv((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyuget_exported_entriess     u%DistributionPath.get_exported_entriesNF(u__name__u __module__u __qualname__u__doc__uNoneuFalseu__init__u_get_cache_enabledu_set_cache_enabledupropertyu cache_enabledu clear_cacheu_yield_distributionsu_generate_cacheu classmethodudistinfo_dirnameuget_distributionsuget_distributionuprovides_distributionu get_file_pathuget_exported_entries(u __locals__((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyuDistributionPathJs    &   $ cBs|EeZdZdZdZdZdd„Zedd„ƒZ e Z edd„ƒZ edd „ƒZ d d „Z ed d „ƒZedd„ƒZedd„ƒZedd„ƒZedd„ƒZdd„Zdd„Zdd„Zdd„ZdS( u Distributionuª 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. cCs[||_|j|_|jjƒ|_|j|_d|_d|_d|_d|_ dS(uŠ Initialise an instance. :param metadata: The instance of :class:`Metadata` describing this distribution. N( umetadataunameulowerukeyuversionuNoneulocatorudigestuextrasucontext(uselfumetadata((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu__init__Cs      uDistribution.__init__cCs |jjS(uH The source archive download URL for this distribution. (umetadatau source_url(uself((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu source_urlRsuDistribution.source_urlcCsd|j|jfS(uX A utility property which displays the name and version in parentheses. u%s (%s)(unameuversion(uself((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyuname_and_version[suDistribution.name_and_versioncCsB|jj}d|j|jf}||kr>|j|ƒn|S(u A set of distribution names and versions provided by this distribution. :return: A set of "name (version)" strings. u%s (%s)(umetadatauprovidesunameuversionuappend(uselfuplistus((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyuprovidesbs   uDistribution.providescCs:t|j|ƒ}t|jj|d|jd|jƒƒS(Nuextrasuenv(ugetattrumetadatausetuget_requirementsuextrasucontext(uselfureq_attrureqts((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu_get_requirementsnsuDistribution._get_requirementscCs |jdƒS(Nu run_requires(u_get_requirements(uself((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu run_requiresssuDistribution.run_requirescCs |jdƒS(Nu meta_requires(u_get_requirements(uself((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu meta_requireswsuDistribution.meta_requirescCs |jdƒS(Nubuild_requires(u_get_requirements(uself((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyubuild_requires{suDistribution.build_requirescCs |jdƒS(Nu test_requires(u_get_requirements(uself((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu test_requiressuDistribution.test_requirescCs |jdƒS(Nu dev_requires(u_get_requirements(uself((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu dev_requiresƒsuDistribution.dev_requiresc Csìt|ƒ}t|jjƒ}y|j|jƒ}WnAtk rwtjd|ƒ|j ƒd}|j|ƒ}YnX|j }d}x^|j D]S}t |ƒ\}} ||kr»q‘ny|j| ƒ}PWq‘tk rãYq‘Xq‘W|S(u¿ Say if this instance matches (fulfills) a requirement. :param req: The requirement to match. :rtype req: str :return: True if it matches, else False. u+could not read version %r - using name onlyiF(uparse_requirementu get_schemeumetadatauschemeumatcheru requirementuUnsupportedVersionErroruloggeruwarningusplitukeyuFalseuprovidesuparse_name_and_versionumatch( uselfurequruschemeumatcherunameuresultupup_nameup_ver((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyumatches_requirement‡s*       u Distribution.matches_requirementcCs6|jrd|j}nd}d|j|j|fS(uC Return a textual representation of this instance, u [%s]uu(u source_urlunameuversion(uselfusuffix((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu__repr__©s uDistribution.__repr__cCs[t|ƒt|ƒk r!d}n6|j|jkoT|j|jkoT|j|jk}|S(u< 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(utypeuFalseunameuversionu source_url(uselfuotheruresult((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu__eq__³s  uDistribution.__eq__cCs't|jƒt|jƒt|jƒS(uH Compute hash in a way which matches the equality test. (uhashunameuversionu source_url(uself((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu__hash__ÃsuDistribution.__hash__NF(u__name__u __module__u __qualname__u__doc__uFalseubuild_time_dependencyu requestedu__init__upropertyu source_urlu download_urluname_and_versionuprovidesu_get_requirementsu run_requiresu meta_requiresubuild_requiresu test_requiresu dev_requiresumatches_requirementu__repr__u__eq__u__hash__(u __locals__((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu Distribution1s$   " csD|EeZdZdZdZd‡fdd†Zddd„Z‡S(uBaseInstalledDistributionu] This is the base class for installed distributions (whether PEP 376 or legacy). cs,tt|ƒj|ƒ||_||_dS(u 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(usuperuBaseInstalledDistributionu__init__upathu dist_path(uselfumetadataupathuenv(u __class__(u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu__init__Òs  u"BaseInstalledDistribution.__init__cCs“|dkr|j}n|dkr6tj}d}ntt|ƒ}d|j}||ƒjƒ}tj|ƒjdƒj dƒ}d||fS(u” 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 uu%s=s=uasciiu%s%sN( uNoneuhasheruhashlibumd5ugetattrudigestubase64uurlsafe_b64encodeurstripudecode(uselfudatauhasheruprefixudigest((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyuget_hashás      !u"BaseInstalledDistribution.get_hashN(u__name__u __module__u __qualname__u__doc__uNoneuhasheru__init__uget_hash(u __locals__((u __class__u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyuBaseInstalledDistributionÊscs|EeZdZdZdZd%d%‡fdd†Zdd„Zdd„Zd d „Z e d d „ƒZ d d„Z dd„Z dd„Zdd„Zd&dd„Zdd„Ze dd„ƒZd&dd„Zdd„Zdd „Zd!d"„Zd#d$„ZejZ‡S('uInstalledDistributionu  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). usha256cs•tj|ƒ|_}|dkr;ddl}|jƒn|rr|jrr||jjkrr|jj|j }n”|dkr|j t ƒ}|dkr«|j dƒ}n|dkrÐt dt |fƒ‚nt j|jƒƒ}td|ddƒ}WdQXntt|ƒj|||ƒ|rD|jrD|jj|ƒny|j dƒ}Wn(tk rddl}|jƒYnX|dk |_dS(NiuMETADATAuno %s found in %sufileobjuschemeulegacyu REQUESTED(u resourcesufinder_for_pathufinderuNoneupdbu set_traceu_cache_enabledu_cacheupathumetadataufinduMETADATA_FILENAMEu ValueErroru contextlibuclosingu as_streamuMetadatausuperuInstalledDistributionu__init__uadduAttributeErroru requested(uselfupathumetadatauenvufinderupdburustream(u __class__(u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu__init__ s0  !      uInstalledDistribution.__init__cCsd|j|j|jfS(Nu#(unameuversionupath(uself((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu__repr__'suInstalledDistribution.__repr__cCsd|j|jfS(Nu%s %s(unameuversion(uself((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu__str__+suInstalledDistribution.__str__c Cs«g}|jdƒ}tj|jƒƒ{}td|ƒc}xY|D]Q}dd„tt|ƒdƒDƒ}||\}}} |j||| fƒqFWWdQXWdQX|S(u" 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). uRECORDustreamcSsg|] }d‘qS(N(uNone(u.0ui((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu =s u6InstalledDistribution._get_records..iN(uget_distinfo_resourceu contextlibuclosingu as_streamu CSVReaderurangeulenuappend( uselfuresultsurustreamu record_readerurowumissingupathuchecksumusize((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu _get_records.s "&u"InstalledDistribution._get_recordscCs.i}|jtƒ}|r*|jƒ}n|S(u 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. (uget_distinfo_resourceuEXPORTS_FILENAMEu read_exports(uselfuresultur((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyuexportsEs uInstalledDistribution.exportsc CsLi}|jtƒ}|rHtj|jƒƒ}t|ƒ}WdQXn|S(uý 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(uget_distinfo_resourceuEXPORTS_FILENAMEu contextlibuclosingu as_streamu read_exports(uselfuresulturustream((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu read_exportsSs u"InstalledDistribution.read_exportsc Cs8|jtƒ}t|dƒ}t||ƒWdQXdS(u 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. uwN(uget_distinfo_fileuEXPORTS_FILENAMEuopenu write_exports(uselfuexportsurfuf((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu write_exportsbsu#InstalledDistribution.write_exportscCs€|jdƒ}tj|jƒƒF}td|ƒ.}x$|D]\}}||kr@|Sq@WWdQXWdQXtd|ƒ‚dS(uW 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. u RESOURCESustreamNu3no resource file with relative path %r is installed(uget_distinfo_resourceu contextlibuclosingu as_streamu CSVReaderuKeyError(uselfu relative_pathurustreamuresources_readerurelativeu destination((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyuget_resource_pathms  u'InstalledDistribution.get_resource_pathccs x|jƒD] }|Vq WdS(uª Iterates over the ``RECORD`` entries and returns a tuple ``(path, hash, size)`` for each line. :returns: iterator of (path, hash, size) N(u _get_records(uselfuresult((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyulist_installed_filessu*InstalledDistribution.list_installed_filesc Cs¡tjj|dƒ}tjj|jƒ}|j|ƒ}tjj|dƒ}|jdƒ}tjd|ƒ|rwdSt |ƒ}xÑ|D]É}tjj |ƒs´|j d ƒrÁd} } nCdtjj |ƒ} t |dƒ} |j| jƒƒ} WdQX|j|ƒs(|r@|j|ƒr@tjj||ƒ}n|j|| | fƒqW|j|ƒrtjj||ƒ}n|j|ddfƒWdQX|S( uÖ 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. uuRECORDu creating %su.pycu.pyou%durbN(u.pycu.pyo(uosupathujoinudirnameu startswithuget_distinfo_fileuloggeruinfouNoneu CSVWriteruisdiruendswithugetsizeuopenuget_hashureadurelpathuwriterow( uselfupathsuprefixudry_runubaseubase_under_prefixu record_pathuwriterupathu hash_valueusizeufp((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyuwrite_installed_files‹s. ! u+InstalledDistribution.write_installed_filesc CsŸg}tjj|jƒ}|jdƒ}xn|jƒD]`\}}}tjj|ƒsptjj||ƒ}n||kr‚q7ntjj|ƒs°|j|dd d fƒq7tjj |ƒr7t tjj |ƒƒ}|r||kr|j|d||fƒq—|r—d|kr3|jddƒd}nd }t|dƒG} |j| jƒ|ƒ} | |kr‹|j|d|| fƒnWd QXq—q7q7W|S( u¨ 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. uRECORDuexistsusizeu=iiurbuhashNTF(uosupathudirnameuget_distinfo_fileulist_installed_filesuisabsujoinuexistsuappenduTrueuFalseuisfileustrugetsizeusplituNoneuopenuget_hashuread( uselfu mismatchesubaseu record_pathupathu hash_valueusizeu actual_sizeuhasherufu actual_hash((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyucheck_installed_files®s.    ,u+InstalledDistribution.check_installed_filesc CsÅi}tjj|jdƒ}tjj|ƒrÁtj|dddƒ}|jƒjƒ}WdQXx[|D]P}|jddƒ\}}|dkr°|j |gƒj |ƒqj|||.set_name_and_version( upathu dist_pathu_cache_enabledu _cache_eggumetadataunameuversionu _get_metadatauaddusuperuEggInfoDistributionu__init__(uselfupathuenvuset_name_and_versionumetadata(u __class__(u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu__init__Ls   !uEggInfoDistribution.__init__c s½d}dd„‰‡fdd†}|jdƒr!tjj|ƒr™tjj|ddƒ}td|d d ƒ}tjj|dd ƒ}||ƒ}q£tj|ƒ}t |j d ƒj d ƒƒ}td|d d ƒ}y(|j dƒ} ˆ| j dƒƒ}Wq£t k rd}Yq£Xn‚|jdƒr“tjj|ƒr{tjj|dƒ}tjj|d ƒ}||ƒ}ntd|d d ƒ}nt d|ƒ‚|r¹|j|ƒn|S(NcSsìg}|jƒ}xÓ|D]Ë}|jƒ}|jdƒrNtjd|ƒPnt|ƒ}|svtjd|ƒqn|jrtjdƒn|js«|j|j ƒqdj dd„|jDƒƒ}|jd|j |fƒqW|S( u’Create a list of dependencies from a requires.txt file. *data*: the contents of a setuptools-produced requires.txt file. u[u.Unexpected line: quitting requirement scan: %ru#Not recognised as a requirement: %ru4extra requirements in requires.txt are not supportedu, css|]}d|VqdS(u%s%sN((u.0uc((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu {suQEggInfoDistribution._get_metadata..parse_requires_data..u%s (%s)( u splitlinesustripu startswithuloggeruwarninguparse_requirementuextrasu constraintsuappendunameujoin(udataureqsulinesulineurucons((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyuparse_requires_datads&       u>EggInfoDistribution._get_metadata..parse_requires_datacsSg}y4tj|ddƒ}ˆ|jƒƒ}WdQXWntk rNYnX|S(u’Create a list of dependencies from a requires.txt file. *req_path*: the path to a setuptools-produced requires.txt file. uruutf-8N(ucodecsuopenureaduIOError(ureq_pathureqsufp(uparse_requires_data(u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyuparse_requires_paths u>EggInfoDistribution._get_metadata..parse_requires_pathu.egguEGG-INFOuPKG-INFOupathuschemeulegacyu requires.txtuEGG-INFO/PKG-INFOuutf8ufileobjuEGG-INFO/requires.txtuutf-8u .egg-infou,path must end with .egg-info or .egg, got %r(uNoneuendswithuosupathuisdirujoinuMetadatau zipimportu zipimporteruStringIOuget_dataudecodeuIOErroruDistlibExceptionuadd_requirements( uselfupathurequiresuparse_requires_pathu meta_pathumetadataureq_pathuzipfufileobjudata((uparse_requires_datau5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu _get_metadataas:   u!EggInfoDistribution._get_metadatacCsd|j|j|jfS(Nu!(unameuversionupath(uself((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu__repr__¬suEggInfoDistribution.__repr__cCsd|j|jfS(Nu%s %s(unameuversion(uself((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu__str__°suEggInfoDistribution.__str__cCs—g}tjj|jdƒ}tjj|ƒr“x`|jƒD]O\}}}||kr^q=ntjj|ƒs=|j|dddfƒq=q=Wn|S(u¨ 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. uinstalled-files.txtuexistsTF(uosupathujoinuexistsulist_installed_filesuappenduTrueuFalse(uselfu mismatchesu record_pathupathu_((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyucheck_installed_files³s  #u)EggInfoDistribution.check_installed_filesc Cs8dd„}dd„}tjj|jdƒ}g}tjj|ƒr4tj|dddƒ¹}x¯|D]§}|jƒ}tjjtjj|j|ƒƒ}tjj|ƒsÚtj d |ƒ|j d ƒrÚqjqÚntjj |ƒsj|j |||ƒ||ƒfƒqjqjWWd QX|j |d d fƒn|S(uµ Iterates over the ``installed-files.txt`` entries and returns a tuple ``(path, hash, size)`` for each line. :returns: a list of (path, hash, size) c Ss@t|dƒ}z|jƒ}Wd|jƒXtj|ƒjƒS(Nurb(uopenureaducloseuhashlibumd5u hexdigest(upathufucontent((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu_md5Îs  u6EggInfoDistribution.list_installed_files.._md5cSstj|ƒjS(N(uosustatust_size(upath((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu_sizeÖsu7EggInfoDistribution.list_installed_files.._sizeuinstalled-files.txturuencodinguutf-8uNon-existent file: %su.pycu.pyoN(u.pycu.pyo(uosupathujoinuexistsucodecsuopenustripunormpathuloggeruwarninguendswithuisdiruappenduNone(uselfu_md5u_sizeu record_pathuresultufulineup((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyulist_installed_filesÆs"    $ /u(EggInfoDistribution.list_installed_filesc csÍtjj|jdƒ}d}tj|dddƒ‘}x‡|D]}|jƒ}|dkrjd}q@n|s@tjjtjj|j|ƒƒ}|j |jƒr¿|r´|Vq¼|Vq¿q@q@WWdQXdS( u  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 uinstalled-files.txturuencodinguutf-8u./NTF( uosupathujoinuTrueucodecsuopenustripuFalseunormpathu startswith(uselfuabsoluteu record_pathuskipufulineup((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyulist_distinfo_filesìs    $u'EggInfoDistribution.list_distinfo_filescCst|tƒo|j|jkS(N(u isinstanceuEggInfoDistributionupath(uselfuother((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu__eq__suEggInfoDistribution.__eq__TNF(u__name__u __module__u __qualname__u__doc__uTrueu requestedushared_locationsuNoneu__init__u _get_metadatau__repr__u__str__ucheck_installed_filesulist_installed_filesuFalseulist_distinfo_filesu__eq__uobjectu__hash__(u __locals__((u __class__u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyuEggInfoDistributionCs K    & cBs|EeZdZdZdd„Zdd„Zddd„Zdd „Zd d „Z d d d„Z ddd„Z dd„Z dd„ZdS(uDependencyGraphuù 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|_dS(N(uadjacency_listu reverse_listumissing(uself((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu__init__#s  uDependencyGraph.__init__cCsg|j| "%s" [label="%s"] u "%s" -> "%s" usubgraph disconnected { ulabel = "Disconnected" ubgcolor = red u"%s"u u} N(uwriteuadjacency_listuitemsulenuappenduNoneuname(uselfufuskip_disconnectedu disconnectedudistuadjsuotherulabel((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyuto_dot\s&    %    uDependencyGraph.to_dotcsg}i}x1|jjƒD] \}}|dd…||•s u4DependencyGraph.topological_sort..uMoving to result: %scSs&g|]}d|j|jf‘qS(u%s (%s)(unameuversion(u.0ud((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu —s (uadjacency_listuitemsulistuappenduloggerudebuguextendukeys(uselfuresultualistukuv((u to_removeu5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyutopological_sort|s$) ! u DependencyGraph.topological_sortcCsIg}x3|jjƒD]"\}}|j|j|ƒƒqWdj|ƒS(uRepresentation of the graphu (uadjacency_listuitemsuappendu repr_nodeujoin(uselfuoutputudistuadjs((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu__repr__›suDependencyGraph.__repr__NT(u__name__u __module__u __qualname__u__doc__u__init__uadd_distributionuNoneuadd_edgeu add_missingu _repr_distu repr_nodeuTrueuto_dotutopological_sortu__repr__(u __locals__((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyuDependencyGraphs     uDependencyGraphudefaultcCsÒt|ƒ}tƒ}i}xv|D]n}|j|ƒxX|jD]M}t|ƒ\}}tjd|||ƒ|j|gƒj||fƒq?Wq"Wx7|D]/}|j |j B|j B|j B}x|D]} y|j | ƒ} WnAtk r"tjd| ƒ| jƒd}|j |ƒ} YnX| j}d} ||kr­xl||D]]\}} y| j|ƒ} Wntk r‚d} YnX| rI|j|| | ƒd} PqIqIWn| sÆ|j|| ƒqÆqÆWq›W|S(u6Makes 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 uAdd to provided: %s, %s, %su+could not read version %r - using name onlyiFT(u get_schemeuDependencyGraphuadd_distributionuprovidesuparse_name_and_versionuloggerudebugu setdefaultuappendu run_requiresu meta_requiresubuild_requiresu dev_requiresumatcheruUnsupportedVersionErroruwarningusplitukeyuFalseumatchuadd_edgeuTrueu add_missing(udistsuschemeugraphuprovidedudistupunameuversionurequiresurequmatcherumatcheduproviderumatch((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu make_graph£sD    '         u make_graphcCs¯||kr"td|jƒ‚nt|ƒ}|g}|j|}xW|r|jƒ}|j|ƒx1|j|D]"}||krt|j|ƒqtqtWqGW|jdƒ|S(uÚRecursively 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 u1given distribution %r is not a member of the listi(uDistlibExceptionunameu make_graphu reverse_listupopuappend(udistsudistugraphudeputodoudusucc((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyuget_dependent_distsÙs         uget_dependent_distscCs£||kr"td|jƒ‚nt|ƒ}g}|j|}x[|rž|jƒd}|j|ƒx1|j|D]"}||kru|j|ƒququWqDW|S(uÙRecursively 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 u1given distribution %r is not a member of the listi(uDistlibExceptionunameu make_graphuadjacency_listupopuappend(udistsudistugraphurequtodoudupred((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyuget_required_distsós      uget_required_distscKsI|jddƒ}t|}||_||_|p9d|_t|ƒS(uO A convenience method for making a dist given just a name and version. usummaryuPlaceholder for summaryuPlaeholder for summary(upopuMetadataunameuversionusummaryu Distribution(unameuversionukwargsusummaryumd((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyu make_dist s    u make_dist(5u__doc__u __future__uunicode_literalsubase64ucodecsu contextlibuhashlibulogginguosu posixpathusysu zipimportuuDistlibExceptionu resourcesucompatuStringIOuversionu get_schemeuUnsupportedVersionErrorumetadatauMetadatauMETADATA_FILENAMEuutiluparse_requirementucached_propertyuparse_name_and_versionu read_exportsu write_exportsu CSVReaderu CSVWriteru__all__u getLoggeru__name__uloggeruEXPORTS_FILENAMEuCOMMANDS_FILENAMEu DIST_FILESu DISTINFO_EXTuobjectu_CacheuDistributionPathu DistributionuBaseInstalledDistributionuInstalledDistributionuEggInfoDistributionunew_dist_classuold_dist_classuDependencyGraphu make_graphuget_dependent_distsuget_required_distsu make_dist(((u5/tmp/pip-zej_zi-build/pip/_vendor/distlib/database.pyusL         4  ç™7ÿCÌ6