## START: Set by rpmautospec ## (rpmautospec version 0.6.0) ## RPMAUTOSPEC: autorelease, autochangelog %define autorelease(e:s:pb:n) %{?-p:0.}%{lua: release_number = 3; base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); print(release_number + base_release_number - 1); }%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} ## END: Set by rpmautospec # Tests requiring network are skipped (mostly dependent on docker) # So, let's run all tests by default. %bcond tests 1 # Use forge macros for pulling from GitLab %global forgeurl https://gitlab.com/radiology/infrastructure/xnatpy %global desc %{expand: \ XNAT client that exposes XNAT objects/functions as python objects/functions. The aim is to abstract as much of the REST API away as possible and make xnatpy feel like native Python code. This reduces the need for the user to know the details of the REST API. Low level functionality can still be accessed via the connection object which has get, head, put, post, delete methods for more directly calling the REST API.} Name: python-xnat Version: 0.6.2 Release: %autorelease Summary: XNAT client that exposes XNAT objects/functions as python objects/functions # Only expand forge macros in fedora >= 40 since %%forgesource is broken # in older releases. # Use `fedpkg ... mockbuild --srpm-mock ...` when building for >=40 on # system <40 %if %{fedora} >= 40 %forgemeta %endif License: Apache-2.0 URL: %forgeurl # The %%forgesource macro only works correctly in rawhide for group URLs %if %{fedora} >= 40 Source0: %forgesource %else Source0: https://gitlab.com/radiology/infrastructure/xnatpy/-/archive/%{version}/xnatpy-%{version}.tar.bz2 %endif # xnat4tests is not available in Fedora. It's currently not possible to # package it either, since it's licensed under CC0-1.0 # https://github.com/Australian-Imaging-Service/xnat4tests/issues/17 Patch: no_xnat4tests.patch BuildArch: noarch %description %{desc} %package -n python3-xnat Summary: %{summary} BuildRequires: python3-devel BuildRequires: help2man %if %{with tests} BuildRequires: python3-pytest BuildRequires: python3-pytest-mock BuildRequires: python3-requests-mock %endif %description -n python3-xnat %{desc} %prep %autosetup -p1 -n xnatpy-%{version} # Strip version constraints # We are either ahead or behind sed -r -i 's/[~<>=]=[0-9.]*//g' requirements.txt # remove shebang from non executable scripts sed -i '1d' xnat/scripts/copy_project.py sed -i '1d' xnat/scripts/data_integrity_check.py sed -i '1d' xnat/scripts/import_experiment_dir.py # Don't try to import docker (we are not using it) sed -i '/import docker/d' xnat/tests/test_import.py %generate_buildrequires %pyproject_buildrequires -r requirements.txt %build %pyproject_wheel %install %pyproject_install %pyproject_save_files -l xnat # generate man pages # skip xnat_cp_project and xnat_data_integrity, seems generally broken: https://gitlab.com/radiology/infrastructure/xnatpy/-/issues/46 for binary in "xnat" "xnat download" "xnat import" "xnat list" "xnat login" "xnat logout" "xnat prearchive" "xnat rest" "xnat script" do echo "Generating man page for ${binary// /-/}" PYTHONPATH="$PYTHONPATH:%{buildroot}/%{python3_sitelib}/" PATH="$PATH:%{buildroot}/%{_bindir}/" help2man --no-info --no-discard-stderr --name="${binary}" --version-string="${binary} %{version}" --output="${binary// /-}.1" "${binary}" cat "${binary// /-}.1" install -t '%{buildroot}%{_mandir}/man1' -p -m 0644 -D "${binary// /-}.1" done %check %if %{with tests} # Docker tests are skipped automatically if docker is not available. # To make it explicit of what is being skipped, I added it anyway. # Funtional tests require xnat4tests. %pytest -v -m 'not docker_test and not functional_test' %else # Import test currently fails # https://gitlab.com/radiology/infrastructure/xnatpy/-/issues/57 %pyproject_check_import %endif %files -n python3-xnat -f %{pyproject_files} %doc README.rst %{_bindir}/xnat %{_bindir}/xnat_cp_project %{_bindir}/xnat_data_integrity-check %{_mandir}/man1/xnat* %changelog ## START: Generated by rpmautospec * Sat Oct 12 2024 Sandro <devel@penguinpee.nl> - 0.6.2-1 - Update to 0.6.2 (RHBZ#2283039) * Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.3-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild * Sat Jun 08 2024 Python Maint <python-maint@redhat.com> - 0.5.3-8 - Rebuilt for Python 3.13 * Wed Mar 13 2024 Sandro <devel@penguinpee.nl> - 0.5.3-7 - Fix Packit config * Wed Feb 21 2024 Sandro <devel@penguinpee.nl> - 0.5.3-6 - Apply patch fixing import test * Tue Feb 06 2024 Sandro <devel@penguinpee.nl> - 0.5.3-5 - Patch out xnat4tests * Tue Feb 06 2024 Sandro <devel@penguinpee.nl> - 0.5.3-4 - Add Packit config * Tue Feb 06 2024 Sandro <devel@penguinpee.nl> - 0.5.3-3 - Clean up spec file - Define test dependencies manually - Drop mangling of *requirements.txt (obsolete) - Run all tests by default * Tue Feb 06 2024 Sandro <devel@penguinpee.nl> - 0.5.3-2 - Use human friendly bcond - Run import test (once that is fixed) * Tue Feb 06 2024 Sandro <devel@penguinpee.nl> - 0.5.3-1 - Update to 0.5.3 (RHBZ#2241765) * Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild * Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild * Thu Jan 04 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.5.1-4 - Assert that the .dist-info directory contains a license file * Tue Sep 19 2023 Sandro <devel@penguinpee.nl> - 0.5.1-3 - Silence %%forgemeta * Sun Sep 17 2023 Sandro <devel@penguinpee.nl> - 0.5.1-2 - Add man pages (thanks @ankursinha) - small change to %%summary and %%description * Fri Sep 15 2023 Sandro <devel@penguinpee.nl> - 0.5.1-1 - Update to 0.5.1 (RHBZ#2138814) - Use forge macros for fedora >= 40 - Migrate to SPDX license - Fix line breaks in %%description * Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.2-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild * Wed Jun 14 2023 Python Maint <python-maint@redhat.com> - 0.4.2-5 - Rebuilt for Python 3.12 * Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.2-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild * Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.2-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild * Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 0.4.2-2 - Rebuilt for Python 3.11 * Fri May 06 2022 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.4.2-1 - feat: update to 0.4.2 (fixes rhbz#2056929) * Thu Feb 10 2022 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.4.0-1 - feat: update to 4.0.1 (fixes rhbz#2018060) * Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.26-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild * Tue Jul 06 2021 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.3.26-1 - Update to latest release * Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 0.3.25-3 - Rebuilt for Python 3.10 * Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.25-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild * Sat Nov 28 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.3.25-1 - Update to latest release * Sat Aug 08 2020 Luis Bazan <lbazan@fedoraproject.org> - 0.3.24-1 - New upstream version * Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.22-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild * Tue May 26 2020 Miro HronÄok <mhroncok@redhat.com> - 0.3.22-2 - Rebuilt for Python 3.9 * Fri Feb 28 2020 Luis Bazan <lbazan@fedoraproject.org> - 0.3.22-1 - New upstream version * Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.21-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild * Wed Oct 23 2019 Aniket Pradhan <major AT fedoraproject DOT org> - 0.3.21-1 - Upgraded to v0.3.21 * Sun Sep 22 2019 Luis Bazan <lbazan@fedoraproject.org> - 0.3.19-1 - New upstream * Mon Aug 19 2019 Miro HronÄok <mhroncok@redhat.com> - 0.3.18-3 - Rebuilt for Python 3.8 * Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.18-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild * Thu Jun 06 2019 Luis Bazan <lbazan@fedoraproject.org> - 0.3.18-1 - New upstream version * Mon Apr 08 2019 Luis Bazan <lbazan@fedoraproject.org> - 0.3.17-1 - New upstream version * Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.11-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild * Wed Dec 19 2018 Luis Bazan <lbazan@fedoraproject.org> - 0.3.11-4 - enable python-progressbar2 * Thu Nov 29 2018 Luis Bazan <lbazan@fedoraproject.org> - 0.3.11-3 - Use template of neuro-sig * Tue Nov 20 2018 Luis Bazan <lbazan@fedoraproject.org> - 0.3.11-2 - Add remove bundled egg info * Mon Nov 19 2018 Luis Bazan <lbazan@fedoraproject.org> - 0.3.11-1 - New upstream ## END: Generated by rpmautospec