%global pypi_name dcmstack Name: python-%{pypi_name} Version: 0.9.0 Release: 1%{?dist} Summary: Stack DICOM images into volumes and convert them to NIfTI License: MIT URL: https://github.com/moloney/dcmstack Source0: %{pypi_source %{pypi_name}} BuildArch: noarch BuildRequires: python3-devel %global _description %{expand: dcmstack groups 2D DICOM images into multi-dimensional volumes and converts them to NIfTI, keeping the DICOM meta data in a NIfTI header extension. heudiconv uses it.} %description %{_description} %package -n python3-%{pypi_name} Summary: %{summary} # pydicom decodes JPEG-compressed DICOM through pylibjpeg-libjpeg if it's installed; # dcmstack never imports it. Not packaged yet, so a weak dependency. Recommends: python3dist(pylibjpeg-libjpeg) %description -n python3-%{pypi_name} %{_description} %prep %autosetup -p1 -n dcmstack-%{version} # Fedora rejects ambiguous #!/usr/bin/env python shebangs in installed modules. find . -name '*.py' -exec sed -i '1s|^#!/usr/bin/env python$|#!%{python3}|' {} + # Old versioneer.py uses configparser.SafeConfigParser and readfp, both removed in Python 3.12. if [ -f versioneer.py ] && grep -q SafeConfigParser versioneer.py; then sed -i 's/SafeConfigParser/ConfigParser/g; s/\.readfp(/.read_file(/g' versioneer.py if grep -qE 'SafeConfigParser|readfp\(' versioneer.py; then exit 1; fi fi grep -rl "'pylibjpeg-libjpeg ; python_version >= \"3.7\"'," --include=*.py . | xargs sed -i "/'pylibjpeg-libjpeg ; python_version >= \"3.7\"',/d" if grep -rq 'pylibjpeg-libjpeg' --include=*.py .; then exit 1; fi %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install # Build helpers some DataLad-template projects install at top level; not part of the package. rm -rf %{buildroot}%{python3_sitelib}/_datalad_buildsupport %{buildroot}%{python3_sitelib}/tools %{buildroot}%{python3_sitelib}/benchmarks %{buildroot}%{python3_sitelib}/tests %{buildroot}%{python3_sitelib}/tests.py # Old setup.py data_files can drop these at the top of site-packages (osfclient does). rm -f %{buildroot}%{python3_sitelib}/{LICENSE,VERSION,requirements.txt} %pyproject_save_files -L dcmstack %check %pyproject_check_import -e 'dcmstack.tests*' -e 'dcmstack.*.tests*' -e '*.test_*' -e '*.conftest' -e '*.pytest_plugin' %{py3_test_envvars} %{buildroot}%{_bindir}/dcmstack --help > /dev/null %{py3_test_envvars} %{buildroot}%{_bindir}/nitool --help > /dev/null %files -n python3-%{pypi_name} -f %{pyproject_files} %license COPYING %{_bindir}/dcmstack %{_bindir}/nitool %changelog * Mon Oct 12 2026 Morgan Hough - 0.9.0-1 - Initial package, for the DataLad extension stack and dandi.