%global pypi_name pypet2bids Name: python-%{pypi_name} Version: 1.6.0 Release: 3%{?dist} Summary: Convert PET imaging data to BIDS License: MIT URL: https://github.com/openneuropet/pet2bids Source0: %{pypi_source %{pypi_name}} # Not in the PyPI sdist; the licence from upstream's repository at a pinned commit Source1: https://raw.githubusercontent.com/openneuropet/pet2bids/99fea4d1472017833d91fba71b164190f0e77f77/LICENSE#/LICENSE BuildArch: noarch BuildRequires: python3-devel %global _description %{expand: PET2BIDS converts PET data (DICOM and ECAT 7) and blood measurements to PET- BIDS, filling the PET sidecar metadata from spreadsheets, and wraps dcm2niix for PET. BIDS (the Brain Imaging Data Structure) is the standard layout for neuroimaging datasets used by OpenNeuro, fMRIPrep and most current pipelines.} %description %{_description} %package -n python3-%{pypi_name} Summary: %{summary} Requires: dcm2niix %description -n python3-%{pypi_name} %{_description} %prep %autosetup -p1 -n pypet2bids-%{version} # Fedora rejects ambiguous #!/usr/bin/env python shebangs in installed modules. grep -rlI '^#!/usr/bin/env python$' . | xargs -r 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 cp -p %{SOURCE1} LICENSE # toml (retired from Fedora after F43) is used only to read pypet2bids' own # pyproject.toml; the standard library's tomllib does the same, from a binary file. sed -i 's/^import toml$/import tomllib as toml/; s/with open(toml_path, "r") as infile:/with open(toml_path, "rb") as infile:/' pypet2bids/*.py sed -i '/^ "toml>=0.10.2",$/d' pyproject.toml if grep -rqE '^import toml$|"toml>=' pypet2bids/*.py pyproject.toml; then exit 1; fi # dcm2petbids points at pypet2bids.dicom_convert, which 1.6.0 doesn't contain; the command # could only fail. Not installed. sed -i '/^dcm2petbids = "pypet2bids.dicom_convert:cli"$/d' pyproject.toml if grep -q dicom_convert pyproject.toml; then exit 1; fi # Likewise pet2bids-spreadsheet-template -> helper_functions:write_out_module, which doesn't # exist in 1.6.0. (updatepetjsonfromdicom is fine: dcm2niix4pet re-exports its function.) sed -i '/^pet2bids-spreadsheet-template = /d' pyproject.toml if grep -q write_out_module pyproject.toml; 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 pypet2bids %check %pyproject_check_import -e 'pypet2bids.tests*' -e 'pypet2bids.*.tests*' -e '*.test_*' -e '*.conftest' -e '*.pytest_plugin' %{py3_test_envvars} %{buildroot}%{_bindir}/convert-pmod-to-blood --help > /dev/null %{py3_test_envvars} %{buildroot}%{_bindir}/dcm2niix4pet --help > /dev/null %{py3_test_envvars} %{buildroot}%{_bindir}/ecatheaderupdate --help > /dev/null %{py3_test_envvars} %{buildroot}%{_bindir}/ecatpet2bids --help > /dev/null %{py3_test_envvars} %{buildroot}%{_bindir}/ispet --help > /dev/null %{py3_test_envvars} %{buildroot}%{_bindir}/updatepetjson --help > /dev/null %{py3_test_envvars} %{buildroot}%{_bindir}/updatepetjsonfromdicom --help > /dev/null %{py3_test_envvars} %{buildroot}%{_bindir}/updatepetjsonfromecat --help > /dev/null %files -n python3-%{pypi_name} -f %{pyproject_files} %license LICENSE %{_bindir}/convert-pmod-to-blood %{_bindir}/dcm2niix4pet %{_bindir}/ecatheaderupdate %{_bindir}/ecatpet2bids %{_bindir}/ispet %{_bindir}/updatepetjson %{_bindir}/updatepetjsonfromdicom %{_bindir}/updatepetjsonfromecat %changelog * Mon Oct 12 2026 Morgan Hough - 1.6.0-3 - Also drop pet2bids-spreadsheet-template: helper_functions.write_out_module isn't in 1.6.0. * Mon Oct 12 2026 Morgan Hough - 1.6.0-2 - Drop the dcm2petbids entry point: its module (pypet2bids.dicom_convert) isn't in 1.6.0. * Mon Oct 12 2026 Morgan Hough - 1.6.0-1 - Initial package, for the DataLad extension stack and dandi.