/src/zc/buildout/tests.py
Python | 3306 lines | 3265 code | 21 blank | 20 comment | 10 complexity | 17f211f52168eb2f48e7f7461bf54ebf MD5 | raw file
Possible License(s): GPL-2.0
Large files files are truncated, but you can click here to view the full file
- ##############################################################################
- #
- # Copyright (c) 2004-2009 Zope Foundation and Contributors.
- # All Rights Reserved.
- #
- # This software is subject to the provisions of the Zope Public License,
- # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
- # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
- # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
- # FOR A PARTICULAR PURPOSE.
- #
- ##############################################################################
- from zc.buildout.buildout import print_
- from zope.testing import renormalizing
- import doctest
- import manuel.capture
- import manuel.doctest
- import manuel.testing
- import os
- import pkg_resources
- import re
- import shutil
- import sys
- import tempfile
- import unittest
- import zc.buildout.easy_install
- import zc.buildout.testing
- import zipfile
- os_path_sep = os.path.sep
- if os_path_sep == '\\':
- os_path_sep *= 2
- def develop_w_non_setuptools_setup_scripts():
- """
- We should be able to deal with setup scripts that aren't setuptools based.
- >>> mkdir('foo')
- >>> write('foo', 'setup.py',
- ... '''
- ... from distutils.core import setup
- ... setup(name="foo")
- ... ''')
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... develop = foo
- ... parts =
- ... ''')
- >>> print_(system(join('bin', 'buildout')), end='')
- Develop: '/sample-buildout/foo'
- >>> ls('develop-eggs')
- - foo.egg-link
- - zc.recipe.egg.egg-link
- """
- def develop_verbose():
- """
- We should be able to deal with setup scripts that aren't setuptools based.
- >>> mkdir('foo')
- >>> write('foo', 'setup.py',
- ... '''
- ... from setuptools import setup
- ... setup(name="foo")
- ... ''')
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... develop = foo
- ... parts =
- ... ''')
- >>> print_(system(join('bin', 'buildout')+' -vv'), end='')
- ... # doctest: +ELLIPSIS
- Installing...
- Develop: '/sample-buildout/foo'
- ...
- Installed /sample-buildout/foo
- ...
- >>> ls('develop-eggs')
- - foo.egg-link
- - zc.recipe.egg.egg-link
- >>> print_(system(join('bin', 'buildout')+' -vvv'), end='')
- ... # doctest: +ELLIPSIS
- Installing...
- Develop: '/sample-buildout/foo'
- in: '/sample-buildout/foo'
- ... -q develop -mxN -d /sample-buildout/develop-eggs/...
- """
- def buildout_error_handling():
- r"""Buildout error handling
- Asking for a section that doesn't exist, yields a missing section error:
- >>> import os
- >>> os.chdir(sample_buildout)
- >>> import zc.buildout.buildout
- >>> buildout = zc.buildout.buildout.Buildout('buildout.cfg', [])
- >>> buildout['eek']
- Traceback (most recent call last):
- ...
- MissingSection: The referenced section, 'eek', was not defined.
- Asking for an option that doesn't exist, a MissingOption error is raised:
- >>> buildout['buildout']['eek']
- Traceback (most recent call last):
- ...
- MissingOption: Missing option: buildout:eek
- It is an error to create a variable-reference cycle:
- >>> write(sample_buildout, 'buildout.cfg',
- ... '''
- ... [buildout]
- ... parts =
- ... x = ${buildout:y}
- ... y = ${buildout:z}
- ... z = ${buildout:x}
- ... ''')
- >>> print_(system(os.path.join(sample_buildout, 'bin', 'buildout')),
- ... end='')
- ... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
- While:
- Initializing.
- Getting section buildout.
- Initializing section buildout.
- Getting option buildout:x.
- Getting option buildout:y.
- Getting option buildout:z.
- Getting option buildout:x.
- Error: Circular reference in substitutions.
- It is an error to use funny characters in variable refereces:
- >>> write(sample_buildout, 'buildout.cfg',
- ... '''
- ... [buildout]
- ... develop = recipes
- ... parts = data_dir debug
- ... x = ${bui$ldout:y}
- ... ''')
- >>> print_(system(os.path.join(sample_buildout, 'bin', 'buildout')),
- ... end='')
- While:
- Initializing.
- Getting section buildout.
- Initializing section buildout.
- Getting option buildout:x.
- Error: The section name in substitution, ${bui$ldout:y},
- has invalid characters.
- >>> write(sample_buildout, 'buildout.cfg',
- ... '''
- ... [buildout]
- ... develop = recipes
- ... parts = data_dir debug
- ... x = ${buildout:y{z}
- ... ''')
- >>> print_(system(os.path.join(sample_buildout, 'bin', 'buildout')),
- ... end='')
- While:
- Initializing.
- Getting section buildout.
- Initializing section buildout.
- Getting option buildout:x.
- Error: The option name in substitution, ${buildout:y{z},
- has invalid characters.
- and too have too many or too few colons:
- >>> write(sample_buildout, 'buildout.cfg',
- ... '''
- ... [buildout]
- ... develop = recipes
- ... parts = data_dir debug
- ... x = ${parts}
- ... ''')
- >>> print_(system(os.path.join(sample_buildout, 'bin', 'buildout')),
- ... end='')
- While:
- Initializing.
- Getting section buildout.
- Initializing section buildout.
- Getting option buildout:x.
- Error: The substitution, ${parts},
- doesn't contain a colon.
- >>> write(sample_buildout, 'buildout.cfg',
- ... '''
- ... [buildout]
- ... develop = recipes
- ... parts = data_dir debug
- ... x = ${buildout:y:z}
- ... ''')
- >>> print_(system(os.path.join(sample_buildout, 'bin', 'buildout')),
- ... end='')
- While:
- Initializing.
- Getting section buildout.
- Initializing section buildout.
- Getting option buildout:x.
- Error: The substitution, ${buildout:y:z},
- has too many colons.
- Al parts have to have a section:
- >>> write(sample_buildout, 'buildout.cfg',
- ... '''
- ... [buildout]
- ... parts = x
- ... ''')
- >>> print_(system(os.path.join(sample_buildout, 'bin', 'buildout')),
- ... end='')
- While:
- Installing.
- Getting section x.
- Error: The referenced section, 'x', was not defined.
- and all parts have to have a specified recipe:
- >>> write(sample_buildout, 'buildout.cfg',
- ... '''
- ... [buildout]
- ... parts = x
- ...
- ... [x]
- ... foo = 1
- ... ''')
- >>> print_(system(os.path.join(sample_buildout, 'bin', 'buildout')),
- ... end='')
- While:
- Installing.
- Error: Missing option: x:recipe
- """
- make_dist_that_requires_setup_py_template = """
- from setuptools import setup
- setup(name=%r, version=%r,
- install_requires=%r,
- )
- """
- def make_dist_that_requires(dest, name, requires=[], version=1, egg=''):
- os.mkdir(os.path.join(dest, name))
- open(os.path.join(dest, name, 'setup.py'), 'w').write(
- make_dist_that_requires_setup_py_template
- % (name, version, requires)
- )
- def show_who_requires_when_there_is_a_conflict():
- """
- It's a pain when we require eggs that have requirements that are
- incompatible. We want the error we get to tell us what is missing.
- Let's make a few develop distros, some of which have incompatible
- requirements.
- >>> make_dist_that_requires(sample_buildout, 'sampley',
- ... ['demoneeded ==1.0'])
- >>> make_dist_that_requires(sample_buildout, 'samplez',
- ... ['demoneeded ==1.1'])
- Now, let's create a buildout that requires y and z:
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... parts = eggs
- ... develop = sampley samplez
- ... find-links = %(link_server)s
- ...
- ... [eggs]
- ... recipe = zc.recipe.egg
- ... eggs = sampley
- ... samplez
- ... ''' % globals())
- >>> print_(system(buildout), end='')
- Develop: '/sample-buildout/sampley'
- Develop: '/sample-buildout/samplez'
- Installing eggs.
- Getting distribution for 'demoneeded==1.1'.
- Got demoneeded 1.1.
- While:
- Installing eggs.
- Error: There is a version conflict.
- We already have: demoneeded 1.1
- but sampley 1 requires 'demoneeded==1.0'.
- Here, we see that sampley required an older version of demoneeded. What
- if we hadn't required sampley ourselves:
- >>> make_dist_that_requires(sample_buildout, 'samplea', ['sampleb'])
- >>> make_dist_that_requires(sample_buildout, 'sampleb',
- ... ['sampley', 'samplea'])
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... parts = eggs
- ... develop = sampley samplez samplea sampleb
- ... find-links = %(link_server)s
- ...
- ... [eggs]
- ... recipe = zc.recipe.egg
- ... eggs = samplea
- ... samplez
- ... ''' % globals())
- If we use the verbose switch, we can see where requirements are coming from:
- >>> print_(system(buildout+' -v'), end='') # doctest: +ELLIPSIS
- Installing 'zc.buildout >=1.99', 'distribute'.
- We have a develop egg: zc.buildout 1.0.0
- We have the best distribution that satisfies 'distribute'.
- Picked: distribute = 0.6
- Develop: '/sample-buildout/sampley'
- Develop: '/sample-buildout/samplez'
- Develop: '/sample-buildout/samplea'
- Develop: '/sample-buildout/sampleb'
- ...Installing eggs.
- Installing 'samplea', 'samplez'.
- We have a develop egg: samplea 1
- We have a develop egg: samplez 1
- Getting required 'demoneeded==1.1'
- required by samplez 1.
- We have the distribution that satisfies 'demoneeded==1.1'.
- Getting required 'sampleb'
- required by samplea 1.
- We have a develop egg: sampleb 1
- Getting required 'sampley'
- required by sampleb 1.
- We have a develop egg: sampley 1
- While:
- Installing eggs.
- Error: There is a version conflict.
- We already have: demoneeded 1.1
- but sampley 1 requires 'demoneeded==1.0'.
- """
- def show_who_requires_missing_distributions():
- """
- When working with a lot of eggs, which require eggs recursively, it
- can be hard to tell why we're requiring things we can't
- find. Fortunately, buildout will tell us who's asking for something
- that we can't find. when run in verbose mode
- >>> make_dist_that_requires(sample_buildout, 'sampley', ['demoneeded'])
- >>> make_dist_that_requires(sample_buildout, 'samplea', ['sampleb'])
- >>> make_dist_that_requires(sample_buildout, 'sampleb',
- ... ['sampley', 'samplea'])
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... parts = eggs
- ... develop = sampley samplea sampleb
- ...
- ... [eggs]
- ... recipe = zc.recipe.egg
- ... eggs = samplea
- ... ''')
- >>> print_(system(buildout+' -v'), end='') # doctest: +ELLIPSIS
- Installing ...
- Installing 'samplea'.
- We have a develop egg: samplea 1
- Getting required 'sampleb'
- required by samplea 1.
- We have a develop egg: sampleb 1
- Getting required 'sampley'
- required by sampleb 1.
- We have a develop egg: sampley 1
- Getting required 'demoneeded'
- required by sampley 1.
- We have no distributions for demoneeded that satisfies 'demoneeded'.
- ...
- While:
- Installing eggs.
- Getting distribution for 'demoneeded'.
- Error: Couldn't find a distribution for 'demoneeded'.
- """
- def test_comparing_saved_options_with_funny_characters():
- """
- If an option has newlines, extra/odd spaces or a %, we need to make sure
- the comparison with the saved value works correctly.
- >>> mkdir(sample_buildout, 'recipes')
- >>> write(sample_buildout, 'recipes', 'debug.py',
- ... '''
- ... class Debug:
- ... def __init__(self, buildout, name, options):
- ... options['debug'] = \"\"\" <zodb>
- ...
- ... <filestorage>
- ... path foo
- ... </filestorage>
- ...
- ... </zodb>
- ... \"\"\"
- ... options['debug1'] = \"\"\"
- ... <zodb>
- ...
- ... <filestorage>
- ... path foo
- ... </filestorage>
- ...
- ... </zodb>
- ... \"\"\"
- ... options['debug2'] = ' x '
- ... options['debug3'] = '42'
- ... options['format'] = '%3d'
- ...
- ... def install(self):
- ... open('t', 'w').write('t')
- ... return 't'
- ...
- ... update = install
- ... ''')
- >>> write(sample_buildout, 'recipes', 'setup.py',
- ... '''
- ... from setuptools import setup
- ... setup(
- ... name = "recipes",
- ... entry_points = {'zc.buildout': ['default = debug:Debug']},
- ... )
- ... ''')
- >>> write(sample_buildout, 'recipes', 'README.txt', " ")
- >>> write(sample_buildout, 'buildout.cfg',
- ... '''
- ... [buildout]
- ... develop = recipes
- ... parts = debug
- ...
- ... [debug]
- ... recipe = recipes
- ... ''')
- >>> os.chdir(sample_buildout)
- >>> buildout = os.path.join(sample_buildout, 'bin', 'buildout')
- >>> print_(system(buildout), end='')
- Develop: '/sample-buildout/recipes'
- Installing debug.
- If we run the buildout again, we shoudn't get a message about
- uninstalling anything because the configuration hasn't changed.
- >>> print_(system(buildout), end='')
- Develop: '/sample-buildout/recipes'
- Updating debug.
- """
- def finding_eggs_as_local_directories():
- r"""
- It is possible to set up find-links so that we could install from
- a local directory that may contained unzipped eggs.
- >>> src = tmpdir('src')
- >>> write(src, 'setup.py',
- ... '''
- ... from setuptools import setup
- ... setup(name='demo', py_modules=[''],
- ... zip_safe=False, version='1.0', author='bob', url='bob',
- ... author_email='bob')
- ... ''')
- >>> write(src, 't.py', '#\n')
- >>> write(src, 'README.txt', '')
- >>> _ = system(join('bin', 'buildout')+' setup ' + src + ' bdist_egg')
- Install it so it gets unzipped:
- >>> d1 = tmpdir('d1')
- >>> ws = zc.buildout.easy_install.install(
- ... ['demo'], d1, links=[join(src, 'dist')],
- ... )
- >>> ls(d1)
- d demo-1.0-py2.4.egg
- Then try to install it again:
- >>> d2 = tmpdir('d2')
- >>> ws = zc.buildout.easy_install.install(
- ... ['demo'], d2, links=[d1],
- ... )
- >>> ls(d2)
- d demo-1.0-py2.4.egg
- """
- def create_sections_on_command_line():
- """
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... parts =
- ... x = ${foo:bar}
- ... ''')
- >>> print_(system(buildout + ' foo:bar=1 -vv'), end='')
- ... # doctest: +ELLIPSIS
- Installing 'zc.buildout >=1.99', 'distribute'.
- ...
- [foo]
- bar = 1
- ...
- """
- def test_help():
- """
- >>> print_(system(os.path.join(sample_buildout, 'bin', 'buildout')+' -h'))
- ... # doctest: +ELLIPSIS
- Usage: buildout [options] [assignments] [command [command arguments]]
- <BLANKLINE>
- Options:
- <BLANKLINE>
- -h, --help
- ...
- >>> print_(system(os.path.join(sample_buildout, 'bin', 'buildout')
- ... +' --help'))
- ... # doctest: +ELLIPSIS
- Usage: buildout [options] [assignments] [command [command arguments]]
- <BLANKLINE>
- Options:
- <BLANKLINE>
- -h, --help
- ...
- """
- def test_bootstrap_with_extension():
- """
- We had a problem running a bootstrap with an extension. Let's make
- sure it is fixed. Basically, we don't load extensions when
- bootstrapping.
- >>> d = tmpdir('sample-bootstrap')
- >>> write(d, 'buildout.cfg',
- ... '''
- ... [buildout]
- ... extensions = some_awsome_extension
- ... parts =
- ... ''')
- >>> os.chdir(d)
- >>> print_(system(os.path.join(sample_buildout, 'bin', 'buildout')
- ... + ' bootstrap'), end='')
- Creating directory '/sample-bootstrap/bin'.
- Creating directory '/sample-bootstrap/parts'.
- Creating directory '/sample-bootstrap/eggs'.
- Creating directory '/sample-bootstrap/develop-eggs'.
- Generated script '/sample-bootstrap/bin/buildout'.
- """
- def bug_92891_bootstrap_crashes_with_egg_recipe_in_buildout_section():
- """
- >>> d = tmpdir('sample-bootstrap')
- >>> write(d, 'buildout.cfg',
- ... '''
- ... [buildout]
- ... parts = buildout
- ... eggs-directory = eggs
- ...
- ... [buildout]
- ... recipe = zc.recipe.egg
- ... eggs = zc.buildout
- ... scripts = buildout=buildout
- ... ''')
- >>> os.chdir(d)
- >>> print_(system(os.path.join(sample_buildout, 'bin', 'buildout')
- ... + ' bootstrap'), end='')
- Creating directory '/sample-bootstrap/bin'.
- Creating directory '/sample-bootstrap/parts'.
- Creating directory '/sample-bootstrap/eggs'.
- Creating directory '/sample-bootstrap/develop-eggs'.
- Generated script '/sample-bootstrap/bin/buildout'.
- >>> print_(system(os.path.join('bin', 'buildout')), end='')
- Unused options for buildout: 'scripts' 'eggs'.
- """
- def removing_eggs_from_develop_section_causes_egg_link_to_be_removed():
- '''
- >>> cd(sample_buildout)
- Create a develop egg:
- >>> mkdir('foo')
- >>> write('foo', 'setup.py',
- ... """
- ... from setuptools import setup
- ... setup(name='foox')
- ... """)
- >>> write('buildout.cfg',
- ... """
- ... [buildout]
- ... develop = foo
- ... parts =
- ... """)
- >>> print_(system(join('bin', 'buildout')), end='')
- Develop: '/sample-buildout/foo'
- >>> ls('develop-eggs')
- - foox.egg-link
- - zc.recipe.egg.egg-link
- Create another:
- >>> mkdir('bar')
- >>> write('bar', 'setup.py',
- ... """
- ... from setuptools import setup
- ... setup(name='fooy')
- ... """)
- >>> write('buildout.cfg',
- ... """
- ... [buildout]
- ... develop = foo bar
- ... parts =
- ... """)
- >>> print_(system(join('bin', 'buildout')), end='')
- Develop: '/sample-buildout/foo'
- Develop: '/sample-buildout/bar'
- >>> ls('develop-eggs')
- - foox.egg-link
- - fooy.egg-link
- - zc.recipe.egg.egg-link
- Remove one:
- >>> write('buildout.cfg',
- ... """
- ... [buildout]
- ... develop = bar
- ... parts =
- ... """)
- >>> print_(system(join('bin', 'buildout')), end='')
- Develop: '/sample-buildout/bar'
- It is gone
- >>> ls('develop-eggs')
- - fooy.egg-link
- - zc.recipe.egg.egg-link
- Remove the other:
- >>> write('buildout.cfg',
- ... """
- ... [buildout]
- ... parts =
- ... """)
- >>> print_(system(join('bin', 'buildout')), end='')
- All gone
- >>> ls('develop-eggs')
- - zc.recipe.egg.egg-link
- '''
- def add_distribute_to_dependencies_when_namespace_packages():
- '''
- Often, a package depends on distribute soley by virtue of using
- namespace packages. In this situation, package authors often forget to
- declare distribute as a dependency. This is a mistake, but,
- unfortunately, a common one that we need to work around. If an egg
- uses namespace packages and does not include distribute as a depenency,
- we will still include distribute in the working set. If we see this for
- a devlop egg, we will also generate a warning.
- >>> mkdir('foo')
- >>> mkdir('foo', 'src')
- >>> mkdir('foo', 'src', 'stuff')
- >>> write('foo', 'src', 'stuff', '__init__.py',
- ... """__import__('pkg_resources').declare_namespace(__name__)
- ... """)
- >>> mkdir('foo', 'src', 'stuff', 'foox')
- >>> write('foo', 'src', 'stuff', 'foox', '__init__.py', '')
- >>> write('foo', 'setup.py',
- ... """
- ... from setuptools import setup
- ... setup(name='foox',
- ... namespace_packages = ['stuff'],
- ... package_dir = {'': 'src'},
- ... packages = ['stuff', 'stuff.foox'],
- ... )
- ... """)
- >>> write('foo', 'README.txt', '')
- >>> write('buildout.cfg',
- ... """
- ... [buildout]
- ... develop = foo
- ... parts =
- ... """)
- >>> print_(system(join('bin', 'buildout')), end='')
- Develop: '/sample-buildout/foo'
- Now, if we generate a working set using the egg link, we will get a warning
- and we will get distribute included in the working set.
- >>> import logging, zope.testing.loggingsupport
- >>> handler = zope.testing.loggingsupport.InstalledHandler(
- ... 'zc.buildout.easy_install', level=logging.WARNING)
- >>> logging.getLogger('zc.buildout.easy_install').propagate = False
- >>> [dist.project_name
- ... for dist in zc.buildout.easy_install.working_set(
- ... ['foox'], sys.executable,
- ... [join(sample_buildout, 'eggs'),
- ... join(sample_buildout, 'develop-eggs'),
- ... ])]
- ['foox', 'distribute']
- >>> print_(handler)
- zc.buildout.easy_install WARNING
- Develop distribution: foox 0.0.0
- uses namespace packages but the distribution does not require distribute.
- >>> handler.clear()
- On the other hand, if we have a regular egg, rather than a develop egg:
- >>> os.remove(join('develop-eggs', 'foox.egg-link'))
- >>> _ = system(join('bin', 'buildout') + ' setup foo bdist_egg -d'
- ... + join(sample_buildout, 'eggs'))
- >>> ls('develop-eggs')
- - zc.recipe.egg.egg-link
- >>> ls('eggs') # doctest: +ELLIPSIS
- - distribute.eggpyN.N.egg
- - foox-0.0.0-py2.4.egg
- ...
- We do not get a warning, but we do get distribute included in the working set:
- >>> [dist.project_name
- ... for dist in zc.buildout.easy_install.working_set(
- ... ['foox'], sys.executable,
- ... [join(sample_buildout, 'eggs'),
- ... join(sample_buildout, 'develop-eggs'),
- ... ])]
- ['foox', 'distribute']
- >>> print_(handler, end='')
- We get the same behavior if the it is a depedency that uses a
- namespace package.
- >>> mkdir('bar')
- >>> write('bar', 'setup.py',
- ... """
- ... from setuptools import setup
- ... setup(name='bar', install_requires = ['foox'])
- ... """)
- >>> write('bar', 'README.txt', '')
- >>> write('buildout.cfg',
- ... """
- ... [buildout]
- ... develop = foo bar
- ... parts =
- ... """)
- >>> print_(system(join('bin', 'buildout')), end='')
- Develop: '/sample-buildout/foo'
- Develop: '/sample-buildout/bar'
- >>> [dist.project_name
- ... for dist in zc.buildout.easy_install.working_set(
- ... ['bar'], sys.executable,
- ... [join(sample_buildout, 'eggs'),
- ... join(sample_buildout, 'develop-eggs'),
- ... ])]
- ['bar', 'foox', 'distribute']
- >>> print_(handler, end='')
- zc.buildout.easy_install WARNING
- Develop distribution: foox 0.0.0
- uses namespace packages but the distribution does not require distribute.
- >>> logging.getLogger('zc.buildout.easy_install').propagate = True
- >>> handler.uninstall()
- '''
- def develop_preserves_existing_setup_cfg():
- """
- See "Handling custom build options for extensions in develop eggs" in
- easy_install.txt. This will be very similar except that we'll have an
- existing setup.cfg:
- >>> write(extdemo, "setup.cfg",
- ... '''
- ... # sampe cfg file
- ...
- ... [foo]
- ... bar = 1
- ...
- ... [build_ext]
- ... define = X,Y
- ... ''')
- >>> mkdir('include')
- >>> write('include', 'extdemo.h',
- ... '''
- ... #define EXTDEMO 42
- ... ''')
- >>> dest = tmpdir('dest')
- >>> zc.buildout.easy_install.develop(
- ... extdemo, dest,
- ... {'include-dirs': os.path.join(sample_buildout, 'include')})
- '/dest/extdemo.egg-link'
- >>> ls(dest)
- - extdemo.egg-link
- >>> cat(extdemo, "setup.cfg")
- <BLANKLINE>
- # sampe cfg file
- <BLANKLINE>
- [foo]
- bar = 1
- <BLANKLINE>
- [build_ext]
- define = X,Y
- """
- def uninstall_recipes_used_for_removal():
- r"""
- Uninstall recipes need to be called when a part is removed too:
- >>> mkdir("recipes")
- >>> write("recipes", "setup.py",
- ... '''
- ... from setuptools import setup
- ... setup(name='recipes',
- ... entry_points={
- ... 'zc.buildout': ["demo=demo:Install"],
- ... 'zc.buildout.uninstall': ["demo=demo:uninstall"],
- ... })
- ... ''')
- >>> write("recipes", "demo.py",
- ... r'''
- ... import sys
- ... class Install:
- ... def __init__(*args): pass
- ... def install(self):
- ... sys.stdout.write('installing\n')
- ... return ()
- ... def uninstall(name, options):
- ... sys.stdout.write('uninstalling\n')
- ... ''')
- >>> write('buildout.cfg', '''
- ... [buildout]
- ... develop = recipes
- ... parts = demo
- ... [demo]
- ... recipe = recipes:demo
- ... ''')
- >>> print_(system(join('bin', 'buildout')), end='')
- Develop: '/sample-buildout/recipes'
- Installing demo.
- installing
- >>> write('buildout.cfg', '''
- ... [buildout]
- ... develop = recipes
- ... parts = demo
- ... [demo]
- ... recipe = recipes:demo
- ... x = 1
- ... ''')
- >>> print_(system(join('bin', 'buildout')), end='')
- Develop: '/sample-buildout/recipes'
- Uninstalling demo.
- Running uninstall recipe.
- uninstalling
- Installing demo.
- installing
- >>> write('buildout.cfg', '''
- ... [buildout]
- ... develop = recipes
- ... parts =
- ... ''')
- >>> print_(system(join('bin', 'buildout')), end='')
- Develop: '/sample-buildout/recipes'
- Uninstalling demo.
- Running uninstall recipe.
- uninstalling
- """
- def extensions_installed_as_eggs_work_in_offline_mode():
- '''
- >>> mkdir('demo')
- >>> write('demo', 'demo.py',
- ... r"""
- ... import sys
- ... def print_(*args):
- ... sys.stdout.write(' '.join(map(str, args)) + '\\n')
- ... def ext(buildout):
- ... print_('ext', list(buildout))
- ... """)
- >>> write('demo', 'setup.py',
- ... """
- ... from setuptools import setup
- ...
- ... setup(
- ... name = "demo",
- ... py_modules=['demo'],
- ... entry_points = {'zc.buildout.extension': ['ext = demo:ext']},
- ... )
- ... """)
- >>> bdist_egg(join(sample_buildout, "demo"), sys.executable,
- ... join(sample_buildout, "eggs"))
- >>> write(sample_buildout, 'buildout.cfg',
- ... """
- ... [buildout]
- ... extensions = demo
- ... parts =
- ... offline = true
- ... """)
- >>> print_(system(join(sample_buildout, 'bin', 'buildout')), end='')
- ext ['buildout']
- '''
- def changes_in_svn_or_CVS_dont_affect_sig():
- """
- If we have a develop recipe, it's signature shouldn't be affected to
- changes in .svn or CVS directories.
- >>> mkdir('recipe')
- >>> write('recipe', 'setup.py',
- ... '''
- ... from setuptools import setup
- ... setup(name='recipe',
- ... entry_points={'zc.buildout': ['default=foo:Foo']})
- ... ''')
- >>> write('recipe', 'foo.py',
- ... '''
- ... class Foo:
- ... def __init__(*args): pass
- ... def install(*args): return ()
- ... update = install
- ... ''')
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... develop = recipe
- ... parts = foo
- ...
- ... [foo]
- ... recipe = recipe
- ... ''')
- >>> print_(system(join(sample_buildout, 'bin', 'buildout')), end='')
- Develop: '/sample-buildout/recipe'
- Installing foo.
- >>> mkdir('recipe', '.svn')
- >>> mkdir('recipe', 'CVS')
- >>> print_(system(join(sample_buildout, 'bin', 'buildout')), end='')
- Develop: '/sample-buildout/recipe'
- Updating foo.
- >>> write('recipe', '.svn', 'x', '1')
- >>> write('recipe', 'CVS', 'x', '1')
- >>> print_(system(join(sample_buildout, 'bin', 'buildout')), end='')
- Develop: '/sample-buildout/recipe'
- Updating foo.
- """
- if hasattr(os, 'symlink'):
- def bug_250537_broken_symlink_doesnt_affect_sig():
- """
- If we have a develop recipe, it's signature shouldn't be affected by
- broken symlinks, and better yet, computing the hash should not break
- because of the missing target file.
- >>> mkdir('recipe')
- >>> write('recipe', 'setup.py',
- ... '''
- ... from setuptools import setup
- ... setup(name='recipe',
- ... entry_points={'zc.buildout': ['default=foo:Foo']})
- ... ''')
- >>> write('recipe', 'foo.py',
- ... '''
- ... class Foo:
- ... def __init__(*args): pass
- ... def install(*args): return ()
- ... update = install
- ... ''')
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... develop = recipe
- ... parts = foo
- ...
- ... [foo]
- ... recipe = recipe
- ... ''')
- >>> print_(system(join(sample_buildout, 'bin', 'buildout')), end='')
- Develop: '/sample-buildout/recipe'
- Installing foo.
- >>> write('recipe', 'some-file', '1')
- >>> os.symlink(join('recipe', 'some-file'),
- ... join('recipe', 'another-file'))
- >>> remove('recipe', 'some-file')
- >>> print_(system(join(sample_buildout, 'bin', 'buildout')), end='')
- Develop: '/sample-buildout/recipe'
- Updating foo.
- """
- def o_option_sets_offline():
- """
- >>> print_(system(join(sample_buildout, 'bin', 'buildout')+' -vvo'), end='')
- ... # doctest: +ELLIPSIS
- <BLANKLINE>
- ...
- offline = true
- ...
- """
- def recipe_upgrade():
- r"""
- The buildout will upgrade recipes in newest (and non-offline) mode.
- Let's create a recipe egg
- >>> mkdir('recipe')
- >>> write('recipe', 'recipe.py',
- ... r'''
- ... import sys
- ... class Recipe:
- ... def __init__(*a): pass
- ... def install(self):
- ... sys.stdout.write('recipe v1\n')
- ... return ()
- ... update = install
- ... ''')
- >>> write('recipe', 'setup.py',
- ... '''
- ... from setuptools import setup
- ... setup(name='recipe', version='1', py_modules=['recipe'],
- ... entry_points={'zc.buildout': ['default = recipe:Recipe']},
- ... )
- ... ''')
- >>> write('recipe', 'README', '')
- >>> print_(system(buildout+' setup recipe bdist_egg')) # doctest: +ELLIPSIS
- Running setup script 'recipe/setup.py'.
- ...
- >>> rmdir('recipe', 'build')
- And update our buildout to use it.
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... parts = foo
- ... find-links = %s
- ...
- ... [foo]
- ... recipe = recipe
- ... ''' % join('recipe', 'dist'))
- >>> print_(system(buildout), end='')
- Getting distribution for 'recipe'.
- Got recipe 1.
- Installing foo.
- recipe v1
- Now, if we update the recipe egg:
- >>> write('recipe', 'recipe.py',
- ... r'''
- ... import sys
- ... class Recipe:
- ... def __init__(*a): pass
- ... def install(self):
- ... sys.stdout.write('recipe v2\n')
- ... return ()
- ... update = install
- ... ''')
- >>> write('recipe', 'setup.py',
- ... '''
- ... from setuptools import setup
- ... setup(name='recipe', version='2', py_modules=['recipe'],
- ... entry_points={'zc.buildout': ['default = recipe:Recipe']},
- ... )
- ... ''')
- >>> print_(system(buildout+' setup recipe bdist_egg')) # doctest: +ELLIPSIS
- Running setup script 'recipe/setup.py'.
- ...
- We won't get the update if we specify -N:
- >>> print_(system(buildout+' -N'), end='')
- Updating foo.
- recipe v1
- or if we use -o:
- >>> print_(system(buildout+' -o'), end='')
- Updating foo.
- recipe v1
- But we will if we use neither of these:
- >>> print_(system(buildout), end='')
- Getting distribution for 'recipe'.
- Got recipe 2.
- Uninstalling foo.
- Installing foo.
- recipe v2
- We can also select a particular recipe version:
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... parts = foo
- ... find-links = %s
- ...
- ... [foo]
- ... recipe = recipe ==1
- ... ''' % join('recipe', 'dist'))
- >>> print_(system(buildout), end='')
- Uninstalling foo.
- Installing foo.
- recipe v1
- """
- def update_adds_to_uninstall_list():
- """
- Paths returned by the update method are added to the list of paths to
- uninstall
- >>> mkdir('recipe')
- >>> write('recipe', 'setup.py',
- ... '''
- ... from setuptools import setup
- ... setup(name='recipe',
- ... entry_points={'zc.buildout': ['default = recipe:Recipe']},
- ... )
- ... ''')
- >>> write('recipe', 'recipe.py',
- ... '''
- ... import os
- ... class Recipe:
- ... def __init__(*_): pass
- ... def install(self):
- ... r = ('a', 'b', 'c')
- ... for p in r: os.mkdir(p)
- ... return r
- ... def update(self):
- ... r = ('c', 'd', 'e')
- ... for p in r:
- ... if not os.path.exists(p):
- ... os.mkdir(p)
- ... return r
- ... ''')
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... develop = recipe
- ... parts = foo
- ...
- ... [foo]
- ... recipe = recipe
- ... ''')
- >>> print_(system(buildout), end='')
- Develop: '/sample-buildout/recipe'
- Installing foo.
- >>> print_(system(buildout), end='')
- Develop: '/sample-buildout/recipe'
- Updating foo.
- >>> cat('.installed.cfg') # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
- [buildout]
- ...
- [foo]
- __buildout_installed__ = a
- b
- c
- d
- e
- __buildout_signature__ = ...
- """
- def log_when_there_are_not_local_distros():
- """
- >>> from zope.testing.loggingsupport import InstalledHandler
- >>> handler = InstalledHandler('zc.buildout.easy_install')
- >>> import logging
- >>> logger = logging.getLogger('zc.buildout.easy_install')
- >>> old_propogate = logger.propagate
- >>> logger.propagate = False
- >>> dest = tmpdir('sample-install')
- >>> import zc.buildout.easy_install
- >>> ws = zc.buildout.easy_install.install(
- ... ['demo==0.2'], dest,
- ... links=[link_server], index=link_server+'index/')
- >>> print_(handler) # doctest: +ELLIPSIS
- zc.buildout.easy_install DEBUG
- Installing 'demo==0.2'.
- zc.buildout.easy_install DEBUG
- We have no distributions for demo that satisfies 'demo==0.2'.
- ...
- >>> handler.uninstall()
- >>> logger.propagate = old_propogate
- """
- def internal_errors():
- """Internal errors are clearly marked and don't generate tracebacks:
- >>> mkdir(sample_buildout, 'recipes')
- >>> write(sample_buildout, 'recipes', 'mkdir.py',
- ... '''
- ... class Mkdir:
- ... def __init__(self, buildout, name, options):
- ... self.name, self.options = name, options
- ... options['path'] = os.path.join(
- ... buildout['buildout']['directory'],
- ... options['path'],
- ... )
- ... ''')
- >>> write(sample_buildout, 'recipes', 'setup.py',
- ... '''
- ... from setuptools import setup
- ... setup(name = "recipes",
- ... entry_points = {'zc.buildout': ['mkdir = mkdir:Mkdir']},
- ... )
- ... ''')
- >>> write(sample_buildout, 'buildout.cfg',
- ... '''
- ... [buildout]
- ... develop = recipes
- ... parts = data-dir
- ...
- ... [data-dir]
- ... recipe = recipes:mkdir
- ... ''')
- >>> print_(system(buildout), end='') # doctest: +ELLIPSIS
- Develop: '/sample-buildout/recipes'
- While:
- Installing.
- Getting section data-dir.
- Initializing part data-dir.
- <BLANKLINE>
- An internal error occured due to a bug in either zc.buildout or in a
- recipe being used:
- Traceback (most recent call last):
- ...
- NameError: global name 'os' is not defined
- """
- def whine_about_unused_options():
- '''
- >>> write('foo.py',
- ... """
- ... class Foo:
- ...
- ... def __init__(self, buildout, name, options):
- ... self.name, self.options = name, options
- ... options['x']
- ...
- ... def install(self):
- ... self.options['y']
- ... return ()
- ... """)
- >>> write('setup.py',
- ... """
- ... from setuptools import setup
- ... setup(name = "foo",
- ... entry_points = {'zc.buildout': ['default = foo:Foo']},
- ... )
- ... """)
- >>> write('buildout.cfg',
- ... """
- ... [buildout]
- ... develop = .
- ... parts = foo
- ... a = 1
- ...
- ... [foo]
- ... recipe = foo
- ... x = 1
- ... y = 1
- ... z = 1
- ... """)
- >>> print_(system(buildout), end='')
- Develop: '/sample-buildout/.'
- Unused options for buildout: 'a'.
- Installing foo.
- Unused options for foo: 'z'.
- '''
- def abnormal_exit():
- """
- People sometimes hit control-c while running a builout. We need to make
- sure that the installed database Isn't corrupted. To test this, we'll create
- some evil recipes that exit uncleanly:
- >>> mkdir('recipes')
- >>> write('recipes', 'recipes.py',
- ... '''
- ... import os
- ...
- ... class Clean:
- ... def __init__(*_): pass
- ... def install(_): return ()
- ... def update(_): pass
- ...
- ... class EvilInstall(Clean):
- ... def install(_): os._exit(1)
- ...
- ... class EvilUpdate(Clean):
- ... def update(_): os._exit(1)
- ... ''')
- >>> write('recipes', 'setup.py',
- ... '''
- ... import setuptools
- ... setuptools.setup(name='recipes',
- ... entry_points = {
- ... 'zc.buildout': [
- ... 'clean = recipes:Clean',
- ... 'evil_install = recipes:EvilInstall',
- ... 'evil_update = recipes:EvilUpdate',
- ... 'evil_uninstall = recipes:Clean',
- ... ],
- ... },
- ... )
- ... ''')
- Now let's look at 3 cases:
- 1. We exit during installation after installing some other parts:
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... develop = recipes
- ... parts = p1 p2 p3 p4
- ...
- ... [p1]
- ... recipe = recipes:clean
- ...
- ... [p2]
- ... recipe = recipes:clean
- ...
- ... [p3]
- ... recipe = recipes:evil_install
- ...
- ... [p4]
- ... recipe = recipes:clean
- ... ''')
- >>> print_(system(buildout), end='')
- Develop: '/sample-buildout/recipes'
- Installing p1.
- Installing p2.
- Installing p3.
- >>> print_(system(buildout), end='')
- Develop: '/sample-buildout/recipes'
- Updating p1.
- Updating p2.
- Installing p3.
- >>> print_(system(buildout+' buildout:parts='), end='')
- Develop: '/sample-buildout/recipes'
- Uninstalling p2.
- Uninstalling p1.
- 2. We exit while updating:
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... develop = recipes
- ... parts = p1 p2 p3 p4
- ...
- ... [p1]
- ... recipe = recipes:clean
- ...
- ... [p2]
- ... recipe = recipes:clean
- ...
- ... [p3]
- ... recipe = recipes:evil_update
- ...
- ... [p4]
- ... recipe = recipes:clean
- ... ''')
- >>> print_(system(buildout), end='')
- Develop: '/sample-buildout/recipes'
- Installing p1.
- Installing p2.
- Installing p3.
- Installing p4.
- >>> print_(system(buildout), end='')
- Develop: '/sample-buildout/recipes'
- Updating p1.
- Updating p2.
- Updating p3.
- >>> print_(system(buildout+' buildout:parts='), end='')
- Develop: '/sample-buildout/recipes'
- Uninstalling p2.
- Uninstalling p1.
- Uninstalling p4.
- Uninstalling p3.
- 3. We exit while installing or updating after uninstalling:
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... develop = recipes
- ... parts = p1 p2 p3 p4
- ...
- ... [p1]
- ... recipe = recipes:evil_update
- ...
- ... [p2]
- ... recipe = recipes:clean
- ...
- ... [p3]
- ... recipe = recipes:clean
- ...
- ... [p4]
- ... recipe = recipes:clean
- ... ''')
- >>> print_(system(buildout), end='')
- Develop: '/sample-buildout/recipes'
- Installing p1.
- Installing p2.
- Installing p3.
- Installing p4.
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... develop = recipes
- ... parts = p1 p2 p3 p4
- ...
- ... [p1]
- ... recipe = recipes:evil_update
- ...
- ... [p2]
- ... recipe = recipes:clean
- ...
- ... [p3]
- ... recipe = recipes:clean
- ...
- ... [p4]
- ... recipe = recipes:clean
- ... x = 1
- ... ''')
- >>> print_(system(buildout), end='')
- Develop: '/sample-buildout/recipes'
- Uninstalling p4.
- Updating p1.
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... develop = recipes
- ... parts = p1 p2 p3 p4
- ...
- ... [p1]
- ... recipe = recipes:clean
- ...
- ... [p2]
- ... recipe = recipes:clean
- ...
- ... [p3]
- ... recipe = recipes:clean
- ...
- ... [p4]
- ... recipe = recipes:clean
- ... ''')
- >>> print_(system(buildout), end='')
- Develop: '/sample-buildout/recipes'
- Uninstalling p1.
- Installing p1.
- Updating p2.
- Updating p3.
- Installing p4.
- """
- def install_source_dist_with_bad_py():
- r"""
- >>> mkdir('badegg')
- >>> mkdir('badegg', 'badegg')
- >>> write('badegg', 'badegg', '__init__.py', '#\\n')
- >>> mkdir('badegg', 'badegg', 'scripts')
- >>> write('badegg', 'badegg', 'scripts', '__init__.py', '#\\n')
- >>> write('badegg', 'badegg', 'scripts', 'one.py',
- ... '''
- ... return 1
- ... ''')
- >>> write('badegg', 'setup.py',
- ... '''
- ... from setuptools import setup, find_packages
- ... setup(
- ... name='badegg',
- ... version='1',
- ... packages = find_packages('.'),
- ... zip_safe=False)
- ... ''')
- >>> print_(system(buildout+' setup badegg sdist'), end='') # doctest: +ELLIPSIS
- Running setup script 'badegg/setup.py'.
- ...
- >>> dist = join('badegg', 'dist')
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... parts = eggs bo
- ... find-links = %(dist)s
- ...
- ... [eggs]
- ... recipe = zc.recipe.egg
- ... eggs = badegg
- ...
- ... [bo]
- ... recipe = zc.recipe.egg
- ... eggs = zc.buildout
- ... scripts = buildout=bo
- ... ''' % globals())
- >>> print_(system(buildout));print_('X') # doctest: +ELLIPSIS
- Installing eggs.
- Getting distribution for 'badegg'.
- Got badegg 1.
- Installing bo.
- ...
- SyntaxError: ...'return' outside function...
- ...
- SyntaxError: ...'return' outside function...
- ...
- >>> ls('eggs') # doctest: +ELLIPSIS
- d badegg-1-py2.4.egg
- ...
- >>> ls('bin')
- - bo
- - buildout
- """
- def version_requirements_in_build_honored():
- '''
- >>> update_extdemo()
- >>> dest = tmpdir('sample-install')
- >>> mkdir('include')
- >>> write('include', 'extdemo.h',
- ... """
- ... #define EXTDEMO 42
- ... """)
- >>> zc.buildout.easy_install.build(
- ... 'extdemo ==1.4', dest,
- ... {'include-dirs': os.path.join(sample_buildout, 'include')},
- ... links=[link_server], index=link_server+'index/',
- ... newest=False)
- ['/sample-install/extdemo-1.4-py2.4-linux-i686.egg']
- '''
- def bug_105081_Specific_egg_versions_are_ignored_when_newer_eggs_are_around():
- """
- Buildout might ignore a specific egg requirement for a recipe:
- - Have a newer version of an egg in your eggs directory
- - Use 'recipe==olderversion' in your buildout.cfg to request an
- older version
- Buildout will go and fetch the older version, but it will *use*
- the newer version when installing a part with this recipe.
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... parts = x
- ... find-links = %(sample_eggs)s
- ...
- ... [x]
- ... recipe = zc.recipe.egg
- ... eggs = demo
- ... ''' % globals())
- >>> print_(system(buildout), end='')
- Installing x.
- Getting distribution for 'demo'.
- Got demo 0.3.
- Getting distribution for 'demoneeded'.
- Got demoneeded 1.1.
- Generated script '/sample-buildout/bin/demo'.
- >>> print_(system(join('bin', 'demo')), end='')
- 3 1
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... parts = x
- ... find-links = %(sample_eggs)s
- ...
- ... [x]
- ... recipe = zc.recipe.egg
- ... eggs = demo ==0.1
- ... ''' % globals())
- >>> print_(system(buildout), end='')
- Uninstalling x.
- Installing x.
- Getting distribution for 'demo==0.1'.
- Got demo 0.1.
- Generated script '/sample-buildout/bin/demo'.
- >>> print_(system(join('bin', 'demo')), end='')
- 1 1
- """
- if sys.version_info > (2, 4):
- def test_exit_codes():
- """
- >>> import subprocess
- >>> def call(s):
- ... p = subprocess.Popen(s, stdin=subprocess.PIPE,
- ... stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- ... p.stdin.close()
- ... print_(p.stdout.read().decode())
- ... print_('Exit:', bool(p.wait()))
- >>> call(buildout)
- <BLANKLINE>
- Exit: False
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... parts = x
- ... ''')
- >>> call(buildout) # doctest: +NORMALIZE_WHITESPACE
- While:
- Installing.
- Getting section x.
- Error: The referenced section, 'x', was not defined.
- <BLANKLINE>
- Exit: True
- >>> write('setup.py',
- ... '''
- ... from setuptools import setup
- ... setup(name='zc.buildout.testexit', entry_points={
- ... 'zc.buildout': ['default = testexitrecipe:x']})
- ... ''')
- >>> write('testexitrecipe.py',
- ... '''
- ... x y
- ... ''')
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... parts = x
- ... develop = .
- ...
- ... [x]
- ... recipe = zc.buildout.testexit
- ... ''')
- >>> call(buildout) # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
- Develop: '/sample-buildout/.'
- While:
- Installing.
- Getting section x.
- Initializing section x.
- Loading zc.buildout recipe entry zc.buildout.testexit:default.
- <BLANKLINE>
- An internal error occured due to a bug in either zc.buildout or in a
- recipe being used:
- Traceback (most recent call last):
- ...
- x y
- ^
- SyntaxError: invalid syntax
- <BLANKLINE>
- Exit: True
- """
- def bug_59270_recipes_always_start_in_buildout_dir():
- r"""
- Recipes can rely on running from buildout directory
- >>> mkdir('bad_start')
- >>> write('bad_recipe.py',
- ... r'''
- ... import os, sys
- ... def print_(*args):
- ... sys.stdout.write(' '.join(map(str, args)) + '\n')
- ... class Bad:
- ... def __init__(self, *_):
- ... print_(os.getcwd())
- ... def install(self):
- ... sys.stdout.write(os.getcwd()+'\n')
- ... os.chdir('bad_start')
- ... sys.stdout.write(os.getcwd()+'\n')
- ... 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')), end='')
- Develop: '/sample-buildout/.'
- /sample-buildout
- /sample-buildout
- Installing b1.
- /sample-buildout
- /sample-buildout/bad_start
- Installing b2.
- /sample-buildout
- /sample-buildout/bad_start
- """
- def bug_61890_file_urls_dont_seem_to_work_in_find_dash_links():
- """
- This bug arises from the fact that setuptools is overly restrictive
- about file urls, requiring that file urls pointing at directories
- must end in a slash.
- >>> dest = tmpdir('sample-install')
- >>> import zc.buildout.easy_install
- >>> sample_eggs = sample_eggs.replace(os.path.sep, '/')
- >>> ws = zc.buildout.easy_install.install(
- ... ['demo==0.2'], dest,
- ... links=['file://'+sample_eggs], index=link_server+'index/')
- >>> for dist in ws:
- ... print_(dist)
- demo 0.2
- demoneeded 1.1
- >>> ls(dest)
- d demo-0.2-py2.4.egg
- d demoneeded-1.1-py2.4.egg
- """
- def bug_75607_buildout_should_not_run_if_it_creates_an_empty_buildout_cfg():
- """
- >>> remove('buildout.cfg')
- >>> print_(system(buildout), end='')
- While:
- Initializing.
- Error: Couldn't open /sample-buildout/buildout.cfg
- """
- def dealing_with_extremely_insane_dependencies():
- r"""
- There was a problem with analysis of dependencies taking a long
- time, in part because the analysis would get repeated every time a
- package was encountered in a dependency list. Now, we don't do
- the analysis any more:
- >>> import os
- >>> for i in range(5):
- ... p = 'pack%s' % i
- ... deps = [('pack%s' % j) for j in range(5) if j is not i]
- ... if i == 4:
- ... deps.append('pack5')
- ... mkdir(p)
- ... write(p, 'setup.py',
- ... 'from setuptools import setup\n'
- ... 'setup(name=%r, install_requires=%r,\n'
- ... ' url="u", author="a", author_email="e")\n'
- ... % (p, deps))
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... develop = pack0 pack1 pack2 pack3 pack4
- ... parts = pack1
- ...
- ... [pack1]
- ... recipe = zc.recipe.egg:eggs
- ... eggs = pack0
- ... ''')
- >>> print_(system(buildout), end='') # doctest: +ELLIPSIS
- Develop: '/sample-buildout/pack0'
- Develop: '/sample-buildout/pack1'
- Develop: '/sample-buildout/pack2'
- Develop: '/sample-buildout/pack3'
- Develop: '/sample-buildout/pack4'
- Installing pack1.
- ...
- While:
- Installing pack1.
- Getting distribution for 'pack5'.
- Error: Couldn't find a distribution for 'pack5'.
- However, if we run in verbose mode, we can see why packages were included:
- >>> print_(system(buildout+' -v'), end='') # doctest: +ELLIPSIS
- Installing 'zc.buildout >=1.99', 'dist…
Large files files are truncated, but you can click here to view the full file