On Sun, May 24, 2009 at 10:12 PM, Jeff Rush <span dir="ltr"><<a href="mailto:jeff@taupro.com">jeff@taupro.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
And it then walked all my packages and gave me an exception traceback when it<br>
hit the speechd package. No idea why it is touching non-Zope packages.<br>
<font color="#888888"></font></blockquote><div><br>Still haven't managed to reproduce this .. it's all very strange to me.<br><br>Hmm .. could you see what "dist" is, and what `dist.requires()` returns, in your broken setup's zcml.py `autoIncludeDirective`?<br>
<br>Here's what z3c.autoinclude is trying to do..<br><br>1) `autoIncludeDirective` in zcml.py is invoked by a ZCML directive somewhere. (grokproject creates the following directive in your new project's configure.zcml: <includeDependencies package="." />)<br>
2) `autoIncludeDirective` takes the package passed in from the ZCML directive, which at this point has already been resolved into a Python module object.<br>3) `distributionForPackage` takes that module object and determines what distribution (egg) the module was provided by. This function is really hairy (mostly because of virtual namespace packages) and *does* touch everything in your sys.path but it doesn't look like it's where your problem is coming from.<br>
4) Now autoinclude has a setuptools Distribution object. It asks that object for the distributions listed in its "install_requires" (that's the `self.context.requires()` line, going through the pkg_resources API -- self.context being the Distribution) and pokes at each of those to find ZCML files to include.<br>
<br>So if there's any place where unexpected packages would be touched, I would suspect step #3. But from the traceback it looks like it's happening in step #4, even though step #4 should only be looping over packages that are explicitly required by your project.<br>
<br>You might also try upgrading to z3c.autoinclude v0.3.1. One significant difference is that v0.2 imports setuptools, which I've heard is a Bad Idea because it triggers some monkeypatching. Don't know why that would result in this error, though.<br>
<br>I'd also be curious whether the error goes away if you downgrade to z3c.autoinclude v0.1, but now I'm probably asking way too much :)<br><br>egj<br></div></div>