Permalink
Browse files

Handles package version requirements by checking if requirement versi…

…on is overrun by newer version.
  • Loading branch information...
1 parent 4a25ae1 commit ee35a2ea5a7c0a4158bedc466c61480d488a50e3 Jukka Ojaniemi committed Mar 15, 2013
Showing with 12 additions and 3 deletions.
  1. +12 −3 whiskers/views/buildouts.py
@@ -81,7 +81,7 @@ def add_buildout(self, data, host, checksum):
version = Version.get_by_version(package_info['version']) or\
Version.add(package_info['version'], equation)
requirements = self.get_requirements(
- package_info['requirements'])
+ package_info['requirements'], data.versionmap)
package = Package.add(package_info['name'],
version,
requirements)
@@ -94,18 +94,27 @@ def add_buildout(self, data, host, checksum):
DBSession.add(buildout)
return buildout
- def get_requirements(self, requirements):
+ def get_requirements(self, requirements, versionmap):
"""Return list of package requirements."""
packages = []
for req in requirements:
name = req.get('name')
version = req.get('version')
+ # Below version related code is crap
+ # TODO: Clean the crap
+ if not version:
+ try:
+ version = versionmap[name]
+ except KeyError:
+ version = 'stdlib'
+ else:
+ if version != versionmap[name]:
+ version = versionmap[name]
package = Package.get_by_nameversion(name,
version)
if not package:
equation = req.get('equation', None)
- version = req.get('version', 'stdlib')
version = Version.get_by_version(version) or\
Version.add(version, equation)
package = Package.add(req['name'], version)

0 comments on commit ee35a2e

Please sign in to comment.