NF: distribution operations#116
Conversation
Codecov Report
@@ Coverage Diff @@
## master #116 +/- ##
==========================================
+ Coverage 76.16% 76.21% +0.04%
==========================================
Files 119 119
Lines 8244 8328 +84
==========================================
+ Hits 6279 6347 +68
- Misses 1965 1981 +16
Continue to review full report at Codecov.
|
yarikoptic
left a comment
There was a problem hiding this comment.
For now just minor whining from a Pythonista
niceman/distributions/debian.py
Outdated
| for p in other.packages: | ||
| if not self.satisfies_package(p): | ||
| return False | ||
| return True |
There was a problem hiding this comment.
above four lines could be more pythonicly expressed
return all(map(self.satisfies_package, other.packages))in python3 map is already a generator (so you would get early termination), in python2 -- not yet so it would go through all possibly for no reason. So just
from six.moves import map
niceman/distributions/debian.py
Outdated
| for p in self.packages: | ||
| if p.satisfies(package): | ||
| return True | ||
| return False |
There was a problem hiding this comment.
see comment below ... eventually we might want to make it more efficient/avoid full list lookup every time.
|
|
||
| def test_package_satisfies(setup_packages): | ||
| (p1, p1v10, p1v11, p2) = setup_packages | ||
| assert p1.satisfies(p1) is True |
There was a problem hiding this comment.
sufficient to
assert p1.satisfies(p1)
assert not p1.satisfies(p1v10)There was a problem hiding this comment.
I'd set it up this way so I could return None and make all tests fail to start with. You're right, at this point this idiom isn't needed any more.
|
I added a WiP label. @chaselgrove please remove it when you think it is worth merging |
|
If we can merge #121, I'd like to refactor this PR to take advantage of that code. Then let's merge this -- this could potentially be a WIP until all the classes are fleshed out (read: indefinitely :) ) but I'd rather do this iteratively. |
Primitives for checking if Debian packages and distributions satisfy requirements in other packages and distributions.