diff options
author | Angelos Evripiotis <jevripiotis@bloomberg.net> | 2018-10-22 15:30:38 +0100 |
---|---|---|
committer | Phil Dawson <phildawson.0807@gmail.com> | 2018-10-23 08:37:47 +0000 |
commit | 898db5af11a60f6b6c1f70c6e9f3bdcb0f1adad4 (patch) | |
tree | c8f9e1a71c1046be4fa982b9d54af94cbaae8fa6 /buildstream/plugins/sources/deb.py | |
parent | be29e0f567e9633220228b7f3bc71ca34317d4ef (diff) | |
download | buildstream-aevri/rm-exitstack.tar.gz |
plugins/sources: refactor, rm needless ExitStack-saevri/rm-exitstack
Remove two uses of ExitStack that aren't necessary and make the code
a little harder to follow.
Diffstat (limited to 'buildstream/plugins/sources/deb.py')
-rw-r--r-- | buildstream/plugins/sources/deb.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/buildstream/plugins/sources/deb.py b/buildstream/plugins/sources/deb.py index 7c70e1de9..e1d4b65d1 100644 --- a/buildstream/plugins/sources/deb.py +++ b/buildstream/plugins/sources/deb.py @@ -50,7 +50,7 @@ deb - stage files from .deb packages """ import tarfile -from contextlib import contextmanager, ExitStack +from contextlib import contextmanager import arpy # pylint: disable=import-error from .tar import TarSource @@ -69,8 +69,7 @@ class DebSource(TarSource): @contextmanager def _get_tar(self): - with ExitStack() as context: - deb_file = context.enter_context(open(self._get_mirror_file(), 'rb')) + with open(self._get_mirror_file(), 'rb') as deb_file: arpy_archive = arpy.Archive(fileobj=deb_file) arpy_archive.read_all_headers() data_tar_arpy = [v for k, v in arpy_archive.archived_files.items() if b"data.tar" in k][0] |