At 09:15 AM 2/9/2007 -0500, Jim Fulton wrote: >The question is whether a less annoying layout can be made importable.
Well, what's "annoying" is relative. I personally find the flat layout "annoying" because it's not WYSIWYG. :) But the answer to your question is "yes". Anything can be made importable, with sufficient effort. When a project that includes a namespace package is installed using --single-version-externally-managed, a special .pth file for that project is created that sets up empty modules in sys.modules with appropriate __path__ values. A similar technique could be applied in setup.py develop, if a project uses package_dirs. I'm just a bit reluctant to try to shoehorn something like that into 0.6. But, if you'd like to experiment with creating a patch (or a subclass of "develop") that would support creating and uninstalling this .pth file, see the 'install_namespaces()' method of the install_egg_info command in setuptools. The code you'd need for this would actually be *simpler* in some ways, because that code is trying to work relative to whatever directory it's installed in, but for what "develop" needs you could just bake the absolute paths right in. The uninstall mode of "develop" could just remove the .pth file. One possible complication, however, is that if someone didn't uninstall but left the .pth file around, it would produce strange results (if e.g., they installed an egg for the project without uninstalling the develop mode). So, the code in the .pth should probably check that the original project is still on sys.path before creating dummy modules. _______________________________________________ Distutils-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/distutils-sig
