[Python-checkins] r45403 - in sandbox/trunk/setuptools: pkg_resources.py pkg_resources.txt setuptools.txt setuptools/command/build_py.py (original) (raw)

phillip.eby python-checkins at python.org
Fri Apr 14 21:13:26 CEST 2006


Author: phillip.eby Date: Fri Apr 14 21:13:24 2006 New Revision: 45403

Modified: sandbox/trunk/setuptools/pkg_resources.py sandbox/trunk/setuptools/pkg_resources.txt sandbox/trunk/setuptools/setuptools.txt sandbox/trunk/setuptools/setuptools/command/build_py.py Log: Don't eagerly import namespace packages. This was the big reason for branching to 0.7 now, as I wanted this wart gone before anything went into Python 2.5. But it's gone now, yay!

Modified: sandbox/trunk/setuptools/pkg_resources.py

--- sandbox/trunk/setuptools/pkg_resources.py (original) +++ sandbox/trunk/setuptools/pkg_resources.py Fri Apr 14 21:13:24 2006 @@ -2045,8 +2045,8 @@ self.insert_on(path) if path is sys.path: fixup_namespace_packages(self.location) - map(declare_namespace, self._get_metadata('namespace_packages.txt'))

Modified: sandbox/trunk/setuptools/pkg_resources.txt

--- sandbox/trunk/setuptools/pkg_resources.txt (original) +++ sandbox/trunk/setuptools/pkg_resources.txt Fri Apr 14 21:13:24 2006 @@ -121,13 +121,16 @@ A namespace package is a package that only contains other packages and modules, with no direct contents of its own. Such packages can be split across -multiple, separately-packaged distributions. Normally, you do not need to use -the namespace package APIs directly; instead you should supply the -namespace_packages argument to setup() in your project's setup.py. -See the setuptools documentation on namespace packages_ for more information.

-However, if for some reason you need to manipulate namespace packages or -directly alter sys.path at runtime, you may find these APIs useful: +multiple, separately-packaged distributions. They are normally used to split +up large packages produced by a single organization, such as in the zope +namespace package for Zope Corporation packages, and the peak namespace +package for the Python Enterprise Application Kit. + +To create a namespace package, you list it in the namespace_packages +argument to setup(), in your project's setup.py. (See the setuptools +documentation on namespace packages_ for more information on this.) Also, +you must add a declare_namespace() call in the package's __init__.py +file(s): declare_namespace(name) Declare that the dotted package name name is a "namespace package" whose @@ -140,6 +143,9 @@ is invoked, it checks for the presence of namespace packages and updates their __path__ contents accordingly. +Applications that manipulate namespace packages or directly alter sys.path +at runtime may also need to use this API function: + fixup_namespace_packages(path_item) Declare that path_item is a newly added item on sys.path that may need to be used to update existing namespace packages. Ordinarily, this is @@ -1652,5 +1658,10 @@ Release Notes/Change History

-XXX Starting fresh for 0.7 +0.7a1

Modified: sandbox/trunk/setuptools/setuptools.txt

--- sandbox/trunk/setuptools/setuptools.txt (original) +++ sandbox/trunk/setuptools/setuptools.txt Fri Apr 14 21:13:24 2006 @@ -2476,7 +2476,11 @@ Release Notes/Change History

-XXX starting fresh for 0.7 +0.7a1

Mailing list

Modified: sandbox/trunk/setuptools/setuptools/command/build_py.py

--- sandbox/trunk/setuptools/setuptools/command/build_py.py (original) +++ sandbox/trunk/setuptools/setuptools/command/build_py.py Fri Apr 14 21:13:24 2006 @@ -142,12 +142,12 @@

     f = open(init_py,'rU')
     if 'declare_namespace' not in f.read():


More information about the Python-checkins mailing list