diff options
-rwxr-xr-x | exts/pip_find_deps.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/exts/pip_find_deps.py b/exts/pip_find_deps.py index f5f5715..bad31ec 100755 --- a/exts/pip_find_deps.py +++ b/exts/pip_find_deps.py @@ -182,26 +182,41 @@ def check_eqs(dep, version): elif dep.greater_than > version: dep.conflicts.append((dep.greater_than.spec, ('==', version))) +# < x and == y: conflict, so conflict if y >= x +# <= x and == y: no conflict, so conflict if y > x def check_lt(dep, version, inclusive=False): lt_symbol = '<=' if inclusive else '<' + lt = LowerBound(version, inclusive) + + def abs_cmp(x, y): + return x > y if inclusive else x >= y if dep.is_unconstrained(): dep.less_than = LowerBound(version, inclusive) elif dep.is_unbounded(): - if dep.absolute >= version: + # if dep.absolute >= version: # unless inclusive! + # TODO: could probably use our existing bound thing for this + if abs_cmp(dep.absolute, version): dep.conflicts.append((('==', dep.absolute), (lt_symbol, version))) elif dep.greater_than >= version: dep.conflicts.append((dep.greater_than.spec, (lt_symbol, version))) else: dep.less_than = LowerBound(version, inclusive) +# > x and == y: conflict, so conflict if y <= x +# >= x and == y: no conflict, so conflict if y < x def check_gt(dep, version, inclusive=False): gt_symbol = '>=' if inclusive else '>' + gt = UpperBound(version, inclusive) + + def abs_cmp(x, y): + return x < y if inclusive else x <= y if dep.is_unconstrained(): dep.greater_than = UpperBound(version, inclusive) elif dep.is_unbounded(): - if dep.absolute <= version: + if dep.absolute <= version: # again unless inclusive + #if gt >= dep.absolute: dep.conflicts.append((('==', dep.absolute), (gt_symbol, version))) elif dep.less_than <= version: dep.conflicts.append((dep.less_than.spec, (gt_symbol, version))) |