Another improvement by Nick: a better description of splitting portions among multiple directories.

This commit is contained in:
Eric V. Smith 2012-04-20 06:20:24 -04:00
parent ce4af70258
commit 661887ade7
1 changed files with 14 additions and 13 deletions

View File

@ -84,19 +84,20 @@ doesn't. Likewise, setuptools supports inspecting zip files, and
supports adding portions to its _namespace_packages variable, whereas supports adding portions to its _namespace_packages variable, whereas
pkgutil doesn't. pkgutil doesn't.
Namespace packages need to be installed in one of two ways: either all Namespace packages are designed to support being split across multiple
portions of a namespace will be combined into a single directory (and directories (and hence found via multiple sys.path entries). In this
therefore a single entry in sys.path), or each portion will be configuration, it doesn't matter if multiple portions all provide an
installed in its own directory (and each portion will have a distinct ``__init__.py`` file, so long as each portion correctly initializes
sys.path entry). the namespace package. However, Linux distribution vendors (amongst
others) prefer to combine the separate portions and install them all
The current imperative approach causes problems for system vendors. into the *same* filesystem directory. This creates a potential for
Vendor packages typically must not provide overlapping files, and an conflict, as the portions are now attempting to provide the *same*
attempt to install a vendor package that has a file already on disk file on the target system - something that is not allowed by many
will fail or cause unpredictable behavior. As vendors might choose to package managers. Allowing implicit namespace packages means that the
package distributions such that they will end up all in a single requirement to provide an ``__init__.py`` file can be dropped
directory for the namespace package, all portions would contribute completely, and affected portions can be installed into a common
conflicting __init__.py files. directory or split across multiple directories as distributions see
fit.
Specification Specification
============= =============