Personal tools
You are here: Home Archive 2008 March 10 collective.recipe.omelette: for more navigable eggs
Document Actions

collective.recipe.omelette: for more navigable eggs

by David Glick last modified March 10, 2008 - 22:56

Crack 'em open and mix 'em together...

I've been using zc.buildout for a few months now, and am quite happy with it.  However, I got tired of navigating to my egg cache, locating the right package (and version) within a long flat list, and then clicking a few more times to actually get to the contents of the package.  And I was looking for a project to practice my buildout recipe fu.

So I created collective.recipe.omelette.  It's a simple buildout recipe that takes all your namespace-packaged eggs and merges their contents together into a single directory tree, in its own parts directory, with symlinks to the actual egg contents.  The result looks much the lib/python of days gone by.  So instead of:

egg-cache/
    my.egg.one-1.0-py2.4.egg/
        my/
            egg/
                one/
                    (contents of first egg)
    my.egg.two-1.0-py2.4.egg/
        my/
            egg/
                two/
                    (contents of second egg)

you can now make use of:

parts/
    omelette/
        my/
            egg/
                one/
                    (contents of first egg)
                two/
                    (contents of second egg)

with obvious advantages in navigability and greppability.

Collective.recipe.omelette is available from the Cheese Shop.  You can add an omelette to your buildout by making the following additions to buildout.cfg (assuming you have a part called instance and you want to generate symlinks for its eggs), and then re-running your buildout:

[buildout]
...
parts =
    ...
    omelette

[omelette]
recipe = collective.recipe.omelette
eggs = ${instance:eggs}

One caveat: Since this makes use of symlinks, it of course won't work on a filesystem that doesn't support symlinks, such as Windows'.

Correction

Posted by Sidnei da Silva at March 11, 2008 - 06:14
Windows *does* support Symlinks.

For directory symlinks:

http://www.microsoft.com/technet/sysinternals/FileAndDisk/Junction.mspx

For file symlinks:

http://msdn2.microsoft.com/en-us/library/aa363860(VS.85).aspx

Re: Correction

Posted by David Glick at March 11, 2008 - 07:41
Thanks for the correction, Sidnei.

Does python's os.symlink function handle Windows symlinks properly? Its docs say "Availability: Unix," which was what misled me originally.

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: