From fa90e1b0cd8e4c035384fc44fecf79d94103d34d445cad9e6aeb7ac4bc538395 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 22 Jan 2024 06:31:57 +0000 Subject: [PATCH 1/2] Accepting request 1140071 from Application:ERP:GNUHealth:4.4 - switch to wheel and enable %{?sle15allpythons} OBS-URL: https://build.opensuse.org/request/show/1140071 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydicom?expand=0&rev=27 --- python-pydicom.changes | 5 +++++ python-pydicom.spec | 20 +++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/python-pydicom.changes b/python-pydicom.changes index 08f4204..c2d8d64 100644 --- a/python-pydicom.changes +++ b/python-pydicom.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Jan 16 09:57:21 UTC 2024 - Axel Braun + +- switch to wheel and enable %{?sle15allpythons} + ------------------------------------------------------------------- Sat Dec 3 20:04:13 UTC 2022 - Yogalakshmi Arunachalam diff --git a/python-pydicom.spec b/python-pydicom.spec index c66d138..598bfae 100644 --- a/python-pydicom.spec +++ b/python-pydicom.spec @@ -1,7 +1,7 @@ # # spec file for package python-pydicom # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,8 +16,7 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} -%define oldpython python +%{?sle15allpythons} Name: python-pydicom Version: 2.3.1 Release: 0 @@ -25,22 +24,20 @@ Summary: Pure python package for DICOM medical file reading and writing License: MIT URL: https://github.com/darcymason/pydicom Source: https://files.pythonhosted.org/packages/source/p/pydicom/pydicom-%{version}.tar.gz +BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros # SECTION test requirements BuildRequires: %{python_module numpy} -BuildRequires: %{python_module Pillow} BuildRequires: %{python_module pydicom-data} +BuildRequires: %{python_module Pillow} BuildRequires: %{python_module pytest} BuildRequires: %{python_module requests} BuildRequires: python3-gdcm # /SECTION BuildArch: noarch -%ifpython2 -Obsoletes: %{oldpython}-dicom < %{version} -Provides: %{oldpython}-dicom = %{version} -%endif Requires(post): update-alternatives Requires(postun):update-alternatives %python_subpackages @@ -58,10 +55,10 @@ and radiotherapy objects. %setup -q -n pydicom-%{version} %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_clone -a %{buildroot}%{_bindir}/pydicom %python_expand rm -r %{buildroot}%{$python_sitelib}/pydicom/{benchmarks,tests,data/test_files} %python_expand %fdupes %{buildroot}%{$python_sitelib} @@ -93,6 +90,7 @@ ignores="--ignore pydicom/tests/test_dataset.py --ignore pydicom/tests/test_data %doc README.md %license LICENSE %python_alternative %{_bindir}/pydicom -%{python_sitelib}/pydicom* +%{python_sitelib}/pydicom +%{python_sitelib}/pydicom-%{version}.dist-info %changelog From 1abc033a13e4cb9543021f226dddfd3a2157faeb45e7eb6fb2893f18807853ad Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Fri, 26 Jan 2024 09:37:48 +0000 Subject: [PATCH 2/2] Accepting request 1141566 from home:bnavigator:branches:devel:languages:python - Update to 2.4.4 ## Changes * Removed support for Python 3.6 (EOL since December 2021) ## Enhancements * Added attribute alphabetic (#1634) * Added attribute json_key (#1648) * Added value validation for numerical VRs, add type validation for all validated VRs (#1414) * CLI commands now accept pydicom charset test files and CLI help shows Python Version (#1674) * Added support for Python 3.11 (#1658) * Added ISfloat to allow non-strict reading of existing files with float IS values (#1661) * Improved speed of creating and accessing highly nested structures (#1728, #1734) * Switched to a pyproject.toml build process (#1792) * Updated DICOM and UID dicts to DICOM 2023b (#1803) ## Fixes * Fixed length validation of DS values with maximum length without a leading zero (#1632) * Increased download speed with progress bar for test data (#1611) * Fixed crash due to invalid private creator (#1638) * Fixed extremely long BytesLengthException error messages (#1683) * In codify, ensure unique variable names for DICOM keywords repeated in sequences, and handle unicode characters correctly (#1670) * Fixed handling of some invalid values in to_json_dict() if suppress_invalid_tags is set to True (#1693) OBS-URL: https://build.opensuse.org/request/show/1141566 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydicom?expand=0&rev=28 --- pydicom-2.3.1.tar.gz | 3 -- pydicom-2.4.4-gh.tar.gz | 3 ++ pydicom-pr1908-fixpillow.patch | 23 +++++++++++++++ python-pydicom.changes | 52 ++++++++++++++++++++++++++++++++++ python-pydicom.spec | 49 ++++++++++++++++++++------------ 5 files changed, 109 insertions(+), 21 deletions(-) delete mode 100644 pydicom-2.3.1.tar.gz create mode 100644 pydicom-2.4.4-gh.tar.gz create mode 100644 pydicom-pr1908-fixpillow.patch diff --git a/pydicom-2.3.1.tar.gz b/pydicom-2.3.1.tar.gz deleted file mode 100644 index 4b9a8ea..0000000 --- a/pydicom-2.3.1.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:655db29c21cb333a4f9dfffdeaa80995b1d3b89e98b66a16f5cc886e5b338028 -size 2164956 diff --git a/pydicom-2.4.4-gh.tar.gz b/pydicom-2.4.4-gh.tar.gz new file mode 100644 index 0000000..ab0ee33 --- /dev/null +++ b/pydicom-2.4.4-gh.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:42c06ed74331174111dd42c89db774a13fc472abe18015f22c5aba80cddb7843 +size 2203904 diff --git a/pydicom-pr1908-fixpillow.patch b/pydicom-pr1908-fixpillow.patch new file mode 100644 index 0000000..489ed6e --- /dev/null +++ b/pydicom-pr1908-fixpillow.patch @@ -0,0 +1,23 @@ +From 11f7bd260137a18496bdfd00ddb742ef0cf2d2fd Mon Sep 17 00:00:00 2001 +From: scaramallion +Date: Mon, 16 Oct 2023 10:35:46 +1100 +Subject: [PATCH 1/4] Fix Pillow raising AttributeError due to Image.mode being + read-only + +Index: pydicom-2.4.4/pydicom/pixel_data_handlers/pillow_handler.py +=================================================================== +--- pydicom-2.4.4.orig/pydicom/pixel_data_handlers/pillow_handler.py ++++ pydicom-2.4.4/pydicom/pixel_data_handlers/pillow_handler.py +@@ -129,7 +129,11 @@ def _decompress_single_frame( + image.tile[0][2], + (color_mode, ''), + )] +- image.mode = color_mode ++ # Pillow 10.1+ made Image.mode read-only ++ if hasattr(image, "_mode"): ++ image._mode = color_mode ++ else: ++ image.mode = color_mode + image.rawmode = color_mode + return image + diff --git a/python-pydicom.changes b/python-pydicom.changes index c2d8d64..d9eef28 100644 --- a/python-pydicom.changes +++ b/python-pydicom.changes @@ -1,3 +1,55 @@ +------------------------------------------------------------------- +Thu Jan 25 17:55:25 UTC 2024 - Ben Greiner + +- Update to 2.4.4 + ## Changes + * Removed support for Python 3.6 (EOL since December 2021) + ## Enhancements + * Added attribute alphabetic (#1634) + * Added attribute json_key (#1648) + * Added value validation for numerical VRs, add type validation + for all validated VRs (#1414) + * CLI commands now accept pydicom charset test files and CLI help + shows Python Version (#1674) + * Added support for Python 3.11 (#1658) + * Added ISfloat to allow non-strict reading of existing files + with float IS values (#1661) + * Improved speed of creating and accessing highly nested + structures (#1728, #1734) + * Switched to a pyproject.toml build process (#1792) + * Updated DICOM and UID dicts to DICOM 2023b (#1803) + ## Fixes + * Fixed length validation of DS values with maximum length + without a leading zero (#1632) + * Increased download speed with progress bar for test data + (#1611) + * Fixed crash due to invalid private creator (#1638) + * Fixed extremely long BytesLengthException error messages + (#1683) + * In codify, ensure unique variable names for DICOM keywords + repeated in sequences, and handle unicode characters correctly + (#1670) + * Fixed handling of some invalid values in to_json_dict() if + suppress_invalid_tags is set to True (#1693) + * Fixed reading of data with 8 bits allocated, encoded in Big + Endian transfer syntax using VR OW (#1680) + * Fixed crash if reading regular dataset that has the SOP Class + of a DICOMDIR (#1702) + * Fixed wrong waveform data calculation when as_raw=False and + baseline!=0 (#1667) + * Fixed reading LUTData to expected size (#1747) + * Fixed handling of AT VRs when codifying data elements (#1738) + ## Pydicom Internals + * In test suites, renamed ‘setup’ and ‘teardown’ methods, + deprecated starting in pytest 7.2 + * Use own fork of CharPyLS to handle builds with Python 3.11 + (#1788) +- Go back do %{?sle15_python_module_pythons}. python- prefixed + packages for Python 3.6 should be handled by separate maintenance + request to python3-pydicom on SLE side +- Add pydicom-pr1908-fixpillow.patch + * gh#pydicom/pydicom#1908 fixes gh#pydicom/pydicom#1907 + ------------------------------------------------------------------- Tue Jan 16 09:57:21 UTC 2024 - Axel Braun diff --git a/python-pydicom.spec b/python-pydicom.spec index 598bfae..775558e 100644 --- a/python-pydicom.spec +++ b/python-pydicom.spec @@ -16,26 +16,31 @@ # -%{?sle15allpythons} +%{?sle15_python_module_pythons} Name: python-pydicom -Version: 2.3.1 +Version: 2.4.4 Release: 0 Summary: Pure python package for DICOM medical file reading and writing License: MIT URL: https://github.com/darcymason/pydicom -Source: https://files.pythonhosted.org/packages/source/p/pydicom/pydicom-%{version}.tar.gz +Source: https://github.com/pydicom/pydicom/archive/refs/tags/v%{version}.tar.gz#/pydicom-%{version}-gh.tar.gz +# PATCH-FIX-UPSTREAM pydicom-pr1908-fixpillow.patch gh#pydicom/pydicom#1908 fixes gh#pydicom/pydicom#1907 +Patch0: pydicom-pr1908-fixpillow.patch +BuildRequires: %{python_module base >= 3.7} +BuildRequires: %{python_module flit-core >= 3.2} BuildRequires: %{python_module pip} -BuildRequires: %{python_module setuptools} -BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros # SECTION test requirements BuildRequires: %{python_module numpy} -BuildRequires: %{python_module pydicom-data} BuildRequires: %{python_module Pillow} +BuildRequires: %{python_module pydicom-data} BuildRequires: %{python_module pytest} BuildRequires: %{python_module requests} +%if 0%{?suse_version} > 1550 +# GDCM is not multiflavor in Tumbleweed BuildRequires: python3-gdcm +%endif # /SECTION BuildArch: noarch Requires(post): update-alternatives @@ -52,7 +57,7 @@ medical images and related information such as reports and radiotherapy objects. %prep -%setup -q -n pydicom-%{version} +%autosetup -p1 -n pydicom-%{version} %build %pyproject_wheel @@ -60,25 +65,33 @@ and radiotherapy objects. %install %pyproject_install %python_clone -a %{buildroot}%{_bindir}/pydicom -%python_expand rm -r %{buildroot}%{$python_sitelib}/pydicom/{benchmarks,tests,data/test_files} %python_expand %fdupes %{buildroot}%{$python_sitelib} %check export LANG=en_US.UTF-8 +%{python_expand # see https://github.com/pydicom/pydicom/issues/1697 +mkdir build/locallib +cp -r %{$python_sitelib}/data_store %{$python_sitelib}/pydicom_data*.dist-info build/locallib/ +} +export PYTHONPATH=$PWD/build/locallib +# these assume that a cache is updatable from online downloads skips="test_fetch_data_files" -# see https://github.com/pydicom/pydicom-data/issues/9 -skips="$skips or OBXXXX1A or (test_can_access_unsupported_dataset and (TestPillowHandler_JPEG or TestPillowHandler_JPEG2K))" +skips="$skips or test_get_testdata_file_external_hash_mismatch" +skips="$skips or test_get_testdata_files_local_external_and_cache" +skips="$skips or test_get_testdata_files_hash_match" +skips="$skips or test_get_testdata_files_hash_mismatch" +skips="$skips or test_get_testdata_files_external_ignore_hash" -# Failures only on ppc64 -skips="$skips or test_invalid_arr_dtype_raises or TestHandlerGenerateMultiplex or TestHandlerMultiplexArray" -# Failures only on i586 -skips="$skips or test_write_file_id or test_file_id or test_encapsulate_bot_large_raises or (TestPillowHandler_JPEG2K and test_array)" +if [ "$RPM_ARCH" = "ppc64le" -o "$RPM_ARCH" = "aarch64" ]; then + skips="$skips or TestPillowHandler_JPEG2K" +fi +if [ $(getconf LONG_BIT) -eq 32 ]; then + # Failures on i586 + skips="$skips or test_write_file_id or test_file_id or test_encapsulate_bot_large_raises or (TestPillowHandler_JPEG2K and test_array)" +fi -# see https://github.com/pydicom/pydicom/issues/1697 -ignores="--ignore pydicom/tests/test_dataset.py --ignore pydicom/tests/test_data_manager.py" - -%pytest -rs pydicom/tests $ignores -k "not ($skips)" +%pytest -rsfR $ignores -k "not ($skips)" %post %python_install_alternative pydicom