[Grok-dev] Problem with z3c.autoinclude of eggs in the Products namespace
Vincent Fretin
vincent.fretin at gmail.com
Fri Feb 27 04:03:50 EST 2009
On Thu, Feb 26, 2009 at 5:58 PM, Ethan Jucovy <ethan.jucovy at gmail.com> wrote:
> (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.
If I remember well and rereading the first post of this thread, my use case was:
Products.myproject egg was listed in setup.py's install_requires and
in my buildout I had the following:
[buildout]
versions = versions
eggs = [...]
z3c.autoinclude
myproject.policy
develop =
src/myproject.policy
src/Products.myproject
[versions]
z3c.autoinclude == 0.2.2
[instance]
zcml =
z3c.autoinclude-meta
myproject.policy
and with or without z3c.autoinclude, Products.myproject was not found.
Adding Products.myproject to 'egg = ' fixed the problem.
I thought it was only necessary to specify an egg you develop in the
src directory only in the develop variable, but it seems not, you have
to specify in the egg variable too. There is maybe a thing I
misunderstand about buildout...
But still z3c.autoinclude should emit a warning when it can't find an egg.
--
Vincent Fretin
More information about the Grok-dev
mailing list