Commit ae2fe262 authored by Reinout van Rees's avatar Reinout van Rees

Added notes on what to do for buildout-versions integration.

I need to go through buildout-versions' finish() method, still.
parent 84857c91
...@@ -204,6 +204,8 @@ class Buildout(DictMixin): ...@@ -204,6 +204,8 @@ class Buildout(DictMixin):
# apply command-line options # apply command-line options
_update(data, cloptions) _update(data, cloptions)
# REINOUT: potentially add a lowercase-key-using special kind of dict
# for the versions.
# Set up versions section, if necessary # Set up versions section, if necessary
if 'versions' not in data['buildout']: if 'versions' not in data['buildout']:
data['buildout']['versions'] = 'versions', 'DEFAULT_VALUE' data['buildout']['versions'] = 'versions', 'DEFAULT_VALUE'
...@@ -230,6 +232,19 @@ class Buildout(DictMixin): ...@@ -230,6 +232,19 @@ class Buildout(DictMixin):
if k not in versions if k not in versions
)) ))
# REINOUT: add check for python version.
# python_version = current_versions.get('python')
# if python_version and python_version not in sys.version:
# raise IncompatibleVersionError(
# "python version specified not found in sys.version:",
# python_version
# )
# REINOUT: look for buildout versions file option.
# # record file name, if needed
# if 'buildout_versions_file' in buildout['buildout']:
# file_name = buildout['buildout']['buildout_versions_file']
self._annotated = copy.deepcopy(data) self._annotated = copy.deepcopy(data)
self._raw = _unannotate(data) self._raw = _unannotate(data)
self._data = {} self._data = {}
...@@ -1792,3 +1807,7 @@ def bool_option(options, name, default=None): ...@@ -1792,3 +1807,7 @@ def bool_option(options, name, default=None):
except KeyError: except KeyError:
raise zc.buildout.UserError( raise zc.buildout.UserError(
'Invalid value for %r option: %r' % (name, value)) 'Invalid value for %r option: %r' % (name, value))
# REINOUT: add a new bool_option for allow_picked_versions so that 'show' is
# also an acceptable value.
# Or add a nice boolean show_picked_versions option.
...@@ -69,6 +69,10 @@ buildout_and_distribute_path = [ ...@@ -69,6 +69,10 @@ buildout_and_distribute_path = [
FILE_SCHEME = re.compile('file://', re.I).match FILE_SCHEME = re.compile('file://', re.I).match
# REINOUT: two new globals.
# required_by = {}
# picked_versions = {} # This one could perhaps be local, on Installer?
class AllowHostsPackageIndex(setuptools.package_index.PackageIndex): class AllowHostsPackageIndex(setuptools.package_index.PackageIndex):
"""Will allow urls that are local to the system. """Will allow urls that are local to the system.
...@@ -516,6 +520,9 @@ class Installer: ...@@ -516,6 +520,9 @@ class Installer:
): ):
logger.debug('Picked: %s = %s', logger.debug('Picked: %s = %s',
dist.project_name, dist.version) dist.project_name, dist.version)
# REINOUT: add the next line.
# picked_versions[dist.project_name] = dist.version
if not self._allow_picked_versions: if not self._allow_picked_versions:
raise zc.buildout.UserError( raise zc.buildout.UserError(
'Picked: %s = %s' % (dist.project_name, dist.version) 'Picked: %s = %s' % (dist.project_name, dist.version)
...@@ -546,6 +553,13 @@ class Installer: ...@@ -546,6 +553,13 @@ class Installer:
def _constrain(self, requirement): def _constrain(self, requirement):
constraint = self._versions.get(requirement.project_name) constraint = self._versions.get(requirement.project_name)
# REINOUT: use the line below, with the .lower().
# Alternative is perhaps to use a self._versions that always uses
# lowercase keys.
# Actually, this lower-casing happens in buildout-versions, so we need
# to do it too. See buildout.py.
# constraint = self._versions.get(requirement.project_name.lower())
if constraint: if constraint:
requirement = _constrained_requirement(constraint, requirement) requirement = _constrained_requirement(constraint, requirement)
...@@ -1234,12 +1248,18 @@ def _log_requirement(ws, req): ...@@ -1234,12 +1248,18 @@ def _log_requirement(ws, req):
# decrease of run time from 93.411 to 15.068 seconds, about a # decrease of run time from 93.411 to 15.068 seconds, about a
# 6 fold improvement. # 6 fold improvement.
return return
# REINOUT add extra check for 'allow-picked-versions=show'.
ws = list(ws) ws = list(ws)
ws.sort() ws.sort()
for dist in ws: for dist in ws:
if req in dist.requires(): if req in dist.requires():
logger.debug(" required by %s." % dist) logger.debug(" required by %s." % dist)
# REINOUT add the following lines.
# req_ = str(req)
# if req_ not in required_by:
# required_by[req_] = set()
# required_by[req_].add(str(dist.as_requirement()))
def _fix_file_links(links): def _fix_file_links(links):
for link in links: for link in links:
......
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