diff options
author | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2014-11-05 16:51:14 +0000 |
---|---|---|
committer | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2014-11-05 16:51:14 +0000 |
commit | 136c90b6d655188026d29d806aece65305cf0aef (patch) | |
tree | b7fe58e545c05866b9dc1449039fcf29b8cce990 | |
parent | 20038fd313146bd55b6acf6b268b8f5558437d54 (diff) | |
download | import-136c90b6d655188026d29d806aece65305cf0aef.tar.gz |
The beginnings of conflict detection
-rwxr-xr-x | exts/pip.find_deps | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/exts/pip.find_deps b/exts/pip.find_deps index 1749085..d6bff0a 100755 --- a/exts/pip.find_deps +++ b/exts/pip.find_deps @@ -119,6 +119,7 @@ def find_build_deps(source, name, version=None): build_deps[r.project_name] = Dependency() for (op, version) in r.specs: + version = float(version) # >.> #if no_conflict(requirements_versions_map[r.project_name], s): # requirements_versions_map[r.project_name] += s dep = build_deps[r.project_name] @@ -126,11 +127,34 @@ def find_build_deps(source, name, version=None): if op == '==': if dep.is_unconstrained(): dep.set_absolute_version(version) - elif dep.is_unbounded()and version not in dep.excludes: + elif dep.is_unbounded() and version not in dep.excludes: dep.set_absolute_version(version) else: - error('conflict!') + error('conflict! == %f conflicts with %s%s' + % (version, + ('> %f' % dep.min) if dep.min else '', + ('< %f' % dep.max) if dep.max else '')) # conflict + elif op == '!=': + dep.excludes += version + elif op == '<': + if dep.is_unconstrained(): + dep.max = version + elif dep.min > version: + # conflict #(our minimum version is greater + # than this max version) + error('conflict! > %f conflicts with < %f' + % (dep.min, version)) + else: + dep.max = version + elif op == '>': + if dep.is_unconstrained(): + dep.min = version + elif dep.max < version: + # conflict (our maximum version is less than this + # min version) + error('conflict! < %f conflicts with > %f' + % (dep.max, version)) # Resolve versions #client = xmlrpclib.ServerProxy(PYPI_URL) |