You are here: Home Blog Dealing with dependencies
Personal tools

Dealing with dependencies

Posted by daniel at Oct 30, 2012 06:04 PM |
Working out the dependencies between plone eggs is just a bit too forgetable. Here's my note to self.

Dependencies in eggs come in 3 locations, which I find a bit confusing, but here they are anyway...

setup.py 

Make entries under install_requires.  This is necessary for buildout to pick up your egg dependencies.  Make sure the autoinclude directive is there too - otherwise you would need to add zcml slugs to your buildout file.

...
     include_package_data=True,
      zip_safe=False,
      install_requires=[
          'setuptools',
          'Products.Carousel',
          'redturtle.video',
          'collective.rtvideo.youtube',
          'Products.ContentWellPortlets',
          'Products.EasyNewsletter [all]',
          'Products.Scrawl',
          # -*- Extra requirements: -*-
      ],
      entry_points="""
      # -*- Entry points: -*-

      [z3c.autoinclude.plugin]
      target = plone
      """,
      setup_requires=["PasteScript"],
      paster_plugins=["ZopeSkel"],
      )
...

metadata.xml

As seen in this proposal (probably a better link exists).  You need this so that Plone will actually run the install profile for each of your dependencies when you install your egg. Otherwise you will need to check of each product individually on the Add-ons page.

<metadata>
  <description>This is the profile description</description>
  <version>0.2</version>
<dependencies>
<dependency>profile-Products.Carousel:default</dependency>
<dependency>profile-redturtle.video:default</dependency>
<dependency>profile-Products.ContentWellPortlets:default</dependency>
<dependency>profile-gogotrust.contenttypes:default</dependency>
<dependency>profile-Products.EasyNewsletter:default</dependency>
</dependencies>
</metadata>

 

configure.zcml

This is not needed unless you borrow zcml namespaces from your dependencies. But I've included it here for completeness anyway.
As demonstrated in schools theme:

<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:five="http://namespaces.zope.org/five"
    xmlns:cmf="http://namespaces.zope.org/cmf"
    i18n_domain="quintagroup.theme.schools">

   <five:registerPackage package="." initialize=".initialize" />

   <include package="Products.Carousel" />             
...

 

Some great documentation on ZCML can be found here