ENH: Remove dependency upon python-apt library#115
ENH: Remove dependency upon python-apt library#115rbuccigrossi merged 25 commits intoReproNim:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #115 +/- ##
==========================================
+ Coverage 75.4% 75.59% +0.19%
==========================================
Files 118 118
Lines 7915 8065 +150
==========================================
+ Hits 5968 6097 +129
- Misses 1947 1968 +21
Continue to review full report at Codecov.
|
| for entry in entries: | ||
| match = re_pkg.match(entry.strip()) | ||
| if not match: | ||
| print("FAILED in ", entry) |
|
|
||
| # Split before PGP signature if present | ||
| if "-----BEGIN PGP SIGNATURE-----" in content: | ||
| content = content.split("-----BEGIN PGP SIGNATURE-----")[0] |
There was a problem hiding this comment.
couldn't it be without 'if' statement and just the content = content.split("-----BEGIN PGP SIGNATURE-----")[0]? ;-)
There was a problem hiding this comment.
Look at that! That's nice behavior for str.split()
…to those tracers that can handle them
… respective dpkg info file
|
Assigned to Yarik for review and next steps. |
yarikoptic
left a comment
There was a problem hiding this comment.
Grr.. I was certain that I have submitted the review yesterday, but found today that comments weren't yet finalized! sorry!
What if we merge it in the current shape and you would address requested changes in a separate followup PR? This way we could resolve quickly conflicts with @chaselgrove changes in #121 before piling up more of them.
In other words , if approve, merge please ;)
| from niceman.tests.utils import skip_if | ||
|
|
||
|
|
||
| @skip_if(not apt) |
There was a problem hiding this comment.
well, we still will need to skip it on non-debian systems. probably entire module (unless it is some mocked up test).
May be, define in external_versions a new checker for cmd:apt-cache (see the one for git) and then skip here if version is "None" (not installed ie).
There was a problem hiding this comment.
Done. I added a skip_if_no_apt_cache decorator in 7a6337b.
| datetime.utcfromtimestamp( | ||
| mktime_tz(parsedate_tz(spec.date))))) | ||
| except TypeError as _: | ||
| lgr.warning("Unexpected date format %s " % spec.date) |
There was a problem hiding this comment.
should we may be just blow completely for now so we could detect those instead of missing all possible hundreds of warnings ;)
| except TypeError as _: | ||
| lgr.warning("Unexpected date format %s " % spec.date) | ||
| break | ||
| except CommandError as _: |
There was a problem hiding this comment.
shouldn't there at least be a warning or better even exception? otherwise it might be tricky later to find out why we are missing some information
There was a problem hiding this comment.
The issue is that we have two different potential file name endings ("Release" and "InRelease"), so we expect a bunch of failures in attempting to read the files. I'll put better documentation in a comment.
|
|
||
| assert parse('diversion by dash from: /bin/sh') is None | ||
|
|
||
|
|
There was a problem hiding this comment.
could there be a sledgehummer test which would (after we start throwing exceptions whenever things go not as planned, see above comments) test on some good number of packages (or even all packages) that it could trace it... how long will it take do you think e.g. on your ubuntu? you could probably try to trace /usr/bin/ and /usr/lib/* /usr/lib// for starters ;)
test itself could verify that all apt sources have some date, all packages have version and architecture, and some apt source assigned.
| @with_tempfile(content="content") | ||
| def test_isdir(script=None): | ||
| ses = ShellSession() | ||
| assert not ses.isdir(script) |
There was a problem hiding this comment.
tempfile is a heavy artillery for this... why not just __FILE__? ;)
| raise AssertionError("Key %s is missing" % key) | ||
| assert_is_subset_dict_recur(a[key], b[key]) | ||
| else: | ||
| if not a == b: |
There was a problem hiding this comment.
just a note -- there is still != in Python ;)
There was a problem hiding this comment.
Yes. And, I love the fact that my assertion error used != while I used "not =="
|
Eh, merging Matt's PR introduced some minor conflicts... I will resolve them now |
* origin/master: (39 commits) BF: changed travis python apt packages ENH: added exec interface ENH: Added mkdir, get and put interfaces BF: Added back in some commented out tests for SSH ENH: Made code changes recommended by comments. Fixed python 3 issues. DOC: restored nose install; using pytest directly for testing DOC: updated to reflect new testing (not nose) allow downgrades never give up! BF: adjust apt installation for trusty BF: Retry Travis internal fault. ENH: Changed AWS resource to use Ssh package to connect to remote EC2 servers. BF: Skipping SSH test if no network found. (try 2) BF: Skipping SSH test if no network found. BF: removal of Travis build_install_apt BF: reverting Travis distribution back to precise BF: seeing if Travis installs the docker service on Trusty BF: Restored retrace package test. RF: Used six package for NoSectionError exception. ENH: Moved SSH connection session out of execute command methods. ...
|
I'm merging to minimize future conflicts, but will resolve suggestions in a future pull request. |
Addressing code review comments for debian identification (#115)
The goal is to remove our dependency upon the python-apt library by using apt-cache calls.