diff --git a/pep-0376.txt b/pep-0376.txt index 75901693e..73f97a6e6 100644 --- a/pep-0376.txt +++ b/pep-0376.txt @@ -301,11 +301,11 @@ The API is organized in five classes that work with directories and Zip files - ``Distribution``: manages an `.egg-info` directory. - ``ZippedDistribution``: manages an `.egg-info` directory contained in a zip file. -- ``DistributionDirectory``: manages a directory that contains some `.egg-info` +- ``DistributionDir``: manages a directory that contains some `.egg-info` directories. -- ``ZippedDistributionDirectory``: manages a zipped directory that contains +- ``ZippedDistributionDir``: manages a zipped directory that contains some `.egg.info` directory. -- ``DistributionDirectories``: manages ``DistributionDirectory`` instances. +- ``DistributionDirMap``: manages ``DistributionDir`` instances. Distribution class ------------------ @@ -375,19 +375,19 @@ class so its methods work with an `.egg.info` directory located in a zip file. Other public methods and attributes are similar to ``Distribution``. -DistributionDirectory class +DistributionDir class --------------------------- -A new class called ``DistributionDirectory`` is created with a path +A new class called ``DistributionDir`` is created with a path corresponding to a directory. For each `.egg-info` directory founded in `path`, the class creates a corresponding ``Distribution``. -The class is a ``set`` of ``Distribution`` instances. ``DistributionDirectory`` +The class is a ``set`` of ``Distribution`` instances. ``DistributionDir`` provides a ``path`` attribute corresponding to the path is was created with. -``DistributionDirectory(path)`` -> instance +``DistributionDir(path)`` -> instance - Creates a ``DistributionDirectory`` instance for the given ``path``. + Creates a ``DistributionDir`` instance for the given ``path``. It also provides one extra method besides the ones from ``set``: @@ -397,53 +397,53 @@ It also provides one extra method besides the ones from ``set``: ``Distribution.uses(path)`` on all ``Distribution`` instances. -ZippedDistributionDirectory class +ZippedDistributionDir class --------------------------------- -A ``ZippedDistributionDirectory`` is provided. It overrides the -``DistributionDirectory`` class so its methods work with a Zip file. +A ``ZippedDistributionDir`` is provided. It overrides the +``DistributionDir`` class so its methods work with a Zip file. -``ZippedDistributionDirectory(path)`` -> instance +``ZippedDistributionDir(path)`` -> instance - Creates a ``ZippedDistributionDirectory`` instance for the given ``path``. + Creates a ``ZippedDistributionDir`` instance for the given ``path``. -Other public methods and attributes are similar to ``DistributionDirectory``. +Other public methods and attributes are similar to ``DistributionDir``. -DistributionDirectories class +DistributionDirMap class ----------------------------- -A new class called ``DistributionDirectories`` is created. It's a collection of -``DistributionDirectory`` and ``ZippedDistributionDirectory`` instances. +A new class called ``DistributionDirMap`` is created. It's a collection of +``DistributionDir`` and ``ZippedDistributionDir`` instances. -``DistributionDirectories(paths=None, use_cache=True)`` -> instance +``DistributionDirMap(paths=None, use_cache=True)`` -> instance If ``paths`` is not not, it's a sequence of paths the constructor loads in the instance. The constructor also takes an optional ``use_cache`` argument. - When it's ``True``, ``DistributionDirectories`` will use a global + When it's ``True``, ``DistributionDirMap`` will use a global cache to reduce the numbers of I/O accesses and speed up the lookups. - The cache is a global mapping containing ``DistributionDirectory`` and - ``ZippedDistributionDirectory`` instances. When a - ``DistributionDirectories`` object is created, it will use the cache to + The cache is a global mapping containing ``DistributionDir`` and + ``ZippedDistributionDir`` instances. When a + ``DistributionDirMap`` object is created, it will use the cache to add an entry for each path it visits, or reuse existing entries. The cache usage can be disabled at any time with the ``use_cache`` attribute. The cache can also be emptied with the global ``purge_cache`` function. -The class is a ``dict`` where the values are ``DistributionDirectory`` -and ``ZippedDistributionDirectory`` instances and the keys are their path +The class is a ``dict`` where the values are ``DistributionDir`` +and ``ZippedDistributionDir`` instances and the keys are their path attributes. -``DistributionDirectories`` also provides the following methods besides the ones +``DistributionDirMap`` also provides the following methods besides the ones from ``dict``: - ``load(*paths)`` - Creates and adds ``DistributionDirectory`` (or - ``ZippedDistributionDirectory``) instances corresponding to ``paths``. + Creates and adds ``DistributionDir`` (or + ``ZippedDistributionDir``) instances corresponding to ``paths``. - ``reload()`` @@ -453,7 +453,7 @@ from ``dict``: ``ZippedDistribution``) instances. Iterates over all ``Distribution`` and ``ZippedDistribution`` contained - in ``DistributionDirectory`` and ``ZippedDistributionDirectory`` instances. + in ``DistributionDir`` and ``ZippedDistributionDir`` instances. - ``get_distribution(dist_name)`` -> ``Distribution`` (or ``ZippedDistribution``) or None. @@ -496,7 +496,7 @@ The new functions added in the ``pkgutil`` are : Iterates over all distributions to find out which distributions uses ``path``. ``path`` can be a local absolute path or a relative '/'-separated path. -All these functions use the same global instance of ``DistributionDirectories`` +All these functions use the same global instance of ``DistributionDirMap`` to use the cache. Notice that the cache is never emptied explicitely. Example