b146524
%global forgeurl https://github.com/nipy/nibabel
b146524
e266bbb
%global _description %{expand:
16effbf
Read / write access to some common neuroimaging file formats
16effbf
16effbf
This package provides read +/- write access to some common medical and
16effbf
neuroimaging file formats, including: ANALYZE (plain, SPM99, SPM2 and
16effbf
later), GIFTI, NIfTI1, NIfTI2, MINC1, MINC2, MGH and ECAT as well as Philips
16effbf
PAR/REC. We can read and write Freesurfer geometry, and read Freesurfer
16effbf
morphometry and annotation files. There is some very limited support for DICOM.
16effbf
NiBabel is the successor of PyNIfTI.
16effbf
16effbf
The various image format classes give full or selective access to header (meta)
16effbf
information and access to the image data is made available via NumPy arrays.
e266bbb
}
e266bbb
e266bbb
Name:           python-nibabel
Packit fe3be5f
Version:        5.2.1
e266bbb
Release:        %autorelease
e266bbb
Summary:        Python package to access a cacophony of neuro-imaging file formats
b146524
%global tag %{version}
b146524
%forgemeta
e266bbb
License:        MIT and PDDL-1.0
e266bbb
URL:            http://nipy.org/nibabel/
b146524
Source0:        %forgesource
21a6a5a
# Fix failing docstring tests (Python >= 3.13)
21a6a5a
# https://github.com/nipy/nibabel/issues/1311
21a6a5a
Patch:          %{forgeurl}/pull/1315.patch
e266bbb
e266bbb
BuildArch:      noarch
e266bbb
e266bbb
%description %_description
e266bbb
e266bbb
%package -n python3-nibabel
16effbf
Summary:        %{summary}
203012b
Igor Gnatenko 50d5f9f
BuildRequires:  python3-devel
Igor Gnatenko 50d5f9f
BuildRequires:  python3-setuptools
63bf75e
BuildRequires:  python3-pytest
3d5f281
BuildRequires:  python3-pytest-httpserver
1632500
BuildRequires:  help2man
f62444a
Recommends:     python3-scipy
16effbf
Recommends:     python3-pydicom
3d5f281
# Bundles their own version of netcdf reader
203012b
# that is different from Scipy version
f62444a
Provides:       bundled(python%{python3_version}dist(netcdf))
16effbf
e266bbb
%description -n python3-nibabel %_description
16effbf
16effbf
%prep
61e3d16
# warning: don't use -S git/git_am here, or hatchling/hatch-vcs generates a wrong version
b146524
%forgeautosetup -p1
e266bbb
3d5f281
# delete shebangs from files that don't need it
3d5f281
find nibabel/cmdline/  -name "*.py" -execdir sed -i '/^#!python/ d' '{}' \;
3d5f281
3d5f281
# correct other shebangs
3d5f281
# upstream uses #!python as a shebang, correct it
3d5f281
find . -name "*.py" -execdir sed -i 's|^#!python|#!%{python3}|' '{}' \;
3d5f281
3d5f281
# delete .gitignore files
3d5f281
rm -fv nibabel/{tests/data/,}.gitignore
3d5f281
3d5f281
e266bbb
%generate_buildrequires
e266bbb
%pyproject_buildrequires -x dicom,minc2,spm
7c1226c
16effbf
%build
e266bbb
%pyproject_wheel
16effbf
16effbf
%install
e266bbb
%pyproject_install
d2bed0d
%pyproject_save_files -l nibabel nisext
16effbf
1632500
for binary in "parrec2nii" "nib-conform" "nib-convert" "nib-diff" "nib-dicomfs" "nib-ls" "nib-nifti-dx" "nib-roi" "nib-stats" "nib-tck2trk" "nib-trk2tck"
1632500
do
1632500
    echo "Generating man page for ${binary}"
dce36fc
    %py3_test_envvars help2man --no-info --no-discard-stderr --output="${binary}.1" "${binary}"
1632500
    install -t '%{buildroot}%{_mandir}/man1' -p -m 0644 -D "${binary}.1"
1632500
done
1632500
16effbf
%check
4ad24f1
%{pytest} -v
16effbf
e266bbb
%files -n python3-nibabel -f %{pyproject_files}
16effbf
%{_bindir}/parrec2nii
d29e70a
%{_bindir}/nib-conform
2e430dd
%{_bindir}/nib-convert
7c1226c
%{_bindir}/nib-diff
16effbf
%{_bindir}/nib-dicomfs
d29e70a
%{_bindir}/nib-ls
16effbf
%{_bindir}/nib-nifti-dx
203012b
%{_bindir}/nib-roi
203012b
%{_bindir}/nib-stats
2620a47
%{_bindir}/nib-tck2trk
2620a47
%{_bindir}/nib-trk2tck
1632500
%{_mandir}/man1/nib*
1632500
%{_mandir}/man1/parrec2nii.*
16effbf
16effbf
%changelog
d30a11f
%autochangelog