[Checkins] SVN: zc.buildout/branches/gary-support-system-python/ changes per review by flacoste
Gary Poster
gary.poster at canonical.com
Mon Jul 13 21:24:48 EDT 2009
Log message for revision 101879:
changes per review by flacoste
Changed:
U zc.buildout/branches/gary-support-system-python/bootstrap/bootstrap.py
U zc.buildout/branches/gary-support-system-python/src/zc/buildout/buildout.py
U zc.buildout/branches/gary-support-system-python/src/zc/buildout/easy_install.py
U zc.buildout/branches/gary-support-system-python/src/zc/buildout/tests.py
-=-
Modified: zc.buildout/branches/gary-support-system-python/bootstrap/bootstrap.py
===================================================================
--- zc.buildout/branches/gary-support-system-python/bootstrap/bootstrap.py 2009-07-13 21:41:48 UTC (rev 101878)
+++ zc.buildout/branches/gary-support-system-python/bootstrap/bootstrap.py 2009-07-14 01:24:48 UTC (rev 101879)
@@ -56,13 +56,15 @@
By using --ez_setup-source and --download-base to point to local resources,
you can keep this script from going over the network.
''' % configuration)
-match_equals = re.compile(r'(%s)=(\S*)' % ('|'.join(configuration),)).match
+match_equals = re.compile(r'(%s)=(.*)' % ('|'.join(configuration),)).match
args = sys.argv[1:]
if args == ['--help']:
print helpstring
sys.exit(0)
-# defaults
+# If we end up using a temporary directory for storing our eggs, this will
+# hold the path of that directory. On the other hand, if an explicit directory
+# is specified in the argv, this will remain None.
tmpeggs = None
while args:
@@ -84,13 +86,13 @@
for name in ('--ez_setup-source', '--download-base'):
val = configuration[name]
- if val is not None and '://' not in val: # we're being lazy.
+ if val is not None and '://' not in val: # We're being lazy.
configuration[name] = 'file://%s' % (
urllib.pathname2url(os.path.abspath(os.path.expanduser(val))),)
if (configuration['--download-base'] and
not configuration['--download-base'].endswith('/')):
- # download base needs a trailing slash to make the world happy
+ # Download base needs a trailing slash to make the world happy.
configuration['--download-base'] += '/'
if not configuration['--eggs']:
@@ -99,8 +101,10 @@
configuration['--eggs'] = os.path.abspath(
os.path.expanduser(configuration['--eggs']))
+# The requirement is what we will pass to setuptools to specify zc.buildout.
+requirement = 'zc.buildout'
if configuration['--version']:
- configuration['--version'] = '==' + configuration['--version']
+ requirement += '==' + configuration['--version']
try:
import pkg_resources
@@ -132,7 +136,7 @@
if configuration['--download-base']:
cmd.extend(['-f', quote(configuration['--download-base'])])
-cmd.append('zc.buildout' + configuration['--version'])
+cmd.append(requirement)
ws = pkg_resources.working_set
env = dict(
@@ -153,7 +157,7 @@
sys.exit(exitcode)
ws.add_entry(configuration['--eggs'])
-ws.require('zc.buildout' + configuration['--version'])
+ws.require(requirement)
import zc.buildout.buildout
args.append('bootstrap')
zc.buildout.buildout.main(args)
Modified: zc.buildout/branches/gary-support-system-python/src/zc/buildout/buildout.py
===================================================================
--- zc.buildout/branches/gary-support-system-python/src/zc/buildout/buildout.py 2009-07-13 21:41:48 UTC (rev 101878)
+++ zc.buildout/branches/gary-support-system-python/src/zc/buildout/buildout.py 2009-07-14 01:24:48 UTC (rev 101879)
@@ -290,7 +290,7 @@
# Get a base working set for our distributions that corresponds to the
# stated desires in the configuration.
- distributions = ['setuptools', 'zc.buildout']
+ distributions = ['setuptools', 'zc.buildout']
if options.get('offline') == 'true':
ws = zc.buildout.easy_install.working_set(
distributions, options['executable'],
Modified: zc.buildout/branches/gary-support-system-python/src/zc/buildout/easy_install.py
===================================================================
--- zc.buildout/branches/gary-support-system-python/src/zc/buildout/easy_install.py 2009-07-13 21:41:48 UTC (rev 101878)
+++ zc.buildout/branches/gary-support-system-python/src/zc/buildout/easy_install.py 2009-07-14 01:24:48 UTC (rev 101879)
@@ -712,9 +712,9 @@
logger.debug('Installing %s.', repr(specs)[1:-1])
path = self._path
- dest = self._dest
- if dest is not None and dest not in path:
- path.insert(0, dest)
+ destination = self._dest
+ if destination is not None and destination not in path:
+ path.insert(0, destination)
requirements = [self._constrain(pkg_resources.Requirement.parse(spec))
for spec in specs]
@@ -739,23 +739,23 @@
# versions_section_ignored_for_dependency_in_favor_of_site_packages in
# zc.buildout.tests).
#
- requirements.reverse() # set up the stack
- processed = {} # set of processed requirements
- best = {} # key -> dist
+ requirements.reverse() # Set up the stack.
+ processed = {} # This is a set of processed requirements.
+ best = {} # This is a mapping of key -> dist.
#
# Note that we don't use the existing environment, because we want
# to look for new eggs unless what we have is the best that
# matches the requirement.
env = pkg_resources.Environment(ws.entries)
while requirements:
- # process dependencies breadth-first
+ # Process dependencies breadth-first.
req = self._constrain(requirements.pop(0))
if req in processed:
- # Ignore cyclic or redundant dependencies
+ # Ignore cyclic or redundant dependencies.
continue
dist = best.get(req.key)
if dist is None:
- # Find the best distribution and add it to the map
+ # Find the best distribution and add it to the map.
dist = ws.by_key.get(req.key)
if dist is None:
try:
@@ -763,7 +763,7 @@
except pkg_resources.VersionConflict, err:
raise VersionConflict(err, ws)
if dist is None:
- if dest:
+ if destination:
logger.debug('Getting required %r', str(req))
else:
logger.debug('Adding required %r', str(req))
@@ -773,7 +773,7 @@
ws.add(dist)
self._maybe_add_setuptools(ws, dist)
if dist not in req:
- # Oops, the "best" so far conflicts with a dependency
+ # Oops, the "best" so far conflicts with a dependency.
raise VersionConflict(
pkg_resources.VersionConflict(dist, req), ws)
requirements.extend(dist.requires(req.extras)[::-1])
Modified: zc.buildout/branches/gary-support-system-python/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/branches/gary-support-system-python/src/zc/buildout/tests.py 2009-07-13 21:41:48 UTC (rev 101878)
+++ zc.buildout/branches/gary-support-system-python/src/zc/buildout/tests.py 2009-07-14 01:24:48 UTC (rev 101879)
@@ -2787,6 +2787,13 @@
######################################################################
def create_sample_eggs(test, executable=sys.executable):
+ """Creates sample eggs, source distributions, and a faux site-packages."
+
+ Unlike the faux site-packages created by
+ ``get_executable_with_site_packages``, this one has packages installed the
+ way distributions often install eggs in system Pythons (via
+ zc.buildout.testing.sys_install).
+ """
write = test.globs['write']
dest = test.globs['sample_eggs']
site_packages = test.globs['tmpdir']('site_packages')
@@ -2914,7 +2921,7 @@
test.globs['sample_eggs'])
test.globs['update_extdemo'] = lambda : add_source_dist(test, 1.5)
zc.buildout.testing.install_develop('zc.recipe.egg', test)
- # most tests don't need this set up, and it takes some time, so we just
+ # Most tests don't need this set up, and it takes some time, so we just
# make it available as a convenience.
def get_executable_with_site_packages(requirements=None):
executable_buildout = test.globs['tmpdir']('executable')
More information about the Checkins
mailing list