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

%global common_description %{expand:
sh is a full-fledged subprocess replacement for Python that allows you to call
any program as if it were a function.  sh is not a collection of system
commands implemented in Python.}

Name:           python-sh
Version:        2.0.6
Release:        %autorelease
Summary:        Python subprocess replacement
License:        MIT
URL:            https://sh.readthedocs.io/
Source:         %{pypi_source sh}
BuildArch:      noarch
BuildRequires:  python3-devel
# Several tests run the python command.
BuildRequires:  python-unversioned-command


%description %{common_description}


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


%description -n python3-sh %{common_description}


%prep
%autosetup -p 1 -n sh-%{version}


%generate_buildrequires
%pyproject_buildrequires


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files sh


%check
# The tests expect sh.py and sh_test.py to be in the same directory.
# https://github.com/amoffat/sh/blob/2.0.6/tests/Dockerfile#L47
# https://github.com/amoffat/sh/blob/2.0.6/tox.ini#L14
mv tests/sh_test.py .

# https://github.com/amoffat/sh/commit/bfb2bc97635f694de3e5234dcec08d604f0d880f
export SH_TESTS_RUNNING=1

# Normally we should run the tests with %%{py3_test_envvars}, but some tests
# fail if we modify PYTHONPATH.
# https://github.com/amoffat/sh/issues/692

# Run tests with both poll and select.
# https://github.com/amoffat/sh/commit/e8737f82585bc39a3bc079c5fa7054c973148e3d
SH_TESTS_USE_SELECT=0 %{python3} sh_test.py
SH_TESTS_USE_SELECT=1 %{python3} sh_test.py


%files -n python3-sh -f %{pyproject_files}
%license LICENSE.txt
%doc README.rst CHANGELOG.md MIGRATION.md


%changelog
## START: Generated by rpmautospec
* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.6-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Fri Jun 07 2024 Python Maint <python-maint@redhat.com> - 2.0.6-5
- Rebuilt for Python 3.13

* Mon Jan 29 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Thu Aug 10 2023 Carl George <carlwgeorge@fedoraproject.org> - 2.0.6-1
- Update to version 2.0.6, resolves rhbz#2169128

* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.14.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Tue Jun 13 2023 Python Maint <python-maint@redhat.com> - 1.14.3-3
- Rebuilt for Python 3.12

* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.14.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Sun Sep 18 2022 Kevin Fenzi <kevin@scrye.com> - 1.14.3-1
- Update to 1.14.3. Fixes rhbz#2108380

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.14.2-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 1.14.2-6
- Rebuilt for Python 3.11

* Sat Mar 19 2022 Carl George <carl@george.computer> - 1.14.2-5
- Convert to pyproject macros
- Skip test_no_fd_leak test by removing lsof build requirement rhbz#2033204

* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.14.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.14.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 1.14.2-2
- Rebuilt for Python 3.10

* Sat May 22 2021 Kevin Fenzi <kevin@scrye.com> - 1.14.2-1
- Update to 1.14.2. Fixes rhbz#1960814

* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.14.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Thu Dec 31 2020 Kevin Fenzi <kevin@scrye.com> - 1.14.1-1
- Update to 1.14.1. Fixes rhbz#1891289

* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.13.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Fri Jun 26 2020 Charalampos Stratakis <cstratak@redhat.com> - 1.13.1-1
- Update to 1.13.1 (#1828679)

* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 1.12.14-17
- Rebuilt for Python 3.9

* Fri Feb 07 2020 Carl George <carl@george.computer> - 1.12.14-16
- Always apply patch3 (el8 fix)

* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.12.14-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 1.12.14-14
- Rebuilt for Python 3.8.0rc1 (#1748018)

* Thu Aug 22 2019 Miro Hrončok <mhroncok@redhat.com> - 1.12.14-13
- Subpackage python2-sh has been removed
  See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal

* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 1.12.14-12
- Rebuilt for Python 3.8

* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.12.14-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Tue Feb 12 2019 Carl George <carl@george.computer> - 1.12.14-10
- Refresh patch4, which also obsoletes patch5

* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.12.14-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Tue Jul 24 2018 Pierre-Yves Chibon <pingou@pingoured.fr> - 1.12.14-8
- Fix tests for the drop of the unversioned python interpreter

* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.12.14-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Wed Jun 20 2018 Carl George <carl@george.computer> - 1.12.14-6
- Add patch4 to always use fully versioned python command in tests

* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 1.12.14-5
- Rebuilt for Python 3.7

* Thu Mar 08 2018 Carl George <carl@george.computer> - 1.12.14-4
- Use common license and documentation directory
- Enable EPEL python3 subpackage

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.12.14-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.12.14-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Wed Jun 07 2017 Carl George <carl.george@rackspace.com> - 1.12.14-1
- Latest upstream
- Update patch0 to account for changes in PEP-0538

* Sun Apr 16 2017 Carl George <carl.george@rackspace.com> - 1.12.13-2
- Add patch2 to remove coverage (too old in EL6/7, doesn't add any value for packaging)
- Add patch3 to fix tests to work with PEP-0538 changes in F26+ (obsoletes patch1)
- Run tests via `sh.py travis` to only test with the called python version
- Properly install license
- Switch to PyPI tarball
- Update summary and description

* Sat Apr 15 2017 Kevin Fenzi <kevin@scrye.com> - 1.12.13-1
- Update to 1.12.13. Fixes bug #1442462
- Update to current python guidelines. Fixes bug #1442465

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.11-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 1.11-3
- Rebuild for Python 3.6

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.11-2
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Mon Feb 15 2016 Javier Peña <jpena@redhat.com> - 1.11-1
- Updated to upstream version 1.11
- Kill the entire process group when a command times out (bz#1306405)

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.08-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.08-6
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.08-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.08-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed May 28 2014 Kalev Lember <kalevlember@gmail.com> - 1.08-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.08-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Sat Apr 13 2013 Ralph Bean <rbean@redhat.com> - 1.08-1
- Latest upstream version.
- More explicit directory ownership in files section.
- Added python3-sh subpackage.

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.02-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Tue Sep 18 2012 Andy Grover <agrover@redhat.com> - 1.02-2
- Re-add check

* Mon Sep 17 2012 Andy Grover <agrover@redhat.com> - 1.02-1
- New upstream release
- New upstream download location
- Remove check, upstream unittest has been removed

* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.107-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Thu Jun 28 2012 Andy Grover <agrover@redhat.com> - 0.107-1
- New upstream release

* Fri May 4 2012 Andy Grover <agrover@redhat.com> - 0.105-1
- New upstream release

* Thu Mar 22 2012 Andy Grover <agrover@redhat.com> - 0.95-2
- Initial packaging

## END: Generated by rpmautospec