Commit aaa161f4 authored by Jim Fulton's avatar Jim Fulton

Changed the logging format to exclude the logger name for the

zc.buildout logger.  This reduces noise in the output.  This change
was so far reaching, I decided to go ahead and clean up lots of log
messages, adding some missing periods and adding quotes around
requirement strings and file paths.

in easy_install.py, added logging to show why distributions are added
in verbose mode and removed recusive code to show requirement chains
when errors occurred.
parent a3fec817
############################################################################
##############################################################################
#
# Copyright (c) 2005 Zope Corporation and Contributors.
# All Rights Reserved.
......@@ -61,7 +61,7 @@ _buildout_default_options = {
'python': 'buildout',
'executable': sys.executable,
'log-level': 'INFO',
'log-format': '%(name)s: %(message)s',
'log-format': '',
}
class Buildout(UserDict.DictMixin):
......@@ -69,7 +69,7 @@ class Buildout(UserDict.DictMixin):
def __init__(self, config_file, cloptions,
user_defaults=True, windows_restart=False, command=None):
__doing__ = 'Initializing'
__doing__ = 'Initializing.'
self.__windows_restart = windows_restart
......@@ -81,7 +81,7 @@ class Buildout(UserDict.DictMixin):
base = os.path.dirname(config_file)
if not os.path.exists(config_file):
if command == 'init':
print 'Creating', config_file
print 'Creating %r.' % config_file
open(config_file, 'w').write('[buildout]\nparts = \n')
else:
raise zc.buildout.UserError(
......@@ -185,7 +185,7 @@ class Buildout(UserDict.DictMixin):
return os.path.join(self._buildout_dir, *names)
def bootstrap(self, args):
__doing__ = 'Bootstraping'
__doing__ = 'Bootstraping.'
self._setup_directories()
......@@ -219,7 +219,7 @@ class Buildout(UserDict.DictMixin):
init = bootstrap
def install(self, install_args):
__doing__ = 'Installing'
__doing__ = 'Installing.'
self._load_extensions()
self._setup_directories()
......@@ -268,7 +268,7 @@ class Buildout(UserDict.DictMixin):
if not install_args:
install_parts = self._parts
if self._log_level <= logging.DEBUG:
if self._log_level < logging.DEBUG:
sections = list(self)
sections.sort()
print
......@@ -301,19 +301,20 @@ class Buildout(UserDict.DictMixin):
continue
# output debugging info
for k in old_options:
if k not in new_options:
self._logger.debug("Part: %s, dropped option %s",
part, k)
elif old_options[k] != new_options[k]:
self._logger.debug(
"Part: %s, option %s, %r != %r",
part, k, new_options[k], old_options[k],
)
for k in new_options:
if k not in old_options:
self._logger.debug("Part: %s, new option %s",
part, k)
if self._logger.getEffectiveLevel() < logging.DEBUG:
for k in old_options:
if k not in new_options:
self._logger.debug("Part %s, dropped option %s.",
part, k)
elif old_options[k] != new_options[k]:
self._logger.debug(
"Part %s, option %s changed:\n%r != %r",
part, k, new_options[k], old_options[k],
)
for k in new_options:
if k not in old_options:
self._logger.debug("Part %s, new option %s.",
part, k)
elif not uninstall_missing:
continue
......@@ -334,7 +335,7 @@ class Buildout(UserDict.DictMixin):
recipe = self[part].recipe
if part in installed_parts: # update
need_to_save_installed = False
__doing__ = 'Updating %s', part
__doing__ = 'Updating %s.', part
self._logger.info(*__doing__)
old_options = installed_part_options[part]
old_installed_files = old_options['__buildout_installed__']
......@@ -377,7 +378,7 @@ class Buildout(UserDict.DictMixin):
else: # install
need_to_save_installed = True
__doing__ = 'Installing %s', part
__doing__ = 'Installing %s.', part
self._logger.info(*__doing__)
installed_files = self[part]._call(recipe.install)
if installed_files is None:
......@@ -425,7 +426,7 @@ class Buildout(UserDict.DictMixin):
def _uninstall_part(self, part, installed_part_options):
# ununstall part
__doing__ = 'Uninstalling %s', part
__doing__ = 'Uninstalling %s.', part
self._logger.info(*__doing__)
# run uinstall recipe
......@@ -433,7 +434,7 @@ class Buildout(UserDict.DictMixin):
try:
uninstaller = _install_and_load(
recipe, 'zc.buildout.uninstall', entry, self)
self._logger.info('Running uninstall recipe')
self._logger.info('Running uninstall recipe.')
uninstaller(part, installed_part_options[part])
except (ImportError, pkg_resources.DistributionNotFound), v:
pass
......@@ -450,7 +451,7 @@ class Buildout(UserDict.DictMixin):
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)
self._logger.info('Creating directory %r.', d)
os.mkdir(d)
def _develop(self):
......@@ -471,8 +472,8 @@ class Buildout(UserDict.DictMixin):
try:
for setup in develop.split():
setup = self._buildout_path(setup)
self._logger.info("Develop: %s", setup)
__doing__ = 'Processing develop directory %s', setup
self._logger.info("Develop: %r", setup)
__doing__ = 'Processing develop directory %r.', setup
zc.buildout.easy_install.develop(setup, dest)
except:
# if we had an error, we need to roll back changes, by
......@@ -503,7 +504,7 @@ class Buildout(UserDict.DictMixin):
if not (os.path.isfile(os.path.join(dest, f))
and f.endswith('.egg-link')):
self._logger.warning(
"Unexpected entry, %s, in develop-eggs directory", f)
"Unexpected entry, %r, in develop-eggs directory.", f)
def _compute_part_signatures(self, parts):
# Compute recipe signature and add to options
......@@ -580,10 +581,21 @@ class Buildout(UserDict.DictMixin):
def _setup_logging(self):
root_logger = logging.getLogger()
self._logger = logging.getLogger('zc.buildout')
handler = logging.StreamHandler(sys.stdout)
handler.setFormatter(logging.Formatter(self['buildout']['log-format']))
log_format = self['buildout']['log-format']
if not log_format:
# No format specified. Use different formatter for buildout
# and other modules, showing logger name except for buildout
log_format = '%(name)s: %(message)s'
buildout_handler = logging.StreamHandler(sys.stdout)
buildout_handler.setFormatter(logging.Formatter('%(message)s'))
self._logger.propagate = False
self._logger.addHandler(buildout_handler)
handler.setFormatter(logging.Formatter(log_format))
root_logger.addHandler(handler)
self._logger = logging.getLogger('buildout')
level = self['buildout']['log-level']
if level in ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'):
level = getattr(logging, level)
......@@ -605,7 +617,7 @@ class Buildout(UserDict.DictMixin):
def _maybe_upgrade(self):
# See if buildout or setuptools need to be upgraded.
# If they do, do the upgrade and restart the buildout process.
__doing__ = 'Checking for upgrades'
__doing__ = 'Checking for upgrades.'
if not self.newest:
return
......@@ -630,7 +642,7 @@ class Buildout(UserDict.DictMixin):
if not upgraded:
return
__doing__ = 'Upgrading'
__doing__ = 'Upgrading.'
should_run = realpath(
os.path.join(os.path.abspath(self['buildout']['bin-directory']),
......@@ -640,10 +652,10 @@ class Buildout(UserDict.DictMixin):
should_run += '-script.py'
if (realpath(os.path.abspath(sys.argv[0])) != should_run):
self._logger.debug("Running %r", realpath(sys.argv[0]))
self._logger.debug("Local buildout is %r", should_run)
self._logger.debug("Running %r.", realpath(sys.argv[0]))
self._logger.debug("Local buildout is %r.", should_run)
self._logger.warn("Not upgrading because not running a local "
"buildout command")
"buildout command.")
return
if sys.platform == 'win32' and not self.__windows_restart:
......@@ -678,7 +690,7 @@ class Buildout(UserDict.DictMixin):
sys.exit(os.spawnv(os.P_WAIT, sys.executable, args))
def _load_extensions(self):
__doing__ = 'Loading extensions'
__doing__ = 'Loading extensions.'
specs = self['buildout'].get('extensions', '').split()
if specs:
path = [self['buildout']['develop-eggs-directory']]
......@@ -688,7 +700,7 @@ class Buildout(UserDict.DictMixin):
else:
dest = self['buildout']['eggs-directory']
if not os.path.exists(dest):
self._logger.info('Creating directory %s', dest)
self._logger.info('Creating directory %r.', dest)
os.mkdir(dest)
zc.buildout.easy_install.install(
......@@ -703,7 +715,7 @@ class Buildout(UserDict.DictMixin):
if os.path.isdir(setup):
setup = os.path.join(setup, 'setup.py')
self._logger.info("Running setup script %s", setup)
self._logger.info("Running setup script %r.", setup)
setup = os.path.abspath(setup)
fd, tsetup = tempfile.mkstemp()
......@@ -724,7 +736,7 @@ class Buildout(UserDict.DictMixin):
runsetup = setup # backward compat.
def __getitem__(self, section):
__doing__ = 'Getting section %s', section
__doing__ = 'Getting section %s.', section
try:
return self._data[section]
except KeyError:
......@@ -754,13 +766,13 @@ class Buildout(UserDict.DictMixin):
def _install_and_load(spec, group, entry, buildout):
__doing__ = 'Loading recipe %s', spec
__doing__ = 'Loading recipe %r.', spec
try:
req = pkg_resources.Requirement.parse(spec)
buildout_options = buildout['buildout']
if pkg_resources.working_set.find(req) is None:
__doing__ = 'Installing recipe %s', spec
__doing__ = 'Installing recipe %s.', spec
if buildout.offline:
dest = None
path = [buildout_options['develop-eggs-directory'],
......@@ -779,7 +791,7 @@ def _install_and_load(spec, group, entry, buildout):
newest=buildout.newest,
)
__doing__ = 'Loading %s recipe entry %s:%s', group, spec, entry
__doing__ = 'Loading %s recipe entry %s:%s.', group, spec, entry
return pkg_resources.load_entry_point(
req.project_name, group, entry)
......@@ -801,7 +813,7 @@ class Options(UserDict.DictMixin):
def _initialize(self):
name = self.name
__doing__ = 'Initializing section %s', name
__doing__ = 'Initializing section %s.', name
# force substitutions
for k, v in self._raw.items():
......@@ -819,12 +831,12 @@ class Options(UserDict.DictMixin):
buildout = self.buildout
recipe_class = _install_and_load(reqs, 'zc.buildout', entry, buildout)
__doing__ = 'Initializing part %s', name
__doing__ = 'Initializing part %s.', name
self.recipe = recipe_class(buildout, name, self)
buildout._parts.append(name)
def _dosub(self, option, v):
__doing__ = 'Getting option %s:%s', self.name, option
__doing__ = 'Getting option %s:%s.', self.name, option
seen = [(self.name, option)]
v = '$$'.join([self._sub(s, seen) for s in v.split('$$')])
self._cooked[option] = v
......@@ -841,7 +853,7 @@ class Options(UserDict.DictMixin):
if v is None:
return default
__doing__ = 'Getting option %s:%s', self.name, option
__doing__ = 'Getting option %s:%s.', self.name, option
if '${' in v:
key = self.name, option
......@@ -947,7 +959,7 @@ class Options(UserDict.DictMixin):
elif os.path.isfile(p):
os.remove(p)
else:
self._buildout._logger.warn("Couldn't clean up %s", p)
self._buildout._logger.warn("Couldn't clean up %r.", p)
raise
finally:
self._created = None
......@@ -1137,7 +1149,7 @@ def _check_for_unused_options_in_section(buildout, section):
options = buildout[section]
unused = [option for option in options._raw if option not in options._data]
if unused:
buildout._logger.warn("Unused options for %s: %s"
buildout._logger.warn("Unused options for %s: %s."
% (section, ' '.join(map(repr, unused)))
)
......
......@@ -285,8 +285,8 @@ buildout:
>>> os.chdir(sample_buildout)
>>> buildout = os.path.join(sample_buildout, 'bin', 'buildout')
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Installing data-dir
Develop: '/sample-buildout/recipes'
Installing data-dir.
data-dir: Creating directory mystuff
We see that the recipe created the directory, as expected:
......@@ -334,9 +334,9 @@ we'll see that the directory gets removed and recreated:
... """)
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling data-dir
buildout: Installing data-dir
Develop: '/sample-buildout/recipes'
Uninstalling data-dir.
Installing data-dir.
data-dir: Creating directory mydata
>>> ls(sample_buildout)
......@@ -354,9 +354,9 @@ the part will be reinstalled:
>>> rmdir(sample_buildout, 'mydata')
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling data-dir
buildout: Installing data-dir
Develop: '/sample-buildout/recipes'
Uninstalling data-dir.
Installing data-dir.
data-dir: Creating directory mydata
Error reporting
......@@ -385,12 +385,12 @@ non-existant directory to create the directory in:
We'll get a user error, not a traceback.
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
Develop: '/sample-buildout/recipes'
data-dir: Cannot create /xxx/mydata. /xxx is not a directory.
While:
Installing
Getting section data-dir
Initializing part data-dir
Installing.
Getting section data-dir.
Initializing part data-dir.
Error: Invalid Path
......@@ -450,13 +450,13 @@ leave previously created paths in place:
... """)
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling data-dir
buildout: Installing data-dir
Develop: '/sample-buildout/recipes'
Uninstalling data-dir.
Installing data-dir.
data-dir: Creating directory foo
data-dir: Creating directory bin
While:
Installing data-dir
Installing data-dir.
<BLANKLINE>
An internal error occured due to a bug in either zc.buildout or in a
recipe being used:
......@@ -484,11 +484,11 @@ If we fix the typo:
... """)
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Installing data-dir
Develop: '/sample-buildout/recipes'
Installing data-dir.
data-dir: Creating directory foo
While:
Installing data-dir
Installing data-dir.
<BLANKLINE>
An internal error occured due to a bug in either zc.buildout or in a
recipe being used:
......@@ -560,12 +560,12 @@ And put back the typo:
When we rerun the buildout:
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Installing data-dir
Develop: '/sample-buildout/recipes'
Installing data-dir.
data-dir: Creating directory foo
data-dir: Creating directory bin
While:
Installing data-dir
Installing data-dir.
<BLANKLINE>
An internal error occured due to a bug in either zc.buildout or in a
recipe being used:
......@@ -636,12 +636,12 @@ If we rerun the buildout, again, we'll get the error and no
directiories will be created:
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Installing data-dir
Develop: '/sample-buildout/recipes'
Installing data-dir.
data-dir: Creating directory foo
data-dir: Creating directory bin
While:
Installing data-dir
Installing data-dir.
<BLANKLINE>
An internal error occured due to a bug in either zc.buildout or in a
recipe being used:
......@@ -666,8 +666,8 @@ Now, we'll fix the typo again and we'll get the directories we expect:
... """)
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Installing data-dir
Develop: '/sample-buildout/recipes'
Installing data-dir.
data-dir: Creating directory foo
data-dir: Creating directory bins
......@@ -782,11 +782,11 @@ Now, if we run the buildout, we'll see the options with the values
substituted.
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling data-dir
buildout: Installing data-dir
Develop: '/sample-buildout/recipes'
Uninstalling data-dir.
Installing data-dir.
data-dir: Creating directory mydata
buildout: Installing debug
Installing debug.
File 1 /sample-buildout/mydata/file
File 2 /sample-buildout/mydata/file/log
recipe recipes:debug
......@@ -801,9 +801,9 @@ recipe, so it assumed it could and reinstalled mydata. If we rerun
the buildout:
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Updating data-dir
buildout: Updating debug
Develop: '/sample-buildout/recipes'
Updating data-dir.
Updating debug.
File 1 /sample-buildout/mydata/file
File 2 /sample-buildout/mydata/file/log
recipe recipes:debug
......@@ -847,9 +847,9 @@ example, we can leave data-dir out of the parts list:
It will still be treated as a part:
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Updating data-dir
buildout: Updating debug
Develop: '/sample-buildout/recipes'
Updating data-dir.
Updating debug.
File 1 /sample-buildout/mydata/file
File 2 /sample-buildout/mydata/file/log
recipe recipes:debug
......@@ -885,9 +885,9 @@ the data-dir part after the debug part, it will be included before:
It will still be treated as a part:
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Updating data-dir
buildout: Updating debug
Develop: '/sample-buildout/recipes'
Updating data-dir.
Updating debug.
File 1 /sample-buildout/mydata/file
File 2 /sample-buildout/mydata/file/log
recipe recipes:debug
......@@ -932,10 +932,10 @@ To see how this works, we use an example:
... """)
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling debug
buildout: Uninstalling data-dir
buildout: Installing debug
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Uninstalling data-dir.
Installing debug.
op buildout
recipe recipes:debug
......@@ -1004,9 +1004,9 @@ Here is a more elaborate example.
... """)
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling debug
buildout: Installing debug
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Installing debug.
name base
op buildout
op1 b1 1
......@@ -1066,9 +1066,9 @@ we'll set up a web server with some configuration files.
>>> print system(buildout+ ' -c client.cfg'),
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling debug
buildout: Installing debug
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Installing debug.
name base
op1 r1 1
op2 r2 2
......@@ -1098,7 +1098,7 @@ buildout.
>>> print system(buildout + ' -c ' + server_url + '/remote.cfg'),
While:
Initializing
Initializing.
Error: Missing option: buildout:directory
Normally, the buildout directory defaults to directory
......@@ -1110,9 +1110,9 @@ normally be defined on the command line:
... + ' -c ' + server_url + '/remote.cfg'
... + ' buildout:directory=' + sample_buildout
... ),
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling debug
buildout: Installing debug
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Installing debug.
name remote
op1 r1 1
op2 r2 2
......@@ -1138,9 +1138,9 @@ delimiter.)
>>> os.environ['HOME'] = home
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling debug
buildout: Installing debug
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Installing debug.
name base
op buildout
op1 b1 1
......@@ -1155,9 +1155,9 @@ A buildout command-line argument, -U, can be used to suppress reading
user defaults:
>>> print system(buildout + ' -U'),
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling debug
buildout: Installing debug
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Installing debug.
name base
op buildout
op1 b1 1
......@@ -1274,9 +1274,9 @@ Here's how these recipes could be used in a buildout:
When the buildout is run the service will be installed
>>> print system(buildout)
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling debug
buildout: Installing service
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Installing service.
chkconfig --add /path/to/script
<BLANKLINE>
......@@ -1284,8 +1284,8 @@ The service has been installed. If the buildout is run again with no
changes, the serivce shouldn't be changed.
>>> print system(buildout)
buildout: Develop: /sample-buildout/recipes
buildout: Updating service
Develop: '/sample-buildout/recipes'
Updating service.
<BLANKLINE>
Now we change the service part to trigger uninstallation and
......@@ -1303,11 +1303,11 @@ re-installation.
... """)
>>> print system(buildout)
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling service
buildout: Running uninstall recipe
Develop: '/sample-buildout/recipes'
Uninstalling service.
Running uninstall recipe.
chkconfig --del /path/to/script
buildout: Installing service
Installing service.
chkconfig --add /path/to/a/different/script
<BLANKLINE>
......@@ -1324,11 +1324,11 @@ Now we remove the service part, and add another part.
... """)
>>> print system(buildout)
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling service
buildout: Running uninstall recipe
Develop: '/sample-buildout/recipes'
Uninstalling service.
Running uninstall recipe.
chkconfig --del /path/to/a/different/script
buildout: Installing debug
Installing debug.
recipe recipes:debug
<BLANKLINE>
......@@ -1391,11 +1391,11 @@ Now we can use it with a mkdir part.
Run the buildout to install the part.
>>> print system(buildout)
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling debug
buildout: Installing dir
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Installing dir.
dir: Creating directory my_directory
buildout: Installing debug
Installing debug.
recipe recipes:debug
<BLANKLINE>
......@@ -1415,11 +1415,11 @@ When the buildout is run the part is removed, and the uninstall recipe
is run before the directory is deleted.
>>> print system(buildout)
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling dir
buildout: Running uninstall recipe
Develop: '/sample-buildout/recipes'
Uninstalling dir.
Running uninstall recipe.
backing up directory /sample-buildout/my_directory of size 0
buildout: Updating debug
Updating debug.
recipe recipes:debug
<BLANKLINE>
......@@ -1515,8 +1515,8 @@ Note that we used the installed buildout option to specify an
alternate file to store information about installed parts.
>>> print system(buildout+' -c other.cfg debug:op1=foo -v'),
buildout: Develop: /sample-buildout/recipes
buildout: Installing debug
Develop: '/sample-buildout/recipes'
Installing debug.
name other
op1 foo
recipe recipes:debug
......@@ -1528,8 +1528,8 @@ WARNING.
Options can also be combined in the usual Unix way, as in:
>>> print system(buildout+' -vcother.cfg debug:op1=foo'),
buildout: Develop: /sample-buildout/recipes
buildout: Updating debug
Develop: '/sample-buildout/recipes'
Updating debug.
name other
op1 foo
recipe recipes:debug
......@@ -1569,15 +1569,15 @@ the buildout in the usual way:
... """)
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling debug
buildout: Installing debug
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Installing debug.
recipe recipes:debug
buildout: Installing d1
Installing d1.
d1: Creating directory d1
buildout: Installing d2
Installing d2.
d2: Creating directory d2
buildout: Installing d3
Installing d3.
d3: Creating directory d3
>>> ls(sample_buildout)
......@@ -1651,11 +1651,11 @@ Now we'll update our configuration file:
and run the buildout specifying just d3 and d4:
>>> print system(buildout+' install d3 d4'),
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling d3
buildout: Installing d3
Develop: '/sample-buildout/recipes'
Uninstalling d3.
Installing d3.
d3: Creating directory data3
buildout: Installing d4
Installing d4.
d4: Creating directory data2-extra
>>> ls(sample_buildout)
......@@ -1720,17 +1720,17 @@ directories are still there.
Now, if we run the buildout without the install command:
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling d2
buildout: Uninstalling d1
buildout: Uninstalling debug
buildout: Installing debug
Develop: '/sample-buildout/recipes'
Uninstalling d2.
Uninstalling d1.
Uninstalling debug.
Installing debug.
recipe recipes:debug
x 1
buildout: Installing d2
Installing d2.
d2: Creating directory data2
buildout: Updating d3
buildout: Updating d4
Updating d3.
Updating d4.
We see the output of the debug recipe and that data2 was created. We
also see that d1 and d2 have gone away:
......@@ -1776,15 +1776,15 @@ provide alternate locations, and even names for these directories.
... ))
>>> print system(buildout),
buildout: Creating directory /sample-alt/scripts
buildout: Creating directory /sample-alt/work
buildout: Creating directory /sample-alt/basket
buildout: Creating directory /sample-alt/developbasket
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling d4
buildout: Uninstalling d3
buildout: Uninstalling d2
buildout: Uninstalling debug
Creating directory '/sample-alt/scripts'.
Creating directory '/sample-alt/work'.
Creating directory '/sample-alt/basket'.
Creating directory '/sample-alt/developbasket'.
Develop: '/sample-buildout/recipes'
Uninstalling d4.
Uninstalling d3.
Uninstalling d2.
Uninstalling debug.
>>> ls(alt)
d basket
......@@ -1812,11 +1812,11 @@ You can also specify an alternate buildout directory:
... ))
>>> print system(buildout),
buildout: Creating directory /sample-alt/bin
buildout: Creating directory /sample-alt/parts
buildout: Creating directory /sample-alt/eggs
buildout: Creating directory /sample-alt/develop-eggs
buildout: Develop: /sample-buildout/recipes
Creating directory '/sample-alt/bin'.
Creating directory '/sample-alt/parts'.
Creating directory '/sample-alt/eggs'.
Creating directory '/sample-alt/develop-eggs'.
Develop: '/sample-buildout/recipes'
>>> ls(alt)
- .installed.cfg
......@@ -1864,7 +1864,7 @@ configuration file. Because the verbosity is subtracted from the log
level, we get a final log level of 20, which is the INFO level.
>>> print system(buildout),
INFO Develop: /sample-buildout/recipes
INFO Develop: '/sample-buildout/recipes'
Predefined buildout options
---------------------------
......@@ -1881,12 +1881,11 @@ database is shown.
... parts =
... """)
>>> print system(buildout+' -v'),
zc.buildout.easy_install: Installing ['zc.buildout', 'setuptools']
zc.buildout.easy_install: We have a develop egg for zc.buildout
zc.buildout.easy_install: We have the best distribution that satisfies
setuptools
zc.buildout.easy_install.picked: setuptools = 0.6
>>> print system(buildout+' -vv'),
Installing 'zc.buildout', 'setuptools'.
We have a develop egg: zc.buildout 1.0.0.
We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.6
<BLANKLINE>
Configuration data:
[buildout]
......@@ -1896,14 +1895,14 @@ database is shown.
eggs-directory = /sample-buildout/eggs
executable = /usr/local/bin/python2.3
installed = /sample-buildout/.installed.cfg
log-format = %(name)s: %(message)s
log-format =
log-level = INFO
newest = true
offline = false
parts =
parts-directory = /sample-buildout/parts
python = buildout
verbosity = 10
verbosity = 20
<BLANKLINE>
All of these options can be overridden by configuration files or by
......@@ -1975,17 +1974,17 @@ If zc.buildout is installed, you can use it to create a new buildout
with it's own local copies of zc.buildout and setuptools and with
local buildout scripts.
>>> sample_bootstrapped = tmpdir('sample-bootstrapped')
>>> sample_bootstrapped = tmpdir('sample-bootstrapped')
>>> print system(buildout
... +' -c'+os.path.join(sample_bootstrapped, 'setup.cfg')
... +' init'),
Creating /sample-bootstrapped/setup.cfg
buildout: Creating directory /sample-bootstrapped/bin
buildout: Creating directory /sample-bootstrapped/parts
buildout: Creating directory /sample-bootstrapped/eggs
buildout: Creating directory /sample-bootstrapped/develop-eggs
zc.buildout.easy_install: Generated script /sample-bootstrapped/bin/buildout.
>>> print system(buildout
... +' -c'+os.path.join(sample_bootstrapped, 'setup.cfg')
... +' init'),
Creating '/sample-bootstrapped/setup.cfg'.
Creating directory '/sample-bootstrapped/bin'.
Creating directory '/sample-bootstrapped/parts'.
Creating directory '/sample-bootstrapped/eggs'.
Creating directory '/sample-bootstrapped/develop-eggs'.
Generated script '/sample-bootstrapped/bin/buildout'.
Note that a basic setup.cfg was created for us.
......@@ -2016,30 +2015,29 @@ If we have an existing buildout that already has a buildout.cfg, we'll
normally use the bootstrap command instead of init. It will complain
if there isn't a configuration file:
>>> sample_bootstrapped2 = tmpdir('sample-bootstrapped2')
>>> sample_bootstrapped2 = tmpdir('sample-bootstrapped2')
>>> print system(buildout
... +' -c'+os.path.join(sample_bootstrapped2, 'setup.cfg')
... +' bootstrap'),
While:
Initializing.
Error: Couldn't open /sample-bootstrapped2/setup.cfg
>>> write(sample_bootstrapped2, 'setup.cfg',
... """
... [buildout]
... parts =
... """)
>>> print system(buildout
... +' -c'+os.path.join(sample_bootstrapped2, 'setup.cfg')
... +' bootstrap'),
While:
Initializing
Error: Couldn't open /sample-bootstrapped2/setup.cfg
>>> write(sample_bootstrapped2, 'setup.cfg',
... """
... [buildout]
... parts =
... """)
>>> print system(buildout
... +' -c'+os.path.join(sample_bootstrapped2, 'setup.cfg')
... +' bootstrap'),
buildout: Creating directory /sample-bootstrapped2/bin
buildout: Creating directory /sample-bootstrapped2/parts
buildout: Creating directory /sample-bootstrapped2/eggs
buildout: Creating directory /sample-bootstrapped2/develop-eggs
zc.buildout.easy_install: Generated script /sample-bootstrapped2/bin/buildout.
Creating directory '/sample-bootstrapped2/bin'.
Creating directory '/sample-bootstrapped2/parts'.
Creating directory '/sample-bootstrapped2/eggs'.
Creating directory '/sample-bootstrapped2/develop-eggs'.
Generated script '/sample-bootstrapped2/bin/buildout'.
Newest and Offline Modes
......@@ -2080,8 +2078,8 @@ or on the command line:
... """)
>>> print system(buildout+' buildout:installed=inst.cfg'),
buildout: Develop: /sample-buildout/recipes
buildout: Installing debug
Develop: '/sample-buildout/recipes'
Installing debug.
recipe recipes:debug
>>> ls(sample_buildout)
......@@ -2101,8 +2099,8 @@ buildout installed opttion:
>>> os.remove('inst.cfg')
>>> print system(buildout+' buildout:installed='),
buildout: Develop: /sample-buildout/recipes
buildout: Installing debug
Develop: '/sample-buildout/recipes'
Installing debug.
recipe recipes:debug
>>> ls(sample_buildout)
......@@ -2188,7 +2186,7 @@ egg to be built:
>>> os.chdir(sample_bootstrapped)
>>> print system(os.path.join(sample_bootstrapped, 'bin', 'buildout')),
buildout: Develop: /sample-bootstrapped/demo
Develop: '/sample-bootstrapped/demo'
Now we can add the extensions option. We were a bit tricly and ran
the buildout once with the demo develop egg defined but without the
......@@ -2209,7 +2207,7 @@ We see that our extension is loaded and executed:
>>> print system(os.path.join(sample_bootstrapped, 'bin', 'buildout')),
ext ['buildout']
buildout: Develop: /sample-bootstrapped/demo
Develop: '/sample-bootstrapped/demo'
......
......@@ -57,10 +57,10 @@ And create a buildout that uses it:
If we run the buildout, we'll get an error:
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Installing data-dir
Develop: '/sample-buildout/recipes'
Installing data-dir.
While:
Installing data-dir
Installing data-dir.
Error: Missing option: data-dir:directory
......@@ -72,10 +72,10 @@ supply some input:
... p self.options.keys()
... q
... """),
buildout: Develop: /sample-buildout/recipes
buildout: Installing data-dir
Develop: '/sample-buildout/recipes'
Installing data-dir.
While:
Installing data-dir
Installing data-dir.
Traceback (most recent call last):
File "/zc/buildout/buildout.py", line 1294, in main
getattr(buildout, command)(args)
......
......@@ -59,12 +59,12 @@ server as usual:
GET 200 /
GET 200 /demo-0.2-py2.4.egg
GET 200 /demoneeded-1.1.zip
buildout: Installing eggs
zc.buildout.easy_install: Getting new distribution for demo==0.2
zc.buildout.easy_install: Got demo 0.2
zc.buildout.easy_install: Getting new distribution for demoneeded
zc.buildout.easy_install: Got demoneeded 1.1
zc.buildout.easy_install: Generated script /sample-buildout/bin/demo.
Installing eggs.
Getting distribution for 'demo==0.2'.
Got demo 0.2.
Getting distribution for 'demoneeded'.
Got demoneeded 1.1.
Generated script '/sample-buildout/bin/demo'.
We'll also get the download cache populated. The buildout doesn't put
files in the cache directly. It creates an intermediate directory,
......@@ -87,12 +87,11 @@ If we remove the installed eggs from eggs directory and re-run the buildout:
>>> print system(buildout),
GET 200 /
buildout: Updating eggs
zc.buildout.easy_install: Getting new distribution for demo==0.2
zc.buildout.easy_install: Got demo 0.2
zc.buildout.easy_install: Getting new distribution for demoneeded
zc.buildout.easy_install: Got demoneeded 1.1
zc.buildout.easy_install: Generated script /sample-buildout/bin/demo.
Updating eggs.
Getting distribution for 'demo==0.2'.
Got demo 0.2.
Getting distribution for 'demoneeded'.
Got demoneeded 1.1.
We see that the distributions aren't downloaded, because they're
downloaded from the cache.
......@@ -130,10 +129,10 @@ install-from-cache option set to true:
... ''' % globals())
>>> print system(buildout),
buildout: Uninstalling eggs
buildout: Installing eggs
zc.buildout.easy_install: Getting new distribution for demo
zc.buildout.easy_install: Got demo 0.2
zc.buildout.easy_install: Getting new distribution for demoneeded
zc.buildout.easy_install: Got demoneeded 1.1
zc.buildout.easy_install: Generated script /sample-buildout/bin/demo.
Uninstalling eggs.
Installing eggs.
Getting distribution for 'demo'.
Got demo 0.2.
Getting distribution for 'demoneeded'.
Got demoneeded 1.1.
Generated script '/sample-buildout/bin/demo'.
......@@ -37,7 +37,6 @@ except AttributeError:
default_index_url = os.environ.get('buildout-testing-index-url')
logger = logging.getLogger('zc.buildout.easy_install')
picked = logging.getLogger('zc.buildout.easy_install.picked')
url_match = re.compile('[a-z0-9+.-]+://').match
......@@ -161,8 +160,8 @@ class Installer:
def _satisfied(self, req, source=None):
dists = [dist for dist in self._env[req.project_name] if dist in req]
if not dists:
logger.debug('We have no distributions for %s that satisfies %s.',
req.project_name, req)
logger.debug('We have no distributions for %s that satisfies %r.',
req.project_name, str(req))
return None, self._obtain(req, source)
# Note that dists are sorted from best to worst, as promised by
......@@ -170,7 +169,7 @@ class Installer:
for dist in dists:
if (dist.precedence == pkg_resources.DEVELOP_DIST):
logger.debug('We have a develop egg for %s', req)
logger.debug('We have a develop egg: %s', dist)
return dist, None
if not self._newest:
......@@ -210,8 +209,8 @@ class Installer:
# Check if we have the upper limit
if maxv is not None and best_we_have.version == maxv:
logger.debug('We have the best distribution that satisfies\n%s',
req)
logger.debug('We have the best distribution that satisfies %r.',
str(req))
return best_we_have, None
# We have some installed distros. There might, theoretically, be
......@@ -229,16 +228,17 @@ class Installer:
# That's a bit odd. There aren't any distros available.
# We should use the best one we have that meets the requirement.
logger.debug(
'There are no distros available that meet %s. Using our best.',
req)
'There are no distros available that meet %r.\n'
'Using our best, %s.',
str(req), best_available)
return best_we_have, None
else:
# Let's find out if we already have the best available:
if best_we_have.parsed_version >= best_available.parsed_version:
# Yup. Use it.
logger.debug(
'We have the best distribution that satisfies\n%s',
req)
'We have the best distribution that satisfies %r.',
str(req))
return best_we_have, None
return None, best_available
......@@ -381,7 +381,7 @@ class Installer:
def _get_dist(self, requirement, ws, always_unzip):
__doing__ = 'Getting distribution for %s', requirement
__doing__ = 'Getting distribution for %r.', str(requirement)
# Maybe an existing dist is already the best dist that satisfies the
# requirement
......@@ -389,7 +389,7 @@ class Installer:
if dist is None:
if self._dest is not None:
logger.info("Getting new distribution for %s", requirement)
logger.info(*__doing__)
# Retrieve the dist:
if avail is None:
......@@ -463,7 +463,7 @@ class Installer:
self._env.scan([self._dest])
dist = self._env.best_match(requirement, ws)
logger.info("Got %s", dist)
logger.info("Got %s.", dist)
else:
dists = [dist]
......@@ -490,7 +490,8 @@ class Installer:
and
requirement.specs[0][0] == '==')
):
picked.debug('%s = %s', dist.project_name, dist.version)
logger.debug('Picked: %s = %s',
dist.project_name, dist.version)
return dists
......@@ -503,7 +504,7 @@ class Installer:
# We have a namespace package but no requirement for setuptools
if dist.precedence == pkg_resources.DEVELOP_DIST:
logger.warn(
"Develop distribution for %s\n"
"Develop distribution: %s\n"
"uses namespace packages but the distribution "
"does not require setuptools.",
dist)
......@@ -520,7 +521,7 @@ class Installer:
if version:
if version not in requirement:
logger.error("The version, %s, is not consistent with the "
"requirement, %s", version, requirement)
"requirement, %r.", version, str(requirement))
raise IncompatibleVersionError("Bad version", version)
requirement = pkg_resources.Requirement.parse(
......@@ -530,7 +531,7 @@ class Installer:
def install(self, specs, working_set=None):
logger.debug('Installing %r', specs)
logger.debug('Installing %s.', repr(specs)[1:-1])
path = self._path
dest = self._dest
......@@ -567,9 +568,14 @@ class Installer:
[requirement] = err
requirement = self._constrain(requirement)
if dest:
logger.debug('Getting required %s', requirement)
logger.debug('Getting required %r', str(requirement))
else:
logger.debug('Adding required %r', str(requirement))
_log_requirement(ws, requirement)
for dist in self._get_dist(requirement, ws, self._always_unzip
):
ws.add(dist)
self._maybe_add_setuptools(ws, dist)
except pkg_resources.VersionConflict, err:
......@@ -590,8 +596,8 @@ class Installer:
# Retrieve the dist:
if avail is None:
raise zc.buildout.UserError(
"Couldn't find a source distribution for %s."
% requirement)
"Couldn't find a source distribution for %r."
% str(requirement))
logger.debug('Building %r', spec)
......@@ -760,7 +766,8 @@ def develop(setup, dest,
del args[1]
else:
args[1] == '-v'
logger.debug("in: %s\n%r", directory, args)
if logger.getEffectiveLevel < logging.DEBUG:
logger.debug("in: %r\n%s", directory, ' '.join(args))
assert os.spawnl(os.P_WAIT, executable, executable, *args) == 0
......@@ -833,27 +840,34 @@ def _script(module_name, attrs, path, dest, executable, arguments,
generated = []
script = dest
if sys.platform == 'win32':
# generate exe file and give the script a magic name:
open(dest+'.exe', 'wb').write(
pkg_resources.resource_string('setuptools', 'cli.exe')
)
generated.append(dest+'.exe')
dest += '-script.py'
open(dest, 'w').write(script_template % dict(
contents = script_template % dict(
python = executable,
path = path,
module_name = module_name,
attrs = attrs,
arguments = arguments,
initialization = initialization,
))
try:
os.chmod(dest, 0755)
except (AttributeError, os.error):
pass
)
changed = not (os.path.exists(dest) and open(dest).read() == contents)
if sys.platform == 'win32':
# generate exe file and give the script a magic name:
open(dest+'.exe', 'wb').write(
pkg_resources.resource_string('setuptools', 'cli.exe')
)
generated.append(dest+'.exe')
if changed:
open(dest, 'w').write(contents)
logger.info("Generated script %r.", script)
try:
os.chmod(dest, 0755)
except (AttributeError, os.error):
pass
generated.append(dest)
logger.info("Generated script %s.", script)
return generated
script_template = '''\
......@@ -874,24 +888,31 @@ if __name__ == '__main__':
def _pyscript(path, dest, executable):
generated = []
script = dest
if sys.platform == 'win32':
dest += '-script.py'
contents = py_script_template % dict(
python = executable,
path = path,
)
changed = not (os.path.exists(dest) and open(dest).read() == contents)
if sys.platform == 'win32':
# generate exe file and give the script a magic name:
open(dest+'.exe', 'wb').write(
pkg_resources.resource_string('setuptools', 'cli.exe')
)
generated.append(dest+'.exe')
dest += '-script.py'
open(dest, 'w').write(py_script_template % dict(
python = executable,
path = path,
))
try:
os.chmod(dest,0755)
except (AttributeError, os.error):
pass
if changed:
open(dest, 'w').write(contents)
try:
os.chmod(dest,0755)
except (AttributeError, os.error):
pass
logger.info("Generated interpreter %r.", script)
generated.append(dest)
logger.info("Generated interpreter %s.", script)
return generated
py_script_template = '''\
......@@ -937,6 +958,8 @@ execfile(%(setup)r)
class VersionConflict(zc.buildout.UserError):
def __init__(self, err, ws):
ws = list(ws)
ws.sort()
self.err, self.ws = err, ws
def __str__(self):
......@@ -946,36 +969,27 @@ class VersionConflict(zc.buildout.UserError):
]
for dist in self.ws:
if req in dist.requires():
result.append("but %s requires %s." % (dist, req))
_needed(self.ws, dist, result.append, [dist])
result.append("but %s requires %r." % (dist, str(req)))
return '\n'.join(result)
class MissingDistribution(zc.buildout.UserError):
def __init__(self, req, ws):
ws = list(ws)
ws.sort()
self.data = req, ws
def __str__(self):
req, ws = self.data
result = ["Couldn't find a distribution for %s." % req]
for dist in ws:
if req in dist.requires():
result.append("%s is required by %s." % (req, dist))
_needed(ws, dist, result.append, [dist])
return '\n'.join(result)
return "Couldn't find a distribution for %r." % str(req)
def _needed(ws, needed_dist, write, seen):
def _log_requirement(ws, req):
ws = list(ws)
ws.sort()
for dist in ws:
if dist in seen:
continue
for req in dist.requires():
if needed_dist in req:
write("%s is required by %s." % (needed_dist, dist))
seen.append(dist)
_needed(ws, dist, write, seen)
seen.pop()
if req in dist.requires():
logger.debug(" required by %s." % dist)
def _fix_file_links(links):
for link in links:
if link.startswith('file://') and link[-1] != '/':
......@@ -983,3 +997,6 @@ def _fix_file_links(links):
# work around excessive restriction in setuptools:
link += '/'
yield link
......@@ -228,9 +228,9 @@ we'll get an error:
>>> print handler
zc.buildout.easy_install DEBUG
Installing ['demo >0.2']
Installing 'demo >0.2'.
zc.buildout.easy_install ERROR
The version, 0.2, is not consistent with the requirement, demo>0.2
The version, 0.2, is not consistent with the requirement, 'demo>0.2'.
>>> handler.clear()
......@@ -243,19 +243,19 @@ reporting that a version was picked automatically:
>>> print handler
zc.buildout.easy_install DEBUG
Installing ['demo']
Installing 'demo'.
zc.buildout.easy_install DEBUG
We have the best distribution that satisfies
demo
zc.buildout.easy_install.picked DEBUG
demo = 0.3
We have the best distribution that satisfies 'demo'.
zc.buildout.easy_install DEBUG
Getting required demoneeded
Picked: demo = 0.3
zc.buildout.easy_install DEBUG
We have the best distribution that satisfies
demoneeded
zc.buildout.easy_install.picked DEBUG
demoneeded = 1.1
Getting required 'demoneeded'
zc.buildout.easy_install DEBUG
required by demo 0.3.
zc.buildout.easy_install DEBUG
We have the best distribution that satisfies 'demoneeded'.
zc.buildout.easy_install DEBUG
Picked: demoneeded = 1.1
>>> handler.uninstall()
>>> logging.getLogger('zc.buildout.easy_install').propagate = True
......
......@@ -40,7 +40,7 @@ To see how this works, we'll create two versions of a recipe egg:
>>> write('recipe', 'README', '')
>>> print system(buildout+' setup recipe bdist_egg'), # doctest: +ELLIPSIS
buildout: Running setup script recipe/setup.py
Running setup script 'recipe/setup.py'.
...
>>> rmdir('recipe', 'build')
......@@ -65,7 +65,7 @@ To see how this works, we'll create two versions of a recipe egg:
>>> print system(buildout+' setup recipe bdist_egg'), # doctest: +ELLIPSIS
buildout: Running setup script recipe/setup.py
Running setup script 'recipe/setup.py'.
...
and we'll configure a buildout to use it:
......@@ -83,9 +83,9 @@ and we'll configure a buildout to use it:
If we run the buildout, it will use version 2:
>>> print system(buildout),
zc.buildout.easy_install: Getting new distribution for spam
zc.buildout.easy_install: Got spam 2
buildout: Installing foo
Getting distribution for 'spam'.
Got spam 2.
Installing foo.
recipe v2
We can specify a versions section that lists our recipe and name it in
......@@ -113,10 +113,10 @@ as in the versions option.
Now, if we run the buildout, we'll use version 1 of the spam recipe:
>>> print system(buildout),
zc.buildout.easy_install: Getting new distribution for spam==1
zc.buildout.easy_install: Got spam 1
buildout: Uninstalling foo
buildout: Installing foo
Getting distribution for 'spam==1'.
Got spam 1.
Uninstalling foo.
Installing foo.
recipe v1
Running the buildout in verbose mode will help us get information
......@@ -124,18 +124,15 @@ about versions used. If we run the buildout in verbose mode without
specifying a versions section:
>>> print system(buildout+' buildout:versions= -v'), # doctest: +ELLIPSIS
zc.buildout.easy_install: Installing ['zc.buildout', 'setuptools']
zc.buildout.easy_install: We have a develop egg for zc.buildout
zc.buildout.easy_install: We have the best distribution that satisfies
setuptools
zc.buildout.easy_install.picked: setuptools = 0.6
zc.buildout.easy_install: Installing ['spam']
zc.buildout.easy_install: We have the best distribution that satisfies
spam
zc.buildout.easy_install.picked: spam = 2
...
buildout: Uninstalling foo
buildout: Installing foo
Installing 'zc.buildout', 'setuptools'.
We have a develop egg: zc.buildout 1.0.0.
We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.6
Installing 'spam'.
We have the best distribution that satisfies 'spam'.
Picked: spam = 2.
Uninstalling foo.
Installing foo.
recipe v2
We'll get output that includes lines that tell us what versions
......@@ -149,17 +146,14 @@ that we can fix them in a versions section.
If we run the buildout with the versions section:
>>> print system(buildout+' -v'), # doctest: +ELLIPSIS
zc.buildout.easy_install: Installing ['zc.buildout', 'setuptools']
zc.buildout.easy_install: We have a develop egg for zc.buildout
zc.buildout.easy_install: We have the best distribution that satisfies
setuptools
zc.buildout.easy_install.picked: setuptools = 0.6
zc.buildout.easy_install: Installing ['spam']
zc.buildout.easy_install: We have the best distribution that satisfies
spam==1
...
buildout: Uninstalling foo
buildout: Installing foo
Installing 'zc.buildout', 'setuptools'.
We have a develop egg: zc.buildout 1.0.0.
We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.6
Installing 'spam'.
We have the best distribution that satisfies 'spam==1'.
Uninstalling foo.
Installing foo.
recipe v1
We won't get output for the spam distribution, which we didn't pick,
......
......@@ -33,7 +33,7 @@ To illustrate this, we'll create a package in a sample buildout:
We can use the buildout command to generate the hello egg:
>>> print system(buildout +' setup hello -q bdist_egg'),
buildout: Running setup script hello/setup.py
Running setup script 'hello/setup.py'.
zip_safe flag not set; analyzing archive contents...
The hello directory now has a hello egg in it's dist directory:
......
......@@ -45,7 +45,7 @@ We should be able to deal with setup scripts that aren't setuptools based.
... ''')
>>> print system(join('bin', 'buildout')),
buildout: Develop: /sample-buildout/foo
Develop: '/sample-buildout/foo'
>>> ls('develop-eggs')
- foo.egg-link
......@@ -72,8 +72,8 @@ We should be able to deal with setup scripts that aren't setuptools based.
... ''')
>>> print system(join('bin', 'buildout')+' -vv'), # doctest: +ELLIPSIS
zc.buildout...
buildout: Develop: /sample-buildout/foo
Installing...
Develop: '/sample-buildout/foo'
...
Installed /sample-buildout/foo
...
......@@ -119,13 +119,13 @@ It is an error to create a variable-reference cycle:
>>> print system(os.path.join(sample_buildout, 'bin', 'buildout')),
... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
While:
Initializing
Getting section buildout
Initializing section buildout
Getting option buildout:y
Getting option buildout:z
Getting option buildout:x
Getting option buildout:y
Initializing.
Getting section buildout.
Initializing section buildout.
Getting option buildout:y.
Getting option buildout:z.
Getting option buildout:x.
Getting option buildout:y.
Error: Circular reference in substitutions.
It is an error to use funny characters in variable refereces:
......@@ -140,10 +140,10 @@ It is an error to use funny characters in variable refereces:
>>> print system(os.path.join(sample_buildout, 'bin', 'buildout')),
While:
Initializing
Getting section buildout
Initializing section buildout
Getting option buildout:x
Initializing.
Getting section buildout.
Initializing section buildout.
Getting option buildout:x.
Error: The section name in substitution, ${bui$ldout:y},
has invalid characters.
......@@ -157,10 +157,10 @@ It is an error to use funny characters in variable refereces:
>>> print system(os.path.join(sample_buildout, 'bin', 'buildout')),
While:
Initializing
Getting section buildout
Initializing section buildout
Getting option buildout:x
Initializing.
Getting section buildout.
Initializing section buildout.
Getting option buildout:x.
Error: The option name in substitution, ${buildout:y{z},
has invalid characters.
......@@ -176,10 +176,10 @@ and too have too many or too few colons:
>>> print system(os.path.join(sample_buildout, 'bin', 'buildout')),
While:
Initializing
Getting section buildout
Initializing section buildout
Getting option buildout:x
Initializing.
Getting section buildout.
Initializing section buildout.
Getting option buildout:x.
Error: The substitution, ${parts},
doesn't contain a colon.
......@@ -193,10 +193,10 @@ and too have too many or too few colons:
>>> print system(os.path.join(sample_buildout, 'bin', 'buildout')),
While:
Initializing
Getting section buildout
Initializing section buildout
Getting option buildout:x
Initializing.
Getting section buildout.
Initializing section buildout.
Getting option buildout:x.
Error: The substitution, ${buildout:y:z},
has too many colons.
......@@ -210,8 +210,8 @@ Al parts have to have a section:
>>> print system(os.path.join(sample_buildout, 'bin', 'buildout')),
While:
Installing
Getting section x
Installing.
Getting section x.
Error: The referenced section, 'x', was not defined.
and all parts have to have a specified recipe:
......@@ -228,7 +228,7 @@ and all parts have to have a specified recipe:
>>> print system(os.path.join(sample_buildout, 'bin', 'buildout')),
While:
Installing
Installing.
Error: Missing option: x:recipe
"""
......@@ -276,16 +276,16 @@ def show_who_requires_when_there_is_a_conflict():
... ''' % globals())
>>> print system(buildout),
buildout: Develop: /sample-buildout/sampley
buildout: Develop: /sample-buildout/samplez
buildout: Installing eggs
zc.buildout.easy_install: Getting new distribution for demoneeded==1.1
zc.buildout.easy_install: Got demoneeded 1.1
Develop: '/sample-buildout/sampley'
Develop: '/sample-buildout/samplez'
Installing eggs.
Getting distribution for 'demoneeded==1.1'.
Got demoneeded 1.1.
While:
Installing eggs
Installing eggs.
Error: There is a version conflict.
We already have: demoneeded 1.1
but sampley 1 requires demoneeded==1.0.
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:
......@@ -306,19 +306,37 @@ def show_who_requires_when_there_is_a_conflict():
... samplez
... ''' % globals())
>>> print system(buildout),
buildout: Develop: /sample-buildout/sampley
buildout: Develop: /sample-buildout/samplez
buildout: Develop: /sample-buildout/samplea
buildout: Develop: /sample-buildout/sampleb
buildout: Installing eggs
If we use the verbose switch, we can see where requirements are comning from:
>>> print system(buildout+' -v'),
Installing 'zc.buildout', 'setuptools'.
We have a develop egg: zc.buildout 1.0.0
We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.6
Develop: '/sample-buildout/sampley'
Develop: '/sample-buildout/samplez'
Develop: '/sample-buildout/samplea'
Develop: '/sample-buildout/sampleb'
Installing 'zc.recipe.egg'.
We have a develop egg: zc.recipe.egg 1.0.0
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 best 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
Installing eggs.
Error: There is a version conflict.
We already have: demoneeded 1.1
but sampley 1 requires demoneeded==1.0.
sampley 1 is required by sampleb 1.
sampleb 1 is required by samplea 1.
but sampley 1 requires 'demoneeded==1.0'.
"""
def show_who_requires_missing_distributions():
......@@ -345,20 +363,16 @@ def show_who_requires_missing_distributions():
... ''')
>>> print system(buildout),
buildout: Develop: /sample-buildout/sampley
buildout: Develop: /sample-buildout/samplea
buildout: Develop: /sample-buildout/sampleb
buildout: Installing eggs
Develop: '/sample-buildout/sampley'
Develop: '/sample-buildout/samplea'
Develop: '/sample-buildout/sampleb'
Installing eggs.
Couldn't find index page for 'demoneeded' (maybe misspelled?)
zc.buildout.easy_install: Getting new distribution for demoneeded
Getting distribution for 'demoneeded'.
While:
Installing eggs
Getting distribution for demoneeded
Error: Couldn't find a distribution for demoneeded.
demoneeded is required by sampley 1.
sampley 1 is required by sampleb 1.
sampleb 1 is required by samplea 1.
Installing eggs.
Getting distribution for 'demoneeded'.
Error: Couldn't find a distribution for 'demoneeded'.
"""
......@@ -426,15 +440,15 @@ def test_comparing_saved_options_with_funny_characters():
>>> buildout = os.path.join(sample_buildout, 'bin', 'buildout')
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Installing debug
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),
buildout: Develop: /sample-buildout/recipes
buildout: Updating debug
Develop: '/sample-buildout/recipes'
Updating debug.
"""
def finding_eggs_as_local_directories():
......@@ -507,7 +521,7 @@ We'll start by creating a faux 'python' that executable that prints a
... ''')
>>> print system(join('bin', 'buildout')),
buildout: Develop: /sample-buildout/demo
Develop: '/sample-buildout/demo'
>>> import zc.buildout.easy_install
>>> ws = zc.buildout.easy_install.working_set(
......@@ -535,8 +549,8 @@ def create_sections_on_command_line():
... x = ${foo:bar}
... ''')
>>> print system(buildout + ' foo:bar=1 -vD'), # doctest: +ELLIPSIS
zc.buildout.easy_install: Installing ['zc.buildout', 'setuptools']
>>> print system(buildout + ' foo:bar=1 -vv'), # doctest: +ELLIPSIS
Installing 'zc.buildout', 'setuptools'.
...
[foo]
bar = 1
......@@ -551,11 +565,11 @@ def create_sections_on_command_line():
## listed in the configuration.
## >>> print system(join('bin', 'buildout') + ' install foo'),
## buildout: Invalid install parts: foo.
## Invalid install parts: foo.
## Install parts must be listed in the configuration.
## >>> print system(join('bin', 'buildout') + ' install foo bar'),
## buildout: Invalid install parts: foo bar.
## Invalid install parts: foo bar.
## Install parts must be listed in the configuration.
## """
......@@ -580,11 +594,7 @@ if os.path.exists(bootstrap_py):
>>> print system(sys.executable+' '+'bootstrap.py'), # doctest: +ELLIPSIS
Downloading ...
Warning: creating ...buildout.cfg
buildout: Creating directory ...bin
buildout: Creating directory ...parts
buildout: Creating directory ...eggs
buildout: Creating directory ...develop-eggs
zc.buildout.easy_install: Generated script /sample/bin/buildout.
...Generated script /sample/bin/buildout.
>>> ls(sample_buildout)
d bin
......@@ -644,11 +654,11 @@ bootstrapping.
>>> os.chdir(d)
>>> print system(os.path.join(sample_buildout, 'bin', 'buildout')
... + ' bootstrap'),
buildout: Creating directory /sample-bootstrap/bin
buildout: Creating directory /sample-bootstrap/parts
buildout: Creating directory /sample-bootstrap/eggs
buildout: Creating directory /sample-bootstrap/develop-eggs
zc.buildout.easy_install: Generated script /sample-bootstrap/bin/buildout.
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'.
"""
......@@ -671,14 +681,14 @@ def bug_92891_bootstrap_crashes_with_egg_recipe_in_buildout_section():
>>> os.chdir(d)
>>> print system(os.path.join(sample_buildout, 'bin', 'buildout')
... + ' bootstrap'),
buildout: Creating directory /sample-bootstrap/bin
buildout: Creating directory /sample-bootstrap/parts
buildout: Creating directory /sample-bootstrap/eggs
buildout: Creating directory /sample-bootstrap/develop-eggs
zc.buildout.easy_install: Generated script /sample-bootstrap/bin/buildout.
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')),
buildout: Unused options for buildout: 'scripts' 'eggs'
Unused options for buildout: 'scripts' 'eggs'.
"""
......@@ -702,7 +712,7 @@ Create a develop egg:
... """)
>>> print system(join('bin', 'buildout')),
buildout: Develop: /sample-buildout/foo
Develop: '/sample-buildout/foo'
>>> ls('develop-eggs')
- foox.egg-link
......@@ -724,8 +734,8 @@ Create another:
... """)
>>> print system(join('bin', 'buildout')),
buildout: Develop: /sample-buildout/foo
buildout: Develop: /sample-buildout/bar
Develop: '/sample-buildout/foo'
Develop: '/sample-buildout/bar'
>>> ls('develop-eggs')
- foox.egg-link
......@@ -741,7 +751,7 @@ Remove one:
... parts =
... """)
>>> print system(join('bin', 'buildout')),
buildout: Develop: /sample-buildout/bar
Develop: '/sample-buildout/bar'
It is gone
......@@ -802,15 +812,15 @@ a devlop egg, we will also generate a warning.
... """)
>>> print system(join('bin', 'buildout')),
buildout: Develop: /sample-buildout/foo
Develop: '/sample-buildout/foo'
Now, if we generate a working set using the egg link, we will get a warning
and we will get setuptools included in the working set.
>>> import logging, zope.testing.loggingsupport
>>> handler = zope.testing.loggingsupport.InstalledHandler(
... 'zc.buildout', level=logging.WARNING)
>>> logging.getLogger('zc').propagate = False
... '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(
......@@ -822,7 +832,7 @@ and we will get setuptools included in the working set.
>>> print handler
zc.buildout.easy_install WARNING
Develop distribution for foox 0.0.0
Develop distribution: foox 0.0.0
uses namespace packages but the distribution does not require setuptools.
>>> handler.clear()
......@@ -873,8 +883,8 @@ namespace package.
... """)
>>> print system(join('bin', 'buildout')),
buildout: Develop: /sample-buildout/foo
buildout: Develop: /sample-buildout/bar
Develop: '/sample-buildout/foo'
Develop: '/sample-buildout/bar'
>>> [dist.project_name
... for dist in zc.buildout.easy_install.working_set(
......@@ -886,11 +896,11 @@ namespace package.
>>> print handler,
zc.buildout.easy_install WARNING
Develop distribution for foox 0.0.0
Develop distribution: foox 0.0.0
uses namespace packages but the distribution does not require setuptools.
>>> logging.getLogger('zc').propagate = True
>>> logging.getLogger('zc.buildout.easy_install').propagate = True
>>> handler.uninstall()
'''
......@@ -974,8 +984,8 @@ Uninstall recipes need to be called when a part is removed too:
... ''')
>>> print system(join('bin', 'buildout')),
buildout: Develop: /sample-buildout/recipes
buildout: Installing demo
Develop: '/sample-buildout/recipes'
Installing demo.
installing
......@@ -989,11 +999,11 @@ Uninstall recipes need to be called when a part is removed too:
... ''')
>>> print system(join('bin', 'buildout')),
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling demo
buildout: Running uninstall recipe
Develop: '/sample-buildout/recipes'
Uninstalling demo.
Running uninstall recipe.
uninstalling
buildout: Installing demo
Installing demo.
installing
......@@ -1004,9 +1014,9 @@ Uninstall recipes need to be called when a part is removed too:
... ''')
>>> print system(join('bin', 'buildout')),
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling demo
buildout: Running uninstall recipe
Develop: '/sample-buildout/recipes'
Uninstalling demo.
Running uninstall recipe.
uninstalling
"""
......@@ -1082,21 +1092,21 @@ changes in .svn or CVS directories.
>>> print system(join(sample_buildout, 'bin', 'buildout')),
buildout: Develop: /sample-buildout/recipe
buildout: Installing foo
Develop: '/sample-buildout/recipe'
Installing foo.
>>> mkdir('recipe', '.svn')
>>> mkdir('recipe', 'CVS')
>>> print system(join(sample_buildout, 'bin', 'buildout')),
buildout: Develop: /sample-buildout/recipe
buildout: Updating foo
Develop: '/sample-buildout/recipe'
Updating foo.
>>> write('recipe', '.svn', 'x', '1')
>>> write('recipe', 'CVS', 'x', '1')
>>> print system(join(sample_buildout, 'bin', 'buildout')),
buildout: Develop: /sample-buildout/recipe
buildout: Updating foo
Develop: '/sample-buildout/recipe'
Updating foo.
"""
......@@ -1139,7 +1149,7 @@ Let's create a recipe egg
>>> write('recipe', 'README', '')
>>> print system(buildout+' setup recipe bdist_egg'), # doctest: +ELLIPSIS
buildout: Running setup script recipe/setup.py
Running setup script 'recipe/setup.py'.
...
>>> rmdir('recipe', 'build')
......@@ -1157,9 +1167,9 @@ And update our buildout to use it.
... ''' % join('recipe', 'dist'))
>>> print system(buildout),
zc.buildout.easy_install: Getting new distribution for recipe
zc.buildout.easy_install: Got recipe 1
buildout: Installing foo
Getting distribution for 'recipe'.
Got recipe 1.
Installing foo.
recipe v1
Now, if we update the recipe egg:
......@@ -1184,28 +1194,28 @@ Now, if we update the recipe egg:
>>> print system(buildout+' setup recipe bdist_egg'), # doctest: +ELLIPSIS
buildout: Running setup script recipe/setup.py
Running setup script 'recipe/setup.py'.
...
We won't get the update if we specify -N:
>>> print system(buildout+' -N'),
buildout: Updating foo
Updating foo.
recipe v1
or if we use -o:
>>> print system(buildout+' -o'),
buildout: Updating foo
Updating foo.
recipe v1
But we will if we use neither of these:
>>> print system(buildout),
zc.buildout.easy_install: Getting new distribution for recipe
zc.buildout.easy_install: Got recipe 2
buildout: Uninstalling foo
buildout: Installing foo
Getting distribution for 'recipe'.
Got recipe 2.
Uninstalling foo.
Installing foo.
recipe v2
We can also select a particular recipe version:
......@@ -1221,8 +1231,8 @@ We can also select a particular recipe version:
... ''' % join('recipe', 'dist'))
>>> print system(buildout),
buildout: Uninstalling foo
buildout: Installing foo
Uninstalling foo.
Installing foo.
recipe v1
"""
......@@ -1270,12 +1280,12 @@ uninstall
... ''')
>>> print system(buildout),
buildout: Develop: /tmp/tmpbHOHnU/_TEST_/sample-buildout/recipe
buildout: Installing foo
Develop: '/tmp/tmpbHOHnU/_TEST_/sample-buildout/recipe'
Installing foo.
>>> print system(buildout),
buildout: Develop: /tmp/tmpbHOHnU/_TEST_/sample-buildout/recipe
buildout: Updating foo
Develop: '/tmp/tmpbHOHnU/_TEST_/sample-buildout/recipe'
Updating foo.
>>> cat('.installed.cfg') # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
[buildout]
......@@ -1307,9 +1317,9 @@ def log_when_there_are_not_local_distros():
>>> print handler # doctest: +ELLIPSIS
zc.buildout.easy_install DEBUG
Installing ['demo==0.2']
Installing 'demo==0.2'.
zc.buildout.easy_install DEBUG
We have no distributions for demo that satisfies demo==0.2.
We have no distributions for demo that satisfies 'demo==0.2'.
...
>>> handler.uninstall()
......@@ -1352,11 +1362,11 @@ def internal_errors():
... ''')
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
Develop: '/sample-buildout/recipes'
While:
Installing
Getting section data-dir
Initializing part data-dir
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:
......@@ -1376,9 +1386,9 @@ def download_errors():
>>> print system(buildout), # doctest: +ELLIPSIS
While:
Installing
Checking for upgrades
Getting distribution for setuptools
Installing.
Checking for upgrades.
Getting distribution for 'setuptools'.
Error: Download error...
"""
......@@ -1421,10 +1431,10 @@ def whine_about_unused_options():
... """)
>>> print system(buildout),
buildout: Develop: /tmp/tmpsueWpG/_TEST_/sample-buildout/.
buildout: Unused options for buildout: 'a'
buildout: Installing foo
buildout: Unused options for foo: 'z'
Develop: '/tmp/tmpsueWpG/_TEST_/sample-buildout/.'
Unused options for buildout: 'a'.
Installing foo.
Unused options for foo: 'z'.
'''
def abnormal_exit():
......@@ -1489,21 +1499,21 @@ Now let's look at 3 cases:
... ''')
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Installing p1
buildout: Installing p2
buildout: Installing p3
Develop: '/sample-buildout/recipes'
Installing p1.
Installing p2.
Installing p3.
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Updating p1
buildout: Updating p2
buildout: Installing p3
Develop: '/sample-buildout/recipes'
Updating p1.
Updating p2.
Installing p3.
>>> print system(buildout+' buildout:parts='),
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling p2
buildout: Uninstalling p1
Develop: '/sample-buildout/recipes'
Uninstalling p2.
Uninstalling p1.
2. We exit while updating:
......@@ -1527,24 +1537,24 @@ Now let's look at 3 cases:
... ''')
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Installing p1
buildout: Installing p2
buildout: Installing p3
buildout: Installing p4
Develop: '/sample-buildout/recipes'
Installing p1.
Installing p2.
Installing p3.
Installing p4.
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Updating p1
buildout: Updating p2
buildout: Updating p3
Develop: '/sample-buildout/recipes'
Updating p1.
Updating p2.
Updating p3.
>>> print system(buildout+' buildout:parts='),
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling p2
buildout: Uninstalling p1
buildout: Uninstalling p4
buildout: Uninstalling p3
Develop: '/sample-buildout/recipes'
Uninstalling p2.
Uninstalling p1.
Uninstalling p4.
Uninstalling p3.
3. We exit while installing or updating after uninstalling:
......@@ -1568,11 +1578,11 @@ Now let's look at 3 cases:
... ''')
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Installing p1
buildout: Installing p2
buildout: Installing p3
buildout: Installing p4
Develop: '/sample-buildout/recipes'
Installing p1.
Installing p2.
Installing p3.
Installing p4.
>>> write('buildout.cfg',
... '''
......@@ -1595,9 +1605,9 @@ Now let's look at 3 cases:
... ''')
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling p4
buildout: Updating p1
Develop: '/sample-buildout/recipes'
Uninstalling p4.
Updating p1.
>>> write('buildout.cfg',
... '''
......@@ -1619,12 +1629,12 @@ Now let's look at 3 cases:
... ''')
>>> print system(buildout),
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling p1
buildout: Installing p1
buildout: Updating p2
buildout: Updating p3
buildout: Installing p4
Develop: '/sample-buildout/recipes'
Uninstalling p1.
Installing p1.
Updating p2.
Updating p3.
Installing p4.
"""
......@@ -1652,7 +1662,7 @@ def install_source_dist_with_bad_py():
... ''')
>>> print system(buildout+' setup badegg sdist'), # doctest: +ELLIPSIS
buildout: Running setup script badegg/setup.py
Running setup script 'badegg/setup.py'.
...
>>> dist = join('badegg', 'dist')
......@@ -1673,18 +1683,18 @@ def install_source_dist_with_bad_py():
... scripts = buildout=bo
... ''' % globals())
>>> print system('buildout'),
buildout: Not upgrading because not running a local buildout command
buildout: Installing eggs
zc.buildout.easy_install: Getting new distribution for badegg
>>> print system(buildout),
Installing eggs.
Getting distribution for 'badegg'.
File "build/bdist.linux-i686/egg/badegg/scripts/one.py", line 2
return 1
SyntaxError: 'return' outside function
File "/sample-buildout/eggs/badegg-1-py2.4.egg/badegg/scripts/one.py", line 2
return 1
SyntaxError: 'return' outside function
zc.buildout.easy_install: Got badegg 1
buildout: Installing bo
Got badegg 1.
Installing bo.
Generated script '/sample-buildout/bin/bo'.
>>> ls('eggs') # doctest: +ELLIPSIS
d badegg-1-py2.4.egg
......@@ -1738,12 +1748,12 @@ def bug_105081_Specific_egg_versions_are_ignored_when_newer_eggs_are_around():
... ''' % globals())
>>> print system(buildout),
buildout: Installing x
zc.buildout.easy_install: Getting new distribution for demo
zc.buildout.easy_install: Got demo 0.3
zc.buildout.easy_install: Getting new distribution for demoneeded
zc.buildout.easy_install: Got demoneeded 1.1
zc.buildout.easy_install: Generated script /sample-buildout/bin/demo.
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')),
3 1
......@@ -1760,11 +1770,11 @@ def bug_105081_Specific_egg_versions_are_ignored_when_newer_eggs_are_around():
... ''' % globals())
>>> print system(buildout),
buildout: Uninstalling x
buildout: Installing x
zc.buildout.easy_install: Getting new distribution for demo==0.1
zc.buildout.easy_install: Got demo 0.1
zc.buildout.easy_install: Generated script /sample-buildout/bin/demo.
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')),
1 1
......@@ -1793,8 +1803,8 @@ if sys.version_info > (2, 4):
>>> call(buildout)
While:
Installing
Getting section x
Installing.
Getting section x.
Error: The referenced section, 'x', was not defined.
<BLANKLINE>
Exit: True
......@@ -1822,12 +1832,12 @@ if sys.version_info > (2, 4):
... ''')
>>> call(buildout)
buildout: Develop: /sample-buildout/.
Develop: '/sample-buildout/.'
While:
Installing
Getting section x
Initializing section x
Loading zc.buildout recipe entry zc.buildout.testexit:default
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:
......@@ -1878,13 +1888,13 @@ def bug_59270_recipes_always_start_in_buildout_dir():
>>> os.chdir('bad_start')
>>> print system(join(sample_buildout, 'bin', 'buildout')
... +' -c '+join(sample_buildout, 'buildout.cfg')),
buildout: Develop: /tmp/tmpV9ptXUbuildoutSetUp/_TEST_/sample-buildout/.
Develop: '/tmp/tmpV9ptXUbuildoutSetUp/_TEST_/sample-buildout/.'
/sample-buildout
/sample-buildout
buildout: Installing b1
Installing b1.
/sample-buildout
/sample-buildout/bad_start
buildout: Installing b2
Installing b2.
/sample-buildout
/sample-buildout/bad_start
......@@ -1920,13 +1930,106 @@ def bug_75607_buildout_should_not_run_if_it_creates_an_empty_buildout_cfg():
>>> remove('buildout.cfg')
>>> print system(buildout),
While:
Initializing
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),
Develop: '/sample-buildout/pack0'
Develop: '/sample-buildout/pack1'
Develop: '/sample-buildout/pack2'
Develop: '/sample-buildout/pack3'
Develop: '/sample-buildout/pack4'
Installing pack1.
Couldn't find index page for 'pack5' (maybe misspelled?)
Getting distribution for 'pack5'.
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'),
Installing 'zc.buildout', 'setuptools'.
We have a develop egg: zc.buildout 1.0.0
We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.6
Develop: '/sample-buildout/pack0'
Develop: '/sample-buildout/pack1'
Develop: '/sample-buildout/pack2'
Develop: '/sample-buildout/pack3'
Develop: '/sample-buildout/pack4'
Installing 'zc.recipe.egg'.
We have a develop egg: zc.recipe.egg 1.0.0
Installing pack1.
Installing 'pack0'.
We have a develop egg: pack0 0.0.0
Getting required 'pack4'
required by pack0 0.0.0.
We have a develop egg: pack4 0.0.0
Getting required 'pack3'
required by pack0 0.0.0.
required by pack4 0.0.0.
We have a develop egg: pack3 0.0.0
Getting required 'pack2'
required by pack0 0.0.0.
required by pack3 0.0.0.
required by pack4 0.0.0.
We have a develop egg: pack2 0.0.0
Getting required 'pack1'
required by pack0 0.0.0.
required by pack2 0.0.0.
required by pack3 0.0.0.
required by pack4 0.0.0.
We have a develop egg: pack1 0.0.0
Getting required 'pack5'
required by pack4 0.0.0.
We have no distributions for pack5 that satisfies 'pack5'.
Couldn't find index page for 'pack5' (maybe misspelled?)
Getting distribution for 'pack5'.
While:
Installing pack1.
Getting distribution for 'pack5'.
Error: Couldn't find a distribution for 'pack5'.
"""
######################################################################
def create_sample_eggs(test, executable=sys.executable):
......@@ -2130,8 +2233,11 @@ def test_suite():
'zc.buildout.egg'),
(re.compile('creating \S*setup.cfg'), 'creating setup.cfg'),
(re.compile('hello\%ssetup' % os.path.sep), 'hello/setup'),
(re.compile('zc.buildout.easy_install.picked: (\S+) = \S+'),
'picked \\1 = V.V'),
(re.compile('Picked: (\S+) = \S+'),
'Picked: \\1 = V.V'),
(re.compile(r'We have a develop egg: zc.buildout (\S+)'),
'We have a develop egg: zc.buildout X.X.'),
])
),
doctest.DocFileSuite(
......@@ -2193,6 +2299,11 @@ def test_suite():
'zc.buildout.egg'),
(re.compile('File "\S+one.py"'),
'File "one.py"'),
(re.compile(r'We have a develop egg: (\S+) (\S+)'),
r'We have a develop egg: \1 V'),
(re.compile('Picked: setuptools = \S+'),
'Picked: setuptools = V'),
]),
),
))
......
......@@ -64,17 +64,17 @@ Now if we run the buildout, the buildout will upgrade itself to the
new versions found in new releases:
>>> print system(buildout),
zc.buildout.easy_install: Getting new distribution for zc.buildout
zc.buildout.easy_install: Got zc.buildout 99.99
zc.buildout.easy_install: Getting new distribution for setuptools
zc.buildout.easy_install: Got setuptools 99.99
buildout: Upgraded:
Getting distribution for 'zc.buildout'.
Got zc.buildout 99.99.
Getting distribution for 'setuptools'.
Got setuptools 99.99.
Upgraded:
zc.buildout version 99.99,
setuptools version 99.99;
restarting.
zc.buildout.easy_install: Generated script /sample-buildout/bin/buildout.
buildout: Develop: /sample-buildout/showversions
buildout: Installing show-versions
Generated script '/sample-buildout/bin/buildout'.
Develop: '/sample-buildout/showversions'
Installing show-versions.
zc.buildout 99.99
setuptools 99.99
......@@ -117,13 +117,13 @@ version:
We'll actually "upgrade" to an earlier version.
>>> print system(buildout),
buildout: Upgraded:
Upgraded:
zc.buildout version 1.0.0,
setuptools version 0.6;
restarting.
zc.buildout.easy_install: Generated script /sample-buildout/bin/buildout.
buildout: Develop: /sample-buildout/showversions
buildout: Updating show-versions
Generated script '/sample-buildout/bin/buildout'.
Develop: '/sample-buildout/showversions'
Updating show-versions.
zc.buildout 1.0.0
setuptools 0.6
......@@ -142,16 +142,16 @@ We won't upgrade in offline mode:
... """ % dict(new_releases=new_releases))
>>> print system(buildout+' -o'),
buildout: Develop: /sample-buildout/showversions
buildout: Updating show-versions
Develop: '/sample-buildout/showversions'
Updating show-versions.
zc.buildout 1.0.0
setuptools 0.6
Or in non-newest mode:
>>> print system(buildout+' -N'),
buildout: Develop: /sample-buildout/showversions
buildout: Updating show-versions
Develop: '/sample-buildout/showversions'
Updating show-versions.
zc.buildout 1.0.0
setuptools 0.6
......@@ -170,14 +170,14 @@ directory:
>>> cd(sample_buildout2)
>>> print system(buildout),
buildout: Creating directory /sample_buildout2/bin
buildout: Creating directory /sample_buildout2/parts
buildout: Creating directory /sample_buildout2/eggs
buildout: Creating directory /sample_buildout2/develop-eggs
zc.buildout.easy_install: Getting new distribution for zc.buildout
zc.buildout.easy_install: Got zc.buildout 99.99
zc.buildout.easy_install: Getting new distribution for setuptools
zc.buildout.easy_install: Got setuptools 99.99
buildout: Not upgrading because not running a local buildout command
Creating directory '/sample_buildout2/bin'.
Creating directory '/sample_buildout2/parts'.
Creating directory '/sample_buildout2/eggs'.
Creating directory '/sample_buildout2/develop-eggs'.
Getting distribution for 'zc.buildout'.
Got zc.buildout 99.99.
Getting distribution for 'setuptools'.
Got setuptools 99.99.
Not upgrading because not running a local buildout command.
>>> ls('bin')
......@@ -65,11 +65,11 @@ Let's run the buildout:
>>> import os
>>> print system(buildout),
buildout: Installing demo
zc.buildout.easy_install: Getting new distribution for demo<0.3
zc.buildout.easy_install: Got demo 0.2
zc.buildout.easy_install: Getting new distribution for demoneeded
zc.buildout.easy_install: Got demoneeded 1.1
Installing demo.
Getting distribution for 'demo<0.3'.
Got demo 0.2.
Getting distribution for 'demoneeded'.
Got demoneeded 1.1.
Now, if we look at the buildout eggs directory:
......@@ -109,9 +109,9 @@ scripts recipe:
... """ % dict(server=link_server))
>>> print system(buildout),
buildout: Uninstalling demo
buildout: Installing demo
zc.buildout.easy_install: Generated script /sample-buildout/bin/demo.
Uninstalling demo.
Installing demo.
Generated script '/sample-buildout/bin/demo'.
Now we also see the script defined by the dmo script:
......@@ -171,10 +171,10 @@ specification. We were able to do this because the scripts recipe if
the default entry point for the zc.recipe.egg egg.
>>> print system(buildout),
buildout: Uninstalling demo
buildout: Installing demo
zc.buildout.easy_install: Generated script /sample-buildout/bin/demo.
zc.buildout.easy_install: Generated interpreter /sample-buildout/bin/py-demo.
Uninstalling demo.
Installing demo.
Generated script '/sample-buildout/bin/demo'.
Generated interpreter '/sample-buildout/bin/py-demo'.
Now we also get a py-demo script for giving us a Python prompt with
the path for demo and any eggs it depends on included in sys.path.
......@@ -229,9 +229,9 @@ remove the restriction on demo:
and run the buildout in non-newest mode:
>>> print system(buildout+' -N'),
buildout: Uninstalling demo
buildout: Installing demo
zc.buildout.easy_install: Generated script /sample-buildout/bin/demo.
Uninstalling demo.
Installing demo.
Generated script '/sample-buildout/bin/demo'.
Note that we removed the eggs option, and the eggs defaulted to the
part name. Because we removed the eggs option, the demo was
......@@ -240,8 +240,7 @@ reinstalled.
We'll also run the buildout in off-line mode:
>>> print system(buildout+' -o'),
buildout: Updating demo
zc.buildout.easy_install: Generated script /sample-buildout/bin/demo.
Updating demo.
We didn't get an update for demo:
......@@ -255,10 +254,10 @@ If we run the buildout on the default online and newest modes,
we'll get an update for demo:
>>> print system(buildout),
buildout: Updating demo
zc.buildout.easy_install: Getting new distribution for demo
zc.buildout.easy_install: Got demo 0.3
zc.buildout.easy_install: Generated script /sample-buildout/bin/demo.
Updating demo.
Getting distribution for 'demo'.
Got demo 0.3.
Generated script '/sample-buildout/bin/demo'.
Then we'll get a new demo egg:
......@@ -295,8 +294,8 @@ arguments:
>>> print system(buildout),
buildout: Uninstalling demo
buildout: Installing demo
Uninstalling demo.
Installing demo.
>>> ls(sample_buildout, 'bin')
- buildout
......@@ -316,9 +315,9 @@ You can also control the name used for scripts:
... """ % dict(server=link_server))
>>> print system(buildout),
buildout: Uninstalling demo
buildout: Installing demo
zc.buildout.easy_install: Generated script /sample-buildout/bin/foo.
Uninstalling demo.
Installing demo.
Generated script '/sample-buildout/bin/foo'.
>>> ls(sample_buildout, 'bin')
- buildout
......@@ -346,9 +345,9 @@ extra-paths option:
... """ % dict(server=link_server))
>>> print system(buildout),
buildout: Uninstalling demo
buildout: Installing demo
zc.buildout.easy_install: Generated script /sample-buildout/bin/foo.
Uninstalling demo.
Installing demo.
Generated script '/sample-buildout/bin/foo'.
Let's look at the script that was generated:
......@@ -395,9 +394,9 @@ to be included in generated scripts:
... """ % dict(server=link_server))
>>> print system(buildout),
buildout: Uninstalling demo
buildout: Installing demo
zc.buildout.easy_install: Generated script /sample-buildout/bin/foo.
Uninstalling demo.
Installing demo.
Generated script '/sample-buildout/bin/foo'.
>>> cat(sample_buildout, 'bin', 'foo') # doctest: +NORMALIZE_WHITESPACE
#!/usr/local/bin/python2.4
......@@ -445,11 +444,11 @@ declare entry points using the entry-points option:
... """ % dict(server=link_server))
>>> print system(buildout),
buildout: Uninstalling demo
buildout: Installing demo
zc.buildout.easy_install: Generated script /sample-buildout/bin/demo.
zc.buildout.easy_install: Generated script /sample-buildout/bin/alt.
zc.buildout.easy_install: Generated script /sample-buildout/bin/other.
Uninstalling demo.
Installing demo.
Generated script '/sample-buildout/bin/demo'.
Generated script '/sample-buildout/bin/alt'.
Generated script '/sample-buildout/bin/other'.
>>> ls(sample_buildout, 'bin')
- alt
......@@ -492,6 +491,6 @@ be made to contact an index server:
... """ % dict(server=link_server))
>>> print system(buildout),
buildout: Uninstalling demo
buildout: Installing demo
zc.buildout.easy_install: Generated script /sample-buildout/bin/foo.
Uninstalling demo.
Installing demo.
Generated script '/sample-buildout/bin/foo'.
......@@ -133,7 +133,7 @@ the egg:
... """ % dict(server=link_server))
>>> print system(buildout),
buildout: Installing extdemo
Installing extdemo.
zip_safe flag not set; analyzing archive contents...
We got the zip_safe warning because the source distribution we used
......@@ -189,10 +189,10 @@ Let's define a script that uses out ext demo:
... """ % dict(server=link_server))
>>> print system(buildout),
buildout: Develop: /sample-buildout/demo
buildout: Updating extdemo
buildout: Installing demo
zc.buildout.easy_install: Generated script /sample-buildout/bin/demo.
Develop: '/sample-buildout/demo'
Updating extdemo.
Installing demo.
Generated script '/sample-buildout/bin/demo'.
When we run the script, we'll 42 printed:
......@@ -212,16 +212,14 @@ distribution for extdemo:
If we run the buildout in non-newest or offline modes:
>>> print system(buildout+' -N'),
buildout: Develop: /sample-buildout/demo
buildout: Updating extdemo
buildout: Updating demo
zc.buildout.easy_install: Generated script /sample-buildout/bin/demo.
Develop: '/sample-buildout/demo'
Updating extdemo.
Updating demo.
>>> print system(buildout+' -o'),
buildout: Develop: /sample-buildout/demo
buildout: Updating extdemo
buildout: Updating demo
zc.buildout.easy_install: Generated script /sample-buildout/bin/demo.
Develop: '/sample-buildout/demo'
Updating extdemo.
Updating demo.
We won't get an update.
......@@ -234,11 +232,11 @@ But if we run the buildout in the default on-line and newest modes, we
will:
>>> print system(buildout),
buildout: Develop: /sample-buildout/demo
buildout: Updating extdemo
Develop: '/sample-buildout/demo'
Updating extdemo.
zip_safe flag not set; analyzing archive contents...
buildout: Updating demo
zc.buildout.easy_install: Generated script /sample-buildout/bin/demo.
Updating demo.
Generated script '/sample-buildout/bin/demo'.
>>> ls(sample_buildout, 'develop-eggs')
- demo.egg-link
......@@ -272,13 +270,13 @@ We can specify a specific version using the egg option:
... """ % dict(server=link_server))
>>> print system(buildout+' -D'),
buildout: Develop: /sample-buildout/demo
buildout: Uninstalling demo
buildout: Uninstalling extdemo
buildout: Installing extdemo
Develop: '/sample-buildout/demo'
Uninstalling demo.
Uninstalling extdemo.
Installing extdemo.
zip_safe flag not set; analyzing archive contents...
buildout: Installing demo
zc.buildout.easy_install: Generated script /sample-buildout/bin/demo.
Installing demo.
Generated script '/sample-buildout/bin/demo'.
>>> ls(sample_buildout, 'develop-eggs')
- demo.egg-link
......@@ -383,12 +381,12 @@ TWO to be defined. This will cause the module-variable, 'val', to be
set with a value of 2.
>>> print system(buildout),
buildout: Develop: /sample-buildout/demo
buildout: Uninstalling demo
buildout: Uninstalling extdemo
buildout: Installing extdemo
buildout: Installing demo
zc.buildout.easy_install: Generated script /sample-buildout/bin/demo.
Develop: '/sample-buildout/demo'
Uninstalling demo.
Uninstalling extdemo.
Installing extdemo.
Installing demo.
Generated script '/sample-buildout/bin/demo'.
Our develop-eggs now includes an egg link for extdemo:
......
......@@ -48,15 +48,15 @@ Now, if we run the buildout:
>>> os.chdir(sample_buildout)
>>> buildout = os.path.join(sample_buildout, 'bin', 'buildout')
>>> print system(buildout),
buildout: Installing demo
zc.buildout.easy_install: Getting new distribution for demo<0.3
zc.buildout.easy_install: Got demo 0.2
zc.buildout.easy_install: Getting new distribution for demoneeded
zc.buildout.easy_install: Getting new distribution for setuptools
zc.buildout.easy_install: Got setuptools 0.6
zc.buildout.easy_install: Got demoneeded 1.1
zc.buildout.easy_install: Generated script /sample-buildout/bin/demo.
zc.buildout.easy_install: Generated interpreter /sample-buildout/bin/py-demo.
Installing demo.
Getting distribution for 'demo<0.3'.
Got demo 0.2.
Getting distribution for 'demoneeded'.
Getting distribution for 'setuptools'.
Got setuptools 0.6.
Got demoneeded 1.1.
Generated script '/sample-buildout/bin/demo'.
Generated interpreter '/sample-buildout/bin/py-demo'.
we'll get the Python 2.3 eggs for demo and demoneeded:
......
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