-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Tres Seaver wrote:
> Brian Sutherland wrote: >> On Wed, Dec 10, 2008 at 11:05:06AM +0100, Hermann Himmelbauer wrote: >>> Someone recently suggested to rename it to z3c.schema.iban, which sounds a >>> good idea to me, however, in this case my package would use another >>> package, >>> namely z3c.schema, as namespace. >>> >>> So what's your suggestion in this case? >> There's no problem as long as z3c.schema is truly empty, i.e. there are >> no other packages that put any files in it. > >> The problem with z3c.pt.compat is that z3c.pt is not empty (see >> http://svn.zope.org/z3c.pt/trunk/src/z3c/pt/). That's what causes the >> problems I've been seeing. > > The issue comes not from having modules inside the namespace package > (which is fine: the __path__ of namespacee packages is extended to > include all eggs which use it). Rather, the problem is having a > non-empty __init__.py in a namespace package (specifically, one which > does anything else than declare that it is a namespace). The problem > arises because only one of the __init__.py files will be imported (the > first one found). A points I missed the first time: - - If having modules inside a namespace package was somehow broken under setuptools, then having sub-pacakges would be too: there isn't any magical difference between the two in how Python imports them. Please see the setuptools docs for an explanation of what namespace pacakges must do: I created a pair of packages to demonstrate having a module inside a namespace package (see attachment). To play with them, run 'python setup.py develop' in each of them using a setuptools-enabld Python environment in whose site-packages you don't mind scribbling (a virtualenv is perfect for this kind of stuff). E.g.:: $ /path/to/virtualenv --no-site-packages /tmp/nstest $ cd /tmp/nstest $ mkdir src $ cd src $ tar xzf /tmp/nstest.tar.gz $ cd foo $ ../../bin/python setup.py develop $ cd ../foo.bar $ ../../bin/python setup.py develop $ cd ../.. $ bin/python ... >>> import foo >>> print foo.__file__ '/tmp/nstest/src/foo.bar/foo/__init__.pyc' >>> import foo.qux >>> import foo.bar >>> foo.qux.quack >>> foo.bar.cheer Note that the __file__ of the namespace package is not guaranteed to be in one or the other egg, which is why namespace packages must have nothing more in their __init__.py than the boilerplate which declares the namespace. Tres - -- =================================================================== Tres Seaver +1 540-429-0999 [EMAIL PROTECTED] Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFJQAqd+gerLs4ltQ4RAvHgAKCgjeyLLFqZUmhmhsd81Wm6RXlXyQCg2r0D PNIFGNtvOwkYzsh9VSHEIy4= =pcdI -----END PGP SIGNATURE-----
nstest.tar.gz
Description: GNU Zip compressed data
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )