Commit b84faf54 authored by jim's avatar jim

Separated the eggs and develop-eggs directories to allow eggs to be

shared across projects or working directories.


git-svn-id: http://svn.zope.org/repos/main/zc.buildout/trunk@68707 62d5b8a3-27da-0310-9561-8e5933582275
parent d9481ed7
......@@ -39,6 +39,7 @@ class Egg:
options['_b'] = buildout['buildout']['bin-directory']
options['_e'] = buildout['buildout']['eggs-directory']
options['_d'] = buildout['buildout']['develop-eggs-directory']
def install(self):
options = self.options
......@@ -56,5 +57,5 @@ class Egg:
])
return zc.buildout.egglinker.scripts(
[distribution],
options['_b'], [options['_e']], scripts=scripts)
options['_b'], [options['_d'], options['_e']], scripts=scripts)
......@@ -68,6 +68,7 @@ class Buildout(dict):
data = dict(buildout={
'directory': os.path.dirname(config_file),
'eggs-directory': 'eggs',
'develop-eggs-directory': 'develop-eggs',
'bin-directory': 'bin',
'parts-directory': 'parts',
'installed': '.installed.cfg',
......@@ -116,7 +117,7 @@ class Buildout(dict):
self._links = links and links.split() or ()
self._buildout_dir = options['directory']
for name in ('bin', 'parts', 'eggs'):
for name in ('bin', 'parts', 'eggs', 'develop-eggs'):
d = self._buildout_path(options[name+'-directory'])
options[name+'-directory'] = d
......@@ -166,12 +167,16 @@ class Buildout(dict):
def install(self, install_parts):
# Create buildout directories
for name in ('bin', 'parts', 'eggs'):
for name in ('bin', 'parts', 'eggs', 'develop-eggs'):
d = self['buildout'][name+'-directory']
if not os.path.exists(d):
self._logger.info('Creating directory %s', d)
os.mkdir(d)
# Add develop-eggs directory to path so that it gets searched
# for eggs:
sys.path.insert(0, self['buildout']['develop-eggs-directory'])
# Build develop eggs
self._develop()
......@@ -259,7 +264,7 @@ class Buildout(dict):
os.P_WAIT, sys.executable, sys.executable,
setup, '-q', 'develop', '-m', '-x',
'-f', ' '.join(self._links),
'-d', self['buildout']['eggs-directory'],
'-d', self['buildout']['develop-eggs-directory'],
{'PYTHONPATH':
os.path.dirname(pkg_resources.__file__)},
)
......@@ -269,6 +274,8 @@ class Buildout(dict):
def _load_recipes(self, parts):
recipes = {}
recipes_requirements = []
pkg_resources.working_set.add_entry(
self['buildout']['develop-eggs-directory'])
pkg_resources.working_set.add_entry(self['buildout']['eggs-directory'])
# Install the recipe distros
......
......@@ -32,14 +32,15 @@ installs setuptools and zc.buildout into the checkout as well as any
parts defined.
We have a sample buildout that has already been created for us. It
has the absolute minimum information. We have bin, eggs and parts
directories, a configuration file, and an .installed,cfg that contains
informatiion about previously-installed parts:
has the absolute minimum information. We have bin, develop-eggs, eggs
and parts directories, a configuration file, and an .installed,cfg
that contains informatiion about previously-installed parts:
>>> ls(sample_buildout)
- .installed.cfg
d bin
- buildout.cfg
d develop-eggs
d eggs
d parts
......@@ -53,11 +54,20 @@ but the zc.buildout and setuptools eggs actually live elsewhere.
>>> ls(sample_buildout, 'eggs')
The parts directory is initially empty:
The develop-eggs and parts directories are initially empty:
>>> ls(sample_buildout, 'develop-eggs')
>>> ls(sample_buildout, 'parts')
The parts directory provides an area where recipies can install
The develop-eggs directory holds egg links for software being
developed in the buildout. We separate develop-eggs and other eggs to
allow eggs directories to be shared accross multiple buildouts. For
example, a common developer technique is to define a common eggs
directory in their home that all non-develop eggs are stored in. This
allows larger buildouts to be set up much more quickly and saves disk
space.
The parts directory provides an area where recipes can install
part data. For example, if we built a custom Python, we would
install it in the part directory. Part data is stored in a
subdirectory of the parts directory with the same name as the part.
......@@ -266,6 +276,7 @@ We see that the recipe created the directory, as expected:
- .installed.cfg
d bin
- buildout.cfg
d develop-eggs
d eggs
d mystuff
d parts
......@@ -313,6 +324,7 @@ we'll see that the directory gets removed and recreated:
- .installed.cfg
d bin
- buildout.cfg
d develop-eggs
d eggs
d mydata
d parts
......@@ -757,6 +769,7 @@ the buildout in the usual way:
d d1
d d2
d d3
d develop-eggs
- e1.cfg
d eggs
d parts
......@@ -838,6 +851,7 @@ and run the buildout specifying just d2 and d3:
d d2
d data3
d data4
d develop-eggs
- e1.cfg
d eggs
d parts
......@@ -917,6 +931,7 @@ also see that d1 and d2 have gone away:
d data2
d data3
d data4
d develop-eggs
- e1.cfg
d eggs
d parts
......@@ -936,10 +951,12 @@ provide alternate locations, and even names for these directories.
... [buildout]
... develop = recipes
... parts =
... develop-eggs-directory = %(developbasket)s
... eggs-directory = %(basket)s
... bin-directory = %(scripts)s
... parts-directory = %(work)s
... """ % dict(
... developbasket = os.path.join(alt, 'developbasket'),
... basket = os.path.join(alt, 'basket'),
... scripts = os.path.join(alt, 'scripts'),
... work = os.path.join(alt, 'work'),
......@@ -949,6 +966,7 @@ provide alternate locations, and even names for these directories.
buildout: Creating directory /tmp/sample-alt/scripts
buildout: Creating directory /tmp/sample-alt/work
buildout: Creating directory /tmp/sample-alt/basket
buildout: Creating directory /sample-alt/developbasket
buildout: Running /tmp/sample-buildout/recipes/setup.py -q develop ...
buildout: Uninstalling d4
buildout: Uninstalling d3
......@@ -957,10 +975,11 @@ provide alternate locations, and even names for these directories.
>>> ls(alt)
d basket
d developbasket
d scripts
d work
>>> ls(alt, 'basket')
>>> ls(alt, 'developbasket')
- recipes.egg-link
>>> import shutil
......@@ -985,15 +1004,17 @@ You can also specify an alternate buildout directory:
buildout: Creating directory /tmp/sample-alt/bin
buildout: Creating directory /tmp/sample-alt/parts
buildout: Creating directory /tmp/sample-alt/eggs
buildout: Creating directory /tmp/sample-alt/develop-eggs
buildout: Running /tmp/sample-buildout/recipes/setup.py -q develop ...
>>> ls(alt)
- .installed.cfg
d bin
d develop-eggs
d eggs
d parts
>>> ls(alt, 'eggs')
>>> ls(alt, 'develop-eggs')
- recipes.egg-link
>>> import shutil
......
......@@ -54,7 +54,7 @@ def system(command, input=''):
def buildoutSetUp(test):
sample = tempfile.mkdtemp('sample-buildout')
for name in ('bin', 'eggs', 'parts'):
for name in ('bin', 'eggs', 'develop-eggs', 'parts'):
os.mkdir(os.path.join(sample, name))
# make sure we can import zc.buildout and setuptools
......
......@@ -29,6 +29,7 @@ class TestRunner:
options.get('script', self.name),
)
options['_e'] = buildout['buildout']['eggs-directory']
options['_d'] = buildout['buildout']['develop-eggs-directory']
def install(self):
......@@ -39,10 +40,11 @@ class TestRunner:
]
path = zc.buildout.egglinker.path(
distributions+['zope.testing'],
[self.options['_e']],
[self.options['_d'], self.options['_e']],
)
locations = [zc.buildout.egglinker.location(distribution,
[self.options['_e']])
locations = [zc.buildout.egglinker.location(
distribution,
[self.options['_d'], self.options['_e']])
for distribution in distributions]
script = self.options['script']
open(script, 'w').write(tests_template % dict(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment