From a67976e80dafeac0ec0c3ac0bba27b882ddee623 Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Fri, 22 Mar 2024 14:57:30 -0600 Subject: [PATCH] Remove `six` from production code Removes the `six` module from released production code. The old code in the test cases used for testing compatability still uses `six`, so it is kept as a dev dependency. Signed-off-by: Joshua Watt --- debian/control | 8 ++++---- debian/rules | 2 +- docs/RELEASE_NOTES | 0 pyproject.toml | 2 +- src/bmaptool/BmapCopy.py | 9 ++++----- tests/test_api_base.py | 2 +- tests/test_filemap.py | 2 +- 7 files changed, 12 insertions(+), 13 deletions(-) create mode 100644 docs/RELEASE_NOTES diff --git a/debian/control b/debian/control index b49c0f1..4ab5fcd 100644 --- a/debian/control +++ b/debian/control @@ -3,14 +3,14 @@ Maintainer: Trevor Woerner Section: utils Priority: optional Build-Depends: debhelper (>= 9), - python-all (>= 2.7), - python-setuptools, + python3 (>= 3.8), + python3-setuptools, Standards-Version: 3.8.4 -XS-Python-Version: >= 2.7 +XS-Python-Version: >= 3.8 Package: bmaptool Architecture: all -Depends: python (>=2.7), +Depends: python (>=3.8), python-gpgme, ${misc:Depends}, ${python:Depends}, diff --git a/debian/rules b/debian/rules index 9c13336..016f8b3 100755 --- a/debian/rules +++ b/debian/rules @@ -1,4 +1,4 @@ #!/usr/bin/make -f %: - dh $@ --with=python2 + dh $@ --with=python3 diff --git a/docs/RELEASE_NOTES b/docs/RELEASE_NOTES new file mode 100644 index 0000000..e69de29 diff --git a/pyproject.toml b/pyproject.toml index 220f672..14ae192 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,6 @@ name = "bmaptool" description = "BMAP tools" dynamic = ["version"] dependencies = [ - "six >= 1.16.0", "gpg >= 1.10.0", ] required-python = ">= 3.8" @@ -31,6 +30,7 @@ classifiers = [ [project.optional-dependencies] dev = [ "black >= 22.3.0", + "six >= 1.16.0", ] [project.urls] diff --git a/src/bmaptool/BmapCopy.py b/src/bmaptool/BmapCopy.py index e168261..15113a8 100644 --- a/src/bmaptool/BmapCopy.py +++ b/src/bmaptool/BmapCopy.py @@ -63,9 +63,8 @@ import hashlib import logging import datetime -from six import reraise -from six.moves import queue as Queue -from six.moves import _thread as thread +import queue +import _thread as thread from typing import Optional from xml.etree import ElementTree from .BmapHelpers import human_size @@ -684,7 +683,7 @@ def copy(self, sync=True, verify=True): # Create the queue for block batches and start the reader thread, which # will read the image in batches and put the results to '_batch_queue'. - self._batch_queue = Queue.Queue(self._batch_queue_len) + self._batch_queue = queue.Queue(self._batch_queue_len) thread.start_new_thread(self._get_data, (verify,)) blocks_written = 0 @@ -714,7 +713,7 @@ def copy(self, sync=True, verify=True): # The reader thread encountered an error and passed us the # exception. exc_info = batch[1] - reraise(exc_info[0], exc_info[1], exc_info[2]) + raise exc_info[1] (start, end, buf) = batch[1:4] diff --git a/tests/test_api_base.py b/tests/test_api_base.py index 4679d2e..1cb6cbc 100644 --- a/tests/test_api_base.py +++ b/tests/test_api_base.py @@ -34,7 +34,7 @@ import tempfile import filecmp import subprocess -from six.moves import zip_longest +from itertools import zip_longest from tests import helpers from bmaptool import BmapHelpers, BmapCreate, Filemap diff --git a/tests/test_filemap.py b/tests/test_filemap.py index 5dc6c1c..3603498 100644 --- a/tests/test_filemap.py +++ b/tests/test_filemap.py @@ -29,7 +29,7 @@ import random import itertools import tests.helpers -from six.moves import zip_longest +from itertools import zip_longest from bmaptool import Filemap # This is a work-around for Centos 6