Package: z3c.recipe.eggbasket
Change history0.4.3 (2009-09-15)Stop using an API internal to zc.buildout for retrieving versions
information. This fixes breakage with the latest buildout version.0.4.2 (2009-06-09)Made the automated tests work when running bin/test.Fixed Windows problem: sometimes on Windows temporary dirs/files
cannot be removed while installing. Now a warning is issued and the
process continues. Fix contributed by Ben Dadsetan.https://bugs.launchpad.net/grok/+bug/362833Fixed another annoyance with duplicate output lines.https://bugs.launchpad.net/grok/+bug/321178When the download-cache has been set in buildout.cfg or in
.buildout/default.cfg in the user’s home directory, download the
tarball there and do not throw it away afterwards.Fixed an issue with Windows interaction in the urllib module.https://bugs.launchpad.net/grok/+bug/362833Fixed minor doctest issue where the expected output order
was not respected on Mac.0.4.1 (2009-01-12)Fixed temp dir removal error on Windows (fix makes the code saner
for other systems too).  Fixeshttps://bugs.launchpad.net/grok/+bug/315227Windows compatibility fix: use'wb'for writing to make downloading
of the egg tarball succeeds on Windows.0.4.0 (2008-09-22)When the download fails, do not say “Continuing with buildout
instead” as the downloader just exits then and it is up to the
calling code or the user to continue the buildout if so wished.
[maurits]When installing the requirements from the tarball, we now look in
the default index (python cheese shop usually) when the requirements
can not be met by only the tarball.  This should not happen, but it
does.  [maurits]0.3.1 (2008-07-13)Got rid of annyoing “Unused options for basket: url” warning.0.3.0 (2008-05-30)Now also downloading extra Windows specific eggs when creating the
tarball, as long as they are on the cheese shop.  [maurits]0.2.0 (2008-05-22)Created script around create_source_tarball function with the
z3c.recipe.eggbasket:creator recipe.  Removed the releasemaker
console script from setup.py for now as it was not handling command
line arguments (yet).  [maurits]Added function create_source_tarball for creating the kind of source
tarball that we are expecting.  The releasemaker console script
calls this.  [maurits]0.1.0 (2008-05-06)Added tests.  [maurits]Initial implementation.  [maurits, timte]Created recipe with ZopeSkel.  [Grok Team].Detailed DocumentationGoal of this recipeYou have an egg (for examplegrok) that has a lot of dependencies.
Other eggs that it depends on are found on the cheeseshop, on
sourceforge, and perhaps on some more servers.  When even one of these
servers is down, other people (or you yourself) cannot install that
egg.  Or perhaps your egg depends on a specific version of another egg
and that version is removed from the cheeseshop for some bad reason.In other words: there are multiple points of failure.  Interested
users want to try your egg, the install fails because a server is
down, they are disappointed, leave and never come back.The goal of this recipe is to avoid having those multiple points of
failure.  You create a tarball containing all eggs that your egg
depends on.  A package likezc.sourcereleasecan help here, but our
recipe can also create such a tar ball.  Include it in a buildout like
this:[buildout]
parts = bundlemaker

[bundlemaker]
recipe = z3c.recipe.eggbasket:creator
egg = grok
versionfile = http://grok.zope.org/releaseinfo/grok-0.12.cfgAfter you have made that tar ball, you need to upload it somewhere.
In your buildout you point this recipe to your egg and the url of the
tarball, for example like this:[buildout]
parts = eggbasket

[eggbasket]
recipe = z3c.recipe.eggbasket
eggs = grok
url = http://grok.zope.org/releaseinfo/grok-eggs-0.12.tgzThe part using this recipe should usually be the first in line.  What
the recipe then does is install your egg and all its dependencies
using only the eggs found in that tarball.  After that you can let the
rest of the buildout parts do their work.LimitationsThis approach still leaves you with multiple points of failure:the cheeseshop must be up so the end user can install this recipethe server with your tarball must be up.Before buildout calls the install method of this recipe to do the
actual work, all buildout parts are initialized.  This means that
all eggs and dependencies used by all recipes are installed.  This
can already involve a lot of eggs and also multiple points of
failure.  Workaround: you can first explicitly install the part
that uses this recipe.  So with the buildout snippet from above
that would be:bin/buildout install eggbasketSupported optionsThe recipe supports the following options:eggsOne or more eggs that you want to install with a tarball.urlUrl where we can get a tarball that contains the mentioned eggs
and their dependencies.The releasemaker script supports the following options:eggThe main egg that we want to bundle up with its dependencies.
This is required.versionfileConfig file that contains the wanted versions of the main egg and
its dependencies.  An example is the grok version file:http://grok.zope.org/releaseinfo/grok-0.12.cfgThis file is parsed by zc.buildout, so you can for example extend
other files.  And the file can be a url or the name of a file in
the current directory.Example usageWe have a packageorangethat depends on the packagecolour:>>> import os.path
>>> import z3c.recipe.eggbasket.tests as testdir
>>> orange = os.path.join(os.path.dirname(testdir.__file__), 'orange')
>>> colour = os.path.join(os.path.dirname(testdir.__file__), 'colour')We create source distributions for them in a directory:>>> colours = tmpdir('colours')
>>> sdist(colour, colours)
>>> sdist(orange, colours)
>>> ls(colours)
-  colour-0.1.zip
-  orange-0.1.zipWe will define a buildout template that uses the recipe:>>> buildout_template = """
... [buildout]
... index = http://pypi.python.org/simple
... parts = basket
...
... [basket]
... recipe = z3c.recipe.eggbasket
... eggs = %(eggs)s
... url = %(url)s
... """We’ll start by creating a buildout that does not specify an egg:>>> write('buildout.cfg', buildout_template % { 'eggs': '', 'url' : 'http://nowhere'})In this case the recipe will do nothing.  So the url does not get
used.  Running the buildout gives us:>>> print 'start..\n', system(buildout)
start..
...
Installing basket.
<BLANKLINE>Next we will specify an egg but refer to a bad url:>>> write('buildout.cfg', buildout_template % { 'eggs': 'orange', 'url' : 'http://nowhere'})
>>> print system(buildout)
Uninstalling basket.
Installing basket.
Couldn't find index page for 'orange' (maybe misspelled?)
Getting distribution for 'orange'.
eggbasket: Not all distributions are installed. A tarball will be downloaded.
eggbasket: Downloading http://nowhere ...
eggbasket: Url not found: http://nowhere.
<BLANKLINE>So now we create a tar ball in a directory:>>> import tarfile
>>> tarserver = tmpdir('tarserver')
>>> cd(tarserver)
>>> tarball = tarfile.open('colours.tgz', 'w:gz')
>>> tarball.add(colours)Note: the order of the next listing is not guaranteed, so there might
be a test failure here:>>> tarball.list(verbose=False)
tmp/tmpDlQSIQbuildoutSetUp/_TEST_/colours/
tmp/tmpDlQSIQbuildoutSetUp/_TEST_/colours/colour-0.1.zip
tmp/tmpDlQSIQbuildoutSetUp/_TEST_/colours/orange-0.1.zip>>> tarball.close()
>>> ls(tarserver)
-  colours.tgzWe make it available on a url and use it in our buildout:>>> cd(sample_buildout)
>>> tarball_url = 'file://' + tarserver + '/colours.tgz'
>>> write('buildout.cfg', buildout_template % { 'eggs': 'orange', 'url' : tarball_url})
>>> print system(buildout)
Uninstalling basket.
Installing basket.
Couldn't find index page for 'orange' (maybe misspelled?)
Getting distribution for 'orange'.
eggbasket: Not all distributions are installed. A tarball will be downloaded.
eggbasket: Downloading /tarserver/colours.tgz ...
eggbasket: Finished downloading.
eggbasket: Extracting tarball contents...
eggbasket: Installing eggs to /sample-buildout/eggs which will take a while...
Getting distribution for 'orange'.
Got orange 0.1.
Getting distribution for 'colour'.
Got colour 0.1.
<BLANKLINE>ContributorsGrok Team:Maurits van Rees
Tim TerlegardDownload