From 676c8b8458e21f351861e6ce5d67c280ca98dcbd Mon Sep 17 00:00:00 2001 From: Richard Ipsum Date: Thu, 6 Nov 2014 16:05:33 +0000 Subject: Move == check out into function --- exts/pip.find_deps | 52 ++++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/exts/pip.find_deps b/exts/pip.find_deps index 3a50f1b..e7fabd8 100755 --- a/exts/pip.find_deps +++ b/exts/pip.find_deps @@ -108,6 +108,32 @@ class Dependency(object): self.absolute = version +def check_eqs(dep, version): + if dep.is_unconstrained(): + dep.set_absolute_version(version) + elif version not in dep.excludes: + if dep.absolute in [version, None]: + if dep.in_bounds(version): + dep.set_absolute_version(version) + else: + warn('conflict! == %s conflicts with %s' + % (version, + dep.get_bounds_conflict(version))) + else: + warn('conflict! == %s conflicts with == %s' + % (version, dep.absolute)) + elif version in dep.excludes: + warn('conflict! == %s conflicts with != %s' + % (version, version)) + elif version > dep.less_than: + # conflict + warn('conflict! == %s conflicts with < %s' + % (version, dep.less_than)) + elif version < dep.greater_than: + # conflict + warn('conflict! == %s conflicts with > %s' + % (version, dep.greater_than)) + def find_build_deps(source, name, version=None): debug('source: %s' % source) debug('name: %s' % name) @@ -149,32 +175,10 @@ def find_build_deps(source, name, version=None): print('dep.excludes: %s' % str(dep.excludes)) if op == '==': - if dep.is_unconstrained(): - dep.set_absolute_version(version) - elif version not in dep.excludes: - if dep.absolute in [version, None]: - if dep.in_bounds(version): - dep.set_absolute_version(version) - else: - warn('conflict! == %s conflicts with %s' - % (version, - dep.get_bounds_conflict(version))) - else: - warn('conflict! == %s conflicts with == %s' - % (version, dep.absolute)) - elif version in dep.excludes: - warn('conflict! == %s conflicts with != %s' - % (version, version)) - elif version > dep.less_than: - # conflict - warn('conflict! == %s conflicts with < %s' - % (version, dep.less_than)) - elif version < dep.greater_than: - # conflict - warn('conflict! == %s conflicts with > %s' - % (version, dep.greater_than)) + check_eqs(dep, version) elif op == '!=': dep.excludes.append(version) + # TODO: chk_eqs needed here elif op == '<': if dep.is_unconstrained(): dep.less_than = version -- cgit v1.2.1