diff --git a/.gitignore b/.gitignore index a7f12fd..c9c8990 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /pydicom-f6191c7.tar.gz /pydicom-1.1.0.tar.gz /pydicom-1.2.2.tar.gz +/pydicom-1.3.0.tar.gz diff --git a/0001-Compatibility-fix-for-Python3.8.patch b/0001-Compatibility-fix-for-Python3.8.patch new file mode 100644 index 0000000..aa1fe29 --- /dev/null +++ b/0001-Compatibility-fix-for-Python3.8.patch @@ -0,0 +1,127 @@ +From e5ccffdb771a9b3d6e511afce436e2902dd1e38b Mon Sep 17 00:00:00 2001 +From: scaramallion +Date: Thu, 22 Aug 2019 15:02:12 +1000 +Subject: [PATCH] Compatibility fix for Python3.8 + +--- + pydicom/tests/test_valuerep.py | 36 ++++++++++++++++++++++++++++++---- + pydicom/valuerep.py | 17 ++++++++++------ + 2 files changed, 43 insertions(+), 10 deletions(-) + +diff --git a/pydicom/tests/test_valuerep.py b/pydicom/tests/test_valuerep.py +index 5f1efd34..4a58873e 100644 +--- a/pydicom/tests/test_valuerep.py ++++ b/pydicom/tests/test_valuerep.py +@@ -90,7 +90,6 @@ class TestDA(object): + + class TestDS(object): + """Unit tests for DS values""" +- + def test_empty_value(self): + assert '' == DS(None) + assert '' == DS('') +@@ -106,7 +105,6 @@ class TestDS(object): + + class TestDSfloat(object): + """Unit tests for pickling DSfloat""" +- + def test_pickling(self): + # Check that a pickled DSFloat is read back properly + x = pydicom.valuerep.DSfloat(9.0) +@@ -116,10 +114,25 @@ class TestDSfloat(object): + assert x.real == x2.real + assert x.original_string == x2.original_string + ++ def test_str(self): ++ """Test DSfloat.__str__().""" ++ val = pydicom.valuerep.DSfloat(1.1) ++ assert '1.1' == str(val) ++ ++ val = pydicom.valuerep.DSfloat('1.1') ++ assert '1.1' == str(val) ++ ++ def test_repr(self): ++ """Test DSfloat.__repr__().""" ++ val = pydicom.valuerep.DSfloat(1.1) ++ assert '"1.1"' == repr(val) ++ ++ val = pydicom.valuerep.DSfloat('1.1') ++ assert '"1.1"' == repr(val) ++ + + class TestDSdecimal(object): + """Unit tests for pickling DSdecimal""" +- + def test_pickling(self): + # Check that a pickled DSdecimal is read back properly + # DSdecimal actually prefers original_string when +@@ -142,7 +155,6 @@ class TestDSdecimal(object): + + class TestIS(object): + """Unit tests for IS""" +- + def test_empty_value(self): + assert '' == IS(None) + assert '' == IS('') +@@ -182,6 +194,22 @@ class TestIS(object): + pydicom.valuerep.IS(3103050000) + config.enforce_valid_values = original_flag + ++ def test_str(self): ++ """Test IS.__str__().""" ++ val = pydicom.valuerep.IS(1) ++ assert '1' == str(val) ++ ++ val = pydicom.valuerep.IS('1') ++ assert '1' == str(val) ++ ++ def test_repr(self): ++ """Test IS.__repr__().""" ++ val = pydicom.valuerep.IS(1) ++ assert '"1"' == repr(val) ++ ++ val = pydicom.valuerep.IS('1') ++ assert '"1"' == repr(val) ++ + + class TestBadValueRead(object): + """Unit tests for handling a bad value for a VR +diff --git a/pydicom/valuerep.py b/pydicom/valuerep.py +index 49e85780..39694aaa 100644 +--- a/pydicom/valuerep.py ++++ b/pydicom/valuerep.py +@@ -340,8 +340,9 @@ class DSfloat(float): + def __str__(self): + if hasattr(self, 'original_string'): + return self.original_string +- else: +- return super(DSfloat, self).__str__() ++ ++ # Issue #937 (Python 3.8 compatibility) ++ return str(float(self)) + + def __repr__(self): + return "\"" + str(self) + "\"" +@@ -500,11 +501,15 @@ class IS(int): + elif isinstance(val, IS) and hasattr(val, 'original_string'): + self.original_string = val.original_string + +- def __repr__(self): ++ def __str__(self): + if hasattr(self, 'original_string'): +- return "\"" + self.original_string + "\"" +- else: +- return "\"" + int.__str__(self) + "\"" ++ return self.original_string ++ ++ # Issue #937 (Python 3.8 compatibility) ++ return str(int(self)) ++ ++ def __repr__(self): ++ return "\"" + str(self) + "\"" + + + def MultiString(val, valtype=str): +-- +2.21.0 + diff --git a/python-pydicom.spec b/python-pydicom.spec index 47b0bc4..5b56704 100644 --- a/python-pydicom.spec +++ b/python-pydicom.spec @@ -1,14 +1,18 @@ %global modname pydicom Name: python-%{modname} -Version: 1.2.2 -Release: 3%{?dist} +Version: 1.3.0 +Release: 1%{?dist} Summary: Read, modify and write DICOM files with python code # There are generated data (private dict) in special format from GDCM License: MIT and BSD URL: https://github.com/darcymason/%{modname} Source0: https://github.com/darcymason/%{modname}/archive/v%{version}/%{modname}-%{version}.tar.gz +# Fixes python3.8 recursion error +# https://github.com/pydicom/pydicom/pull/938/commits/e6419c1fdad1db7ed1bbdab03a374b5aa27ce357 +# https://github.com/pydicom/pydicom/issues/937 +Patch0: 0001-Compatibility-fix-for-Python3.8.patch BuildArch: noarch BuildRequires: git-core @@ -74,7 +78,7 @@ popd %py3_install %check -%{__python3} -m pytest -k "not test_constructor and not JPEG_RGB_RGB" +%{__python3} -m pytest %files -n python3-%{modname} @@ -86,6 +90,11 @@ popd %changelog +* Thu Aug 22 2019 Ankur Sinha - 1.3.0-1 +- Update to 1.3.0 +- Add patch to fix python 3.8 error +- Enable all tests + * Mon Aug 19 2019 Miro HronĨok - 1.2.2-3 - Rebuilt for Python 3.8 diff --git a/sources b/sources index 2b99db5..e880b1f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (pydicom-1.2.2.tar.gz) = 01bde031e65fa0e10e6a40b1534bb0471a26354338d8a624bad298e39b4f7322f4c0ed839566fee85b42995b577bf898625bc07666b8a6767ed905955df2d049 +SHA512 (pydicom-1.3.0.tar.gz) = bff4925ed77aae812a507c1501db0772964f1d76637f7eaf1b978bbcf080e2fff6f15f4a35c14b4828913114817c76a6d79df8e94c3c2f6a173949d8a084dc63