[Checkins] SVN: zc.buildout/branches/gary-6/src/zc/buildout/ add test for recent fix for buildout
Gary Poster
gary.poster at canonical.com
Wed Feb 24 16:40:08 EST 2010
Log message for revision 109421:
add test for recent fix for buildout
Changed:
U zc.buildout/branches/gary-6/src/zc/buildout/buildout.py
U zc.buildout/branches/gary-6/src/zc/buildout/testing.py
U zc.buildout/branches/gary-6/src/zc/buildout/tests.py
-=-
Modified: zc.buildout/branches/gary-6/src/zc/buildout/buildout.py
===================================================================
--- zc.buildout/branches/gary-6/src/zc/buildout/buildout.py 2010-02-24 17:08:33 UTC (rev 109420)
+++ zc.buildout/branches/gary-6/src/zc/buildout/buildout.py 2010-02-24 21:40:07 UTC (rev 109421)
@@ -392,7 +392,8 @@
ws = pkg_resources.WorkingSet(entries)
ws.require('zc.buildout')
partsdir = os.path.join(options['parts-directory'], 'buildout')
- os.mkdir(partsdir)
+ if not os.path.exists(partsdir):
+ os.mkdir(partsdir)
zc.buildout.easy_install.sitepackage_safe_scripts(
options['bin-directory'], ws, options['executable'], partsdir,
reqs=['zc.buildout'])
@@ -565,7 +566,7 @@
if installed_files is None:
self._logger.warning(
"The %s install returned None. A path or "
- "iterable os paths should be returned.",
+ "iterable of paths should be returned.",
part)
installed_files = ()
elif isinstance(installed_files, str):
Modified: zc.buildout/branches/gary-6/src/zc/buildout/testing.py
===================================================================
--- zc.buildout/branches/gary-6/src/zc/buildout/testing.py 2010-02-24 17:08:33 UTC (rev 109420)
+++ zc.buildout/branches/gary-6/src/zc/buildout/testing.py 2010-02-24 21:40:07 UTC (rev 109421)
@@ -244,7 +244,7 @@
for name, value in values.items():
getattr(zc.buildout.easy_install, name)(value)
-def make_buildout():
+def make_buildout(executable=None):
"""Make a buildout that uses this version of zc.buildout."""
# Create a basic buildout.cfg to avoid a warning from buildout.
open('buildout.cfg', 'w').write(
@@ -254,13 +254,16 @@
# a Buildout will force the Buildout's defaults on the installer).
installer_values = get_installer_values()
# Use the buildout bootstrap command to create a buildout
+ config = [
+ ('buildout', 'log-level', 'WARNING'),
+ # trick bootstrap into putting the buildout develop egg
+ # in the eggs dir.
+ ('buildout', 'develop-eggs-directory', 'eggs'),
+ ]
+ if executable is not None:
+ config.append(('buildout', 'executable', executable))
zc.buildout.buildout.Buildout(
- 'buildout.cfg',
- [('buildout', 'log-level', 'WARNING'),
- # trick bootstrap into putting the buildout develop egg
- # in the eggs dir.
- ('buildout', 'develop-eggs-directory', 'eggs'),
- ],
+ 'buildout.cfg', config,
user_defaults=False,
).bootstrap([])
# Create the develop-eggs dir, which didn't get created the usual
Modified: zc.buildout/branches/gary-6/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/branches/gary-6/src/zc/buildout/tests.py 2010-02-24 17:08:33 UTC (rev 109420)
+++ zc.buildout/branches/gary-6/src/zc/buildout/tests.py 2010-02-24 21:40:07 UTC (rev 109421)
@@ -2254,6 +2254,94 @@
"""
+def bootstrap_makes_buildout_that_works_with_system_python():
+ """
+In order to work smoothly with a system Python, bootstrapping creates
+the buildout script with
+zc.buildout.easy_install.sitepackage_safe_scripts. If it did not, a
+variety of problems might happen. For instance, if another version of
+buildout or setuptools is installed in the site-packages than is
+desired, it may cause a problem.
+
+A problem actually experienced in the field is when
+a recipe wants a different version of a dependency that is installed in
+site-packages. We will create a similar situation, and show that it is now
+handled.
+
+First let's write a dummy recipe.
+
+ >>> mkdir(sample_buildout, 'recipes')
+ >>> write(sample_buildout, 'recipes', 'dummy.py',
+ ... '''
+ ... import logging, os, zc.buildout
+ ...
+ ... class Dummy:
+ ...
+ ... def __init__(self, buildout, name, options):
+ ... pass
+ ...
+ ... def install(self):
+ ... return ()
+ ...
+ ... def update(self):
+ ... pass
+ ... ''')
+ >>> write(sample_buildout, 'recipes', 'setup.py',
+ ... '''
+ ... from setuptools import setup
+ ...
+ ... setup(
+ ... name = "recipes",
+ ... entry_points = {'zc.buildout': ['dummy = dummy:Dummy']},
+ ... install_requires = 'demoneeded==1.2c1',
+ ... )
+ ... ''')
+ >>> write(sample_buildout, 'recipes', 'README.txt', " ")
+
+Now we'll try to use it with a Python that has a different version of
+demoneeded installed.
+
+ >>> py_path, site_packages_path = make_py()
+ >>> create_sample_sys_install(site_packages_path)
+ >>> rmdir('develop-eggs')
+ >>> from zc.buildout.testing import make_buildout
+ >>> make_buildout(executable=py_path)
+ >>> write(sample_buildout, 'buildout.cfg',
+ ... '''
+ ... [buildout]
+ ... develop = recipes
+ ... parts = dummy
+ ... find-links = %(link_server)s
+ ... executable = %(py_path)s
+ ...
+ ... [dummy]
+ ... recipe = recipes:dummy
+ ... ''' % globals())
+
+Now we actually run the buildout. Before the change, we got the following
+error:
+
+ Develop: '/sample-buildout/recipes'
+ While:
+ Installing.
+ Getting section dummy.
+ Initializing section dummy.
+ Installing recipe recipes.
+ Error: There is a version conflict.
+ We already have: demoneeded 1.1
+ but recipes 0.0.0 requires 'demoneeded==1.2c1'.
+
+Now, it is handled smoothly.
+
+ >>> print system(buildout)
+ Develop: '/sample-buildout/recipes'
+ Getting distribution for 'demoneeded==1.2c1'.
+ Got demoneeded 1.2c1.
+ Installing dummy.
+ <BLANKLINE>
+
+ """
+
if sys.version_info > (2, 4):
def test_exit_codes():
"""
More information about the checkins
mailing list