OpenQuizz
Une application de gestion des contenus pédagogiques
InstalledDistribution Class Reference
Inheritance diagram for InstalledDistribution:
Collaboration diagram for InstalledDistribution:

Public Member Functions

def __init__ (self, path, metadata=None, env=None)
 
def __repr__ (self)
 
def __str__ (self)
 
def exports (self)
 
def read_exports (self)
 
def write_exports (self, exports)
 
def get_resource_path (self, relative_path)
 
def list_installed_files (self)
 
def write_installed_files (self, paths, prefix, dry_run=False)
 
def check_installed_files (self)
 
def shared_locations (self)
 
def write_shared_locations (self, paths, dry_run=False)
 
def get_distinfo_resource (self, path)
 
def get_distinfo_file (self, path)
 
def list_distinfo_files (self)
 
def __eq__ (self, other)
 
- Public Member Functions inherited from BaseInstalledDistribution
def get_hash (self, data, hasher=None)
 
- Public Member Functions inherited from Distribution
def __init__ (self, metadata)
 
def source_url (self)
 
def name_and_version (self)
 
def provides (self)
 
def run_requires (self)
 
def meta_requires (self)
 
def build_requires (self)
 
def test_requires (self)
 
def dev_requires (self)
 
def matches_requirement (self, req)
 
def __hash__ (self)
 

Data Fields

 modules
 
 finder
 
 requested
 
 path
 
- Data Fields inherited from BaseInstalledDistribution
 path
 
 dist_path
 
- Data Fields inherited from Distribution
 metadata
 
 name
 
 key
 
 version
 
 locator
 
 digest
 
 extras
 
 context
 
 download_urls
 
 digests
 
 source_url
 

Static Public Attributes

 hasher
 
- Static Public Attributes inherited from BaseInstalledDistribution
 hasher
 
- Static Public Attributes inherited from Distribution
 build_time_dependency
 
 requested
 
 download_url
 

Detailed Description

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).

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  metadata,
  path = None,
  env = None 
)
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.

Reimplemented from BaseInstalledDistribution.

Member Function Documentation

◆ __eq__()

def __eq__ (   self,
  other 
)
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.

Reimplemented from Distribution.

◆ __repr__()

def __repr__ (   self)
Return a textual representation of this instance,

Reimplemented from Distribution.

◆ __str__()

def __str__ (   self)

◆ check_installed_files()

def check_installed_files (   self)
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.

◆ exports()

def exports (   self)
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.

◆ get_distinfo_file()

def get_distinfo_file (   self,
  path 
)
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

◆ get_distinfo_resource()

def get_distinfo_resource (   self,
  path 
)

◆ get_resource_path()

def get_resource_path (   self,
  relative_path 
)
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.

◆ list_distinfo_files()

def list_distinfo_files (   self)
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

◆ list_installed_files()

def list_installed_files (   self)
Iterates over the ``RECORD`` entries and returns a tuple
``(path, hash, size)`` for each line.

:returns: iterator of (path, hash, size)

◆ read_exports()

def read_exports (   self)
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.

◆ shared_locations()

def shared_locations (   self)
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.

◆ write_exports()

def write_exports (   self,
  exports 
)
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.

◆ write_installed_files()

def write_installed_files (   self,
  paths,
  prefix,
  dry_run = False 
)
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.

◆ write_shared_locations()

def write_shared_locations (   self,
  paths,
  dry_run = False 
)
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.

Field Documentation

◆ finder

finder

◆ hasher

hasher
static

◆ modules

modules

◆ path

path

◆ requested

requested

The documentation for this class was generated from the following file: