[med-svn] [Git][med-team/python-dicompylercore][master] 2 commits: d/patches/remove-six.patch: Add patch to remove six from source.
Emmanuel Arias (@eamanu)
gitlab at salsa.debian.org
Tue Dec 17 00:10:04 GMT 2024
Emmanuel Arias pushed to branch master at Debian Med / python-dicompylercore
Commits:
291524b1 by Emmanuel Arias at 2024-12-16T20:49:44-03:00
d/patches/remove-six.patch: Add patch to remove six from source.
- - - - -
2c230d58 by Emmanuel Arias at 2024-12-16T21:07:01-03:00
prepare for upload
- - - - -
3 changed files:
- debian/changelog
- + debian/patches/remove-six.patch
- + debian/patches/series
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+python-dicompylercore (0.5.6-2) unstable; urgency=medium
+
+ * Team upload.
+ * d/patches/remove-six.patch: Add patch to remove six from source (Closes:
+ #1090137).
+
+ -- Emmanuel Arias <eamanu at debian.org> Mon, 16 Dec 2024 20:46:36 -0300
+
python-dicompylercore (0.5.6-1) unstable; urgency=medium
* Team upload.
=====================================
debian/patches/remove-six.patch
=====================================
@@ -0,0 +1,195 @@
+From e6dd12d6e138e2c39a544f9d7adf6d124c979144 Mon Sep 17 00:00:00 2001
+From: Aditya Panchal <apanchal at bastula.org>
+Date: Mon, 12 Jun 2023 20:21:38 -0500
+Subject: [PATCH] Remove Python 2 support (#367)
+
+* Removed Python 2 support.
+
+* Updated documentation to indicate removal of Python 2 support.
+---
+ HISTORY.rst | 1 +
+ README.rst | 1 -
+ dicompylercore/config.py | 50 ++++++++---------------------------
+ dicompylercore/dicomparser.py | 10 +++----
+ dicompylercore/dvhcalc.py | 5 ++--
+ tox.ini | 2 +-
+ 6 files changed, 19 insertions(+), 50 deletions(-)
+
+diff --git a/HISTORY.rst b/HISTORY.rst
+index 305d2f9..748f996 100644
+--- a/HISTORY.rst
++++ b/HISTORY.rst
+@@ -4,6 +4,7 @@ History
+
+ 0.5.7 (unreleased)
+ ------------------
++- Dropped support for Python 2.
+
+ 0.5.6 (2023-05-08)
+ ------------------
+diff --git a/README.rst b/README.rst
+index 9f9d343..bed3b00 100644
+--- a/README.rst
++++ b/README.rst
+@@ -24,7 +24,6 @@ Dependencies
+ - `numpy <http://www.numpy.org>`__ 1.2 or higher
+ - `pydicom <https://pydicom.github.io>`__ 0.9.9 or higher (pydicom 1.0 compatible)
+ - `matplotlib <http://matplotlib.org>`__ 1.3.0 or higher (for DVH calculation)
+-- `six <https://pythonhosted.org/six/>`__ 1.5 or higher
+ - Optional:
+
+ - `Pillow <https://pillow.readthedocs.io>`__ (for image display)
+diff --git a/dicompylercore/config.py b/dicompylercore/config.py
+index 4038aae..29d97bc 100644
+--- a/dicompylercore/config.py
++++ b/dicompylercore/config.py
+@@ -7,52 +7,24 @@
+ # See the file license.txt included with this distribution, also
+ # available at https://github.com/dicompyler/dicompyler-core/
+
+-from six import PY2
+-
+ mpl_available = True
+ pil_available = True
+ shapely_available = True
+ skimage_available = True
+ scipy_available = True
+
+-if PY2:
+- import imp
+- try:
+- imp.find_module('matplotlib')
+- except ImportError:
+- mpl_available = False
+-
+- try:
+- imp.find_module('PIL')
+- except ImportError:
+- pil_available = False
+-
+- try:
+- imp.find_module('shapely')
+- except ImportError:
+- shapely_available = False
+-
+- try:
+- imp.find_module('skimage')
+- except ImportError:
+- skimage_available = False
++import importlib
+
+- try:
+- imp.find_module('scipy')
+- except ImportError:
+- scipy_available = False
+-else:
+- import importlib
+- mpl_available = importlib.util.find_spec("matplotlib") is not None
+- pil_available = importlib.util.find_spec('PIL') is not None
+- shapely_available = importlib.util.find_spec('shapely') is not None
+- skimage_available = importlib.util.find_spec('skimage') is not None
+- scipy_available = importlib.util.find_spec('scipy') is not None
++mpl_available = importlib.util.find_spec("matplotlib") is not None
++pil_available = importlib.util.find_spec("PIL") is not None
++shapely_available = importlib.util.find_spec("shapely") is not None
++skimage_available = importlib.util.find_spec("skimage") is not None
++scipy_available = importlib.util.find_spec("scipy") is not None
+
+
+ # DICOM UID prefix
+-dicompyler_uid_prefix = '1.2.826.0.1.3680043.8.1070.'
+-dicompyler_uid_prefix_image = dicompyler_uid_prefix + '1.'
+-dicompyler_uid_prefix_rtstruct = dicompyler_uid_prefix + '2.'
+-dicompyler_uid_prefix_rtplan = dicompyler_uid_prefix + '3.'
+-dicompyler_uid_prefix_rtdose = dicompyler_uid_prefix + '4.'
++dicompyler_uid_prefix = "1.2.826.0.1.3680043.8.1070."
++dicompyler_uid_prefix_image = dicompyler_uid_prefix + "1."
++dicompyler_uid_prefix_rtstruct = dicompyler_uid_prefix + "2."
++dicompyler_uid_prefix_rtplan = dicompyler_uid_prefix + "3."
++dicompyler_uid_prefix_rtdose = dicompyler_uid_prefix + "4."
+diff --git a/dicompylercore/dicomparser.py b/dicompylercore/dicomparser.py
+index 22d1991..5f92eb7 100755
+--- a/dicompylercore/dicomparser.py
++++ b/dicompylercore/dicomparser.py
+@@ -20,8 +20,8 @@
+ from dicom.dataset import Dataset
+ import random
+ from numbers import Number
+-from six import PY2, iterkeys, string_types, BytesIO
+-from six.moves import range
++from io import BytesIO
++from pathlib import Path
+ from dicompylercore import dvh, util
+ from dicompylercore.config import pil_available, shapely_available
+
+@@ -56,7 +56,7 @@ def __init__(self, dataset, memmap_pixel_array=False):
+ self.memmap_pixel_array = memmap_pixel_array
+ if isinstance(dataset, Dataset):
+ self.ds = dataset
+- elif isinstance(dataset, (string_types, BytesIO)):
++ elif isinstance(dataset, (str, BytesIO, Path)):
+ try:
+ with open(dataset, "rb") as fp:
+ self.ds = read_file(fp, defer_size=100, force=True,
+@@ -203,8 +203,6 @@ def GetDemographics(self):
+ 'birth_date': None,
+ 'gender': 'Other'}
+ if 'PatientName' in self.ds:
+- if PY2:
+- self.ds.decode()
+ name = self.ds.PatientName
+ patient['name'] = str(name)
+ patient['given_name'] = name.given_name
+@@ -668,7 +666,7 @@ def CalculatePlaneThickness(self, planesDict):
+ planes = []
+
+ # Iterate over each plane in the structure
+- for z in iterkeys(planesDict):
++ for z in planesDict.keys():
+ planes.append(float(z))
+ planes.sort()
+
+diff --git a/dicompylercore/dvhcalc.py b/dicompylercore/dvhcalc.py
+index 01d3127..8766764 100644
+--- a/dicompylercore/dvhcalc.py
++++ b/dicompylercore/dvhcalc.py
+@@ -19,7 +19,6 @@
+ from collections.abc import Sequence
+ except ImportError:
+ from collections import Sequence
+-from six import iteritems
+ import logging
+ logger = logging.getLogger('dicompylercore.dvhcalc')
+
+@@ -140,10 +139,10 @@ def _calculate_dvh(structure,
+ This is an internal function called by `get_dvh` and
+ should not be called directly.
+ """
+- planes = collections.OrderedDict(sorted(iteritems(structure['planes'])))
+ calcdvh = collections.namedtuple('DVH', ['notes', 'histogram'])
+ logger.debug("Calculating DVH of %s %s", structure['id'],
+ structure['name'])
++ planes = collections.OrderedDict(sorted(structure["planes"].items()))
+
+ # Create an empty array of bins to store the histogram in cGy
+ # only if the structure has contour data or the dose grid exists
+@@ -207,7 +206,7 @@ def _calculate_dvh(structure,
+ 'thickness'] / (interpolation_segments_between_planes + 1)
+
+ # Iterate over each plane in the structure
+- for z, plane in iteritems(planes):
++ for z, plane in planes.items():
+ # Get the dose plane for the current structure plane
+ if interpolation_resolution or use_structure_extents:
+ doseplane = get_interpolated_dose(
+diff --git a/tox.ini b/tox.ini
+index fb45b35..5bcc632 100644
+--- a/tox.ini
++++ b/tox.ini
+@@ -1,5 +1,5 @@
+ [tox]
+-envlist = py27, py37
++envlist = py37
+
+ [testenv]
+ setenv =
=====================================
debian/patches/series
=====================================
@@ -0,0 +1 @@
+remove-six.patch
View it on GitLab: https://salsa.debian.org/med-team/python-dicompylercore/-/compare/ea04417f658d1824dbfb1770d6dbbf3d6e15ee48...2c230d581c011c8185aa4dfebe00c00b15b23de5
--
View it on GitLab: https://salsa.debian.org/med-team/python-dicompylercore/-/compare/ea04417f658d1824dbfb1770d6dbbf3d6e15ee48...2c230d581c011c8185aa4dfebe00c00b15b23de5
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20241217/7c124ce3/attachment-0001.htm>
More information about the debian-med-commit
mailing list