[Distutils] Buildout + namespace packages + Django management commands?

Kyle MacFarlane kylemacfarlane at gmail.com
Sun Sep 20 10:17:23 CEST 2009


2009/9/19 P.J. Eby <pje at telecommunity.com>
> If they use the package's __path__ attribute, they'll find its contents, whether someone is using pkgutil.extend_path, .pth files, or setuptools.  They don't have to support setuptools to support namespace packages, just pay attention to the __path__ variable that's part of standard Python.

I was hoping more if anybody knew a recipe to get round my problem but
I had a look inside Django to see how it looks through packages.

The problem is caused by line 58 at this link raising an ImportError:
http://code.djangoproject.com/browser/django/trunk/django/core/management/__init__.py

It doesn't matter what order find_module is called on various paths,
it still relies entirely on the order in sys.path. Calling find_module
on second_app before first_app will still fail if first_app is the
first app on sys.path (which suggests that something has been done
wrong even before line 58 or find_module itself doesn't support
namespaces?).

Unfortunately I've never dealt with the imp module before. What would
I need to do? Import the package (which is actually "path" in this
code), get __path__ from it and then do find_module again but with
__path__ instead?


More information about the Distutils-SIG mailing list