Commit 9a7275e3 authored by Jim Fulton's avatar Jim Fulton

- buildout changes to the buildout directory before running recipe

  install and update methods.

- 59270: Buggy recipes can cause failures in later recipes via chdir

Also updated a test to reflect logging of script installation.
parent 7d35bb8d
......@@ -11,6 +11,20 @@ priorities include:
Change History
**************
1.0.0b25 (2007-05-??)
=====================
Feature Changes
---------------
- buildout changes to the buildout directory before running recipe
install and update methods.
Bugs Fixed
----------
- 59270: Buggy recipes can cause failures in later recipes via chdir
1.0.0b24 (2007-05-09)
=====================
......
......@@ -35,7 +35,7 @@ open('doc.txt', 'w').write(long_description)
name = "zc.buildout"
setup(
name = name,
version = "1.0.0b24",
version = "1.0.0b25",
author = "Jim Fulton",
author_email = "jim@zope.com",
description = "System for managing development buildouts",
......
......@@ -172,6 +172,8 @@ class Buildout(UserDict.DictMixin):
for name in _buildout_default_options:
options[name]
os.chdir(options['directory'])
def _buildout_path(self, *names):
return os.path.join(self._buildout_dir, *names)
......@@ -923,9 +925,11 @@ class Options(UserDict.DictMixin):
return result
def _call(self, f):
buildout_directory = self.buildout['buildout']['directory']
self._created = []
try:
try:
os.chdir(buildout_directory)
return f()
except:
for p in self._created:
......@@ -938,6 +942,7 @@ class Options(UserDict.DictMixin):
raise
finally:
self._created = None
os.chdir(buildout_directory)
def created(self, *paths):
try:
......
......@@ -584,6 +584,7 @@ if os.path.exists(bootstrap_py):
buildout: Creating directory ...parts
buildout: Creating directory ...eggs
buildout: Creating directory ...develop-eggs
zc.buildout.easy_install: Generated script /sample/bin/buildout.
>>> ls(sample_buildout)
d bin
......@@ -1984,6 +1985,57 @@ if sys.version_info > (2, 4):
"""
def bug_59270_recipes_always_start_in_buildout_dir():
"""
Recipes can rely on running from buildout directory
>>> mkdir('bad_start')
>>> write('bad_recipe.py',
... '''
... import os
... class Bad:
... def __init__(self, *_):
... print os.getcwd()
... def install(self):
... print os.getcwd()
... os.chdir('bad_start')
... print os.getcwd()
... return ()
... ''')
>>> write('setup.py',
... '''
... from setuptools import setup
... setup(name='bad.test',
... entry_points={'zc.buildout': ['default=bad_recipe:Bad']},)
... ''')
>>> write('buildout.cfg',
... '''
... [buildout]
... develop = .
... parts = b1 b2
... [b1]
... recipe = bad.test
... [b2]
... recipe = bad.test
... ''')
>>> os.chdir('bad_start')
>>> print system(join(sample_buildout, 'bin', 'buildout')
... +' -c '+join(sample_buildout, 'buildout.cfg')),
buildout: Develop: /tmp/tmpV9ptXUbuildoutSetUp/_TEST_/sample-buildout/.
/sample-buildout
/sample-buildout
buildout: Installing b1
/sample-buildout
/sample-buildout/bad_start
buildout: Installing b2
/sample-buildout
/sample-buildout/bad_start
"""
######################################################################
......
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