diff options
author | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2014-11-06 16:38:31 +0000 |
---|---|---|
committer | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2014-11-06 16:38:31 +0000 |
commit | 15ca906113b8cadc68bf9e2f491aed423dd16366 (patch) | |
tree | 194fbc0c95750014bef5bd08a0c8f1e22227cdff /exts | |
parent | e33d16283f64e17e8765e35cf845f2e465b7e692 (diff) | |
download | import-15ca906113b8cadc68bf9e2f491aed423dd16366.tar.gz |
Store list of conflicts
Diffstat (limited to 'exts')
-rwxr-xr-x | exts/pip.find_deps | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/exts/pip.find_deps b/exts/pip.find_deps index 446b1a2..d11054b 100755 --- a/exts/pip.find_deps +++ b/exts/pip.find_deps @@ -79,6 +79,9 @@ class Dependency(object): self.absolute = None self.excludes = [] + # A list of conclicting specs for this dependency + self.conflicts = [] + def is_unbounded(self): return self.less_than == None and self.greater_than == None @@ -94,9 +97,9 @@ class Dependency(object): def get_bounds_conflict(self, version): if not self._in_less_than(version): - return '< %s' % str(self.less_than) + return ('<', str(self.less_than)) elif not self._in_greater_than(version): - return '> %s' % str(self.greater_than) + return ('>', str(self.greater_than)) else: return None @@ -119,20 +122,27 @@ def check_eqs(dep, version): warn('conflict! == %s conflicts with %s' % (version, dep.get_bounds_conflict(version))) + dep.conflicts.append((('==', version), + dep.get_bounds_conflict(version))) + else: warn('conflict! == %s conflicts with == %s' % (version, dep.absolute)) + dep.conflicts.append(('==', version), ('!=', dep.absolute)) elif version in dep.excludes: warn('conflict! == %s conflicts with != %s' % (version, version)) + dep.conflicts.append((('==', version), ('!=', version))) elif version > dep.less_than: # conflict warn('conflict! == %s conflicts with < %s' % (version, dep.less_than)) + dep.conflicts.append((('==', version), ('<', dep.less_than))) elif version < dep.greater_than: # conflict warn('conflict! == %s conflicts with > %s' % (version, dep.greater_than)) + dep.conflicts.append(('==', version), ('>', dep.greater_than)) def check_lt(dep, version): if dep.is_unconstrained(): @@ -194,6 +204,7 @@ def find_build_deps(source, name, version=None): print('dep.excludes: %s' % str(dep.excludes)) + # TODO: replace with function table if op == '==': check_eqs(dep, version) elif op == '!=': @@ -221,4 +232,5 @@ if len(sys.argv) not in [3, 4]: for name, dep in find_build_deps(*sys.argv[1:]).iteritems(): print('%s less_than: %s greater_than: %s absolute: %s excludes: %s' % (name, str(dep.less_than), str(dep.greater_than), - str(dep.absolute), dep.excludes))
\ No newline at end of file + str(dep.absolute), dep.excludes)) + print('conflicts: %s' % str(dep.conflicts))
\ No newline at end of file |