Distribute Support
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

::

    >>> globals().update(layer['globs'])


If we are in distribute mode, it would significate that distribute is installed and is available on sys.path.
If so, we detect that and we will just install distribute rather than setuptools if any requirement wants setuptools.
And even if the version is fixed.
::

    >>> data = """
    ... [buildout]
    ... versions = versions
    ... eggs-directory =${buildout:directory}/eggs
    ... index=%(index)s
    ... parts = part
    ...         s
    ... [part]
    ... recipe=minitage.recipe.egg
    ... eggs = virtualenv
    ... [s]
    ... recipe=minitage.recipe.scripts
    ... eggs = virtualenv
    ... [versions]
    ... """ % bsettings
    >>> touch('buildout.cfg', data=data)

Running buildout with distribute to see that it's picked.
::

    >>> sh('bin/buildout -vvvvvv install part s')
    bin/buildout...
    minitage.recipe: Using distribute!...

.. not tested anymore as setuptools is no more supported by upstream buildout

..   Using setuptools, whereas it has its flaws, is supported also.
..
..   A little boilerplate to make a environment with setuptools.
..   ::
..
..       >>> sh('bin/virtualenv venv --no-site-packages')
..       b...
..       setuptools...
..       >>> n = os.remove('bin/buildout')
..       >>> recipe_location = pkg_resources.working_set.find(pkg_resources.Requirement.parse('minitage.recipe.egg')).location
..       >>> cwd = os.getcwd()
..       >>> os.chdir('%s/..' % recipe_location)
..       >>> sh('%s/venv/bin/python setup.py develop' % cwd)
..       /...
..       >>> os.chdir(cwd)
..       >>> n = [shutil.rmtree(os.path.join('eggs', d))
..       ... for d in os.listdir('eggs')
..       ... if os.path.isdir(os.path.join('eggs', d))]
..
..   Running buildout with setuptools to see that it's picked.
..   ::
..
..       >>> sh('venv/bin/python bootstrap.py')
..       venv/bin/python bootstrap.py
..       Generated script '/tmp/buildout.test/bin/buildout'...
..       >>> ret = os.listdir('eggs');ret.sort();ret
..       ['setuptools...', 'zc.buildout...']
..       >>> data = """
..       ... [buildout]
..       ... versions = versions
..       ... eggs-directory =${buildout:directory}/eggs
..       ... index=%(index)s
..       ... download-cache=${buildout:directory}/d
..       ... parts = part
..       ... [part]
..       ... recipe=minitage.recipe.egg
..       ... eggs = virtualenv
..       ... [versions]
..       ... zc.buildout = 1.3.0
..       ... """ % bsettings
..       >>> touch('buildout.cfg', data=data)
..       >>> install_develop_eggs(['minitage.recipe.egg'])
..       >>> sh('bin/buildout -vvvvvv install part')
..       bin/buildout -vvvvvv install part...
..       minitage.recipe: Using setuptools!...
..
