Support legacy portions along with PEP 420 portions.

This commit is contained in:
Eric V. Smith 2012-05-15 22:13:32 -04:00
parent e8108d36cd
commit ec4303b832
1 changed files with 19 additions and 0 deletions

View File

@ -38,6 +38,8 @@ Within this PEP:
stored in a zip file) that contribute to a namespace package.
* "regular package" refers to packages as they are implemented in
Python 3.2 and earlier.
* "legacy portion" refers to a portion that uses ``__path__``
manipulation in order to implement namespace packages.
This PEP defines a new type of package, the "namespace package".
@ -184,6 +186,11 @@ be empty) is added to the list of recorded path entries and path
searching continues. If ``loader`` is not ``None``, it is immediately
used to load a module or regular package.
Even if ``loader`` is returned and is not ``None``,
``<iterable-of-path-entries>`` must still contain the path entries for
the package. This allows code such as ``pkgutil.extend_path()`` to
compute path entries for packages that it does not load.
Note that multiple path entries per finder are allowed. This is to
support the case where a finder discovers multiple namespace portions
for a given ``fullname``. Many finders will support only a single
@ -230,6 +237,18 @@ any standard library packages become namespace packages is outside the
scope of this PEP.
Migrating from legacy namespace packages
----------------------------------------
As described above, prior to this PEP ``pkgutil.extend_path()`` was
used by legacy portions to create namespace packages. Because it is
likely not practical for all existing portions of a namespace package
to be migrated to this PEP at once, ``extend_path()`` will be modified
to also recognize PEP 420 namespace packages. This will allow some
portions of a namespace to be legacty portions while others are
migrated to PEP 420.
Packaging Implications
======================