[Grok-dev] Problem with z3c.autoinclude of eggs in the Products namespace

Ethan Jucovy ethan.jucovy at gmail.com
Thu Feb 26 11:58:38 EST 2009


(Reviving an old thread..)

On Mon, Nov 24, 2008 at 7:55 AM, Vincent Fretin
<vincent.fretin at gmail.com> wrote:
> You absolutly right. Here I don't use the autoinclude fonctionnality
> to include Products.* eggs. I know it's already automatic.
> It's just that myproject.policy depends on Products.myproject and
> other eggs not in Products namespace.
> I want that when I install the myproject.policy egg, all dependencies
> are installed as well.
> And I want to use the autoinclude fonctionnality for dependencies not
> in Products namespace.

I recently added functionality to z3c.autoinclude that will disable
dependency autoinclusion globally if
`os.environ.has_key('Z3C_AUTOINCLUDE_DEPENDENCIES_DISABLED')`.
Considering your use case, perhaps z3c.autoinclude should check for
particular package namespaces to disable, something roughly like:

{{{
def is_disabled(package):
  disabled_namespaces = os.environ.get('Z3C_AUTOINCLUDE_DEPENDENCIES_DISABLED')
  if disabled_namespaces is None:
    return False
  disabled_namespaces = disabled_namespaces.split(';')
  for namespace in disabled_namespaces:
    if package.is_in_namespace(namespace):
      return True
}}

Then you could set
`os.environ['Z3C_AUTOINCLUDE_DEPENDENCIES_DISABLED'] = "Products" or
just "Products.myproject".

> I did some tests, including zcml in different order. It's always working. :-S
>
> I think I found the problem, it's my fault.
> It's not working when I don't put Products.myproject in eggs in buildout.cfg
> The <include package="Products.myproject" /> complains about it, it
> don't find the package.
> ConfigurationError: ('Invalid value for', 'package', 'ImportError:
> Module Products has no global myproject')
>
> With <includeDependencies package="." />, it don't complains when it
> can't find the package, it silently continues.
> Why this choice by default? Is it Normal? For me it's a bug.
>
> Thanks Ethan, you have open my eyes on this problem.

Ahh, so the Products.myproject egg was listed in setup.py's
package_includes, but it wasn't actually installed in your
environment?  That does sound like something autoinclude ought to be
able to know about, so I think I agree with you that it's a bug.  I'll
see if I can reproduce and change it to emit a warning or something.

Thanks,
Ethan


More information about the Grok-dev mailing list