[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
- Previous message: [Python-checkins] r45402 - python/trunk/Lib/test/leakers/test_tee.py
- Next message: [Python-checkins] r45404 - sandbox/trunk/setuptools/setuptools.txt
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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'))
for pkg in self._get_metadata('namespace_packages.txt'):
def egg_name(self): """Return what this distribution's standard .egg filename should be"""if pkg in sys.modules: declare_namespace(pkg)
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
- Namespace packages are now imported lazily. That is, the mere declaration
- of a namespace package in an egg on
sys.path
no longer causes it to be - imported when
pkg_resources
is imported. Note that this means that all - of a namespace package's
__init__.py
files must include a declare_namespace()
call.
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
- Namespace packages'
__init__.py
files MUST usedeclare_namespace()
- Namespace packages'
- in order to ensure that they will be handled properly at runtime. (In 0.6,
- it was possible to get away without doing this, but only at the cost of
- forcing namespace packages to be imported early, which 0.7 does not do.)
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():
from distutils import log
log.warn(
"WARNING: %s is a namespace package, but its __init__.py does\n"
"not declare_namespace(); setuptools 0.7 will REQUIRE this!\n"
'(See the setuptools manual under "Namespace Packages" for '
"details.)\n", package
from distutils.errors import DistutilsError
raise DistutilsError(
"Namespace package problem: %s is a namespace package, but its\n"
"__init__.py does not call declare_namespace()! Please fix it.\n"
'(See the setuptools manual under "Namespace Packages" for '
"details.)\n" % (package,) ) f.close() return init_py
- Previous message: [Python-checkins] r45402 - python/trunk/Lib/test/leakers/test_tee.py
- Next message: [Python-checkins] r45404 - sandbox/trunk/setuptools/setuptools.txt
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]