## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    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

Name:           python-irodsclient
Version:        3.1.0
Release:        %autorelease
Summary:        A python API for iRODS

# SPDX
License:        BSD-3-Clause
URL:            https://github.com/irods/python-irodsclient
Source0:        %{pypi_source python_irodsclient}
# Man page hand-written for Fedora in groff_man(7) format based on --help
Source1:        prc_write_irodsA.py.1

BuildSystem:            pyproject
BuildOption(install):   -l irods
# * The test runner module requires xmlrunner, which is no longer packaged.
# * Merely importing ssl_test_client requires configured iRODS credentials.
BuildOption(check): -e irods.test.runner -e irods.test.ssl_test_client
# All tests require network access and a valid account on a running iRODS grid.
# See irods/test/README.rst.

BuildArch:      noarch

%global common_description %{expand:
iRODS (https://www.irods.org/) is an open source distributed data management
system. This is a client API implemented in Python.}

%description %{common_description}


%package -n python3-irodsclient
Summary:        %{summary}

# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_provides_for_importable_modules
%py_provides python3-irods

%description -n python3-irodsclient %{common_description}


%install -a
install -t '%{buildroot}%{_mandir}/man1' -p -m 0644 -D '%{SOURCE1}'
%py3_shebang_fix '%{buildroot}%{_bindir}/prc_write_irodsA.py'

# Remove useless shebangs in files that were be installed without executable
# permission. The pattern of selecting files before modifying them with sed
# keeps us from unnecessarily discarding the original mtimes on unmodified
# files. Note that we must not do this in %%prep because we want to strip the
# shebang from the copy of prc_write_irodsA.py in site-packages, but not from
# the copy in %%{_bindir}.
find '%{buildroot}%{python3_sitelib}/irods' -type f -name '*.py' \
    -exec gawk '/^#!/ { print FILENAME }; { nextfile }' '{}' '+' |
  xargs -r sed -r -i '1{/^#!/d}'


%files -n python3-irodsclient -f %{pyproject_files}
%doc CHANGELOG.md
%doc README.md

%{_bindir}/prc_write_irodsA.py
%{_mandir}/man1/prc_write_irodsA.py.1*


%changelog
## START: Generated by rpmautospec
* Sat Mar 22 2025 Benjamin A. Beasley <code@musicinmybrain.net> - 3.1.0-1
- Update to 3.1.0 (close RHBZ#2354216)

* Wed Jan 29 2025 Benjamin A. Beasley <code@musicinmybrain.net> - 3.0.0-5
- Update/correct the patch for SyntaxWarnings

* Sat Jan 25 2025 Benjamin A. Beasley <code@musicinmybrain.net> - 3.0.0-4
- F41+: Use the provisional declarative buildsystem

* Sat Jan 25 2025 Benjamin A. Beasley <code@musicinmybrain.net> - 3.0.0-3
- Patch: Fix some SyntaxWarnings in the tests

* Sat Jan 25 2025 Benjamin A. Beasley <code@musicinmybrain.net> - 3.0.0-2
- Patch: Replace deprecated description-file with description_file

* Sat Jan 25 2025 Benjamin A. Beasley <code@musicinmybrain.net> - 3.0.0-1
- Update to 3.0.0 (close RHBZ#2333446)

* Sat Jan 18 2025 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild

* Tue Oct 15 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 2.2.0-1
- Update to 2.2.0 (close RHBZ#2318580)

* Sun Aug 25 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 2.1.0-1
- Initial commit (close RHBZ#2307614)
## END: Generated by rpmautospec