%if 0%{?fedora}
%global with_python3 1
%endif
%global oname sh
Name: python-sh
License: MIT
Group: Development/Libraries
Summary: Python module to simplify calling shell commands
Version: 1.11
Release: 1%{?dist}
URL: https://github.com/amoffat/sh/
Source: https://github.com/amoffat/%{oname}/archive/%{oname}-%{version}.tar.gz
# This patch is proposed upstream (https://github.com/amoffat/sh/pull/237)
# https://bugzilla.redhat.com/show_bug.cgi?id=1306405
Patch0001: 0001-Kill-the-entire-process-group-when-a-command-times-o.patch
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python-setuptools
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%endif
%description
A Python module to simplify calling shell commands.
Also known as PBS, or Python Bash Scripting.
%if 0%{?with_python3}
%package -n python3-sh
Summary: Python module to simplify calling shell commands
Group: Development/Libraries
%description -n python3-sh
A Python module to simplify calling shell commands.
Also known as PBS, or Python Bash Scripting.
%endif
%prep
%setup -q -n %{oname}-%{version}
%patch0001 -p1
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
%build
%{__python} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif
%check
python sh.py test
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} sh.py test
popd
%endif
%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif
%{__python} setup.py install --skip-build --root %{buildroot}
%files
%{python_sitelib}/sh.py*
%{python_sitelib}/%{oname}-%{version}*
%doc AUTHORS.md README.md LICENSE.txt
%if 0%{?with_python3}
%files -n python3-sh
%{python3_sitelib}/sh.py
%{python3_sitelib}/__pycache__/sh*.py*
%{python3_sitelib}/%{oname}-%{version}*
%doc AUTHORS.md README.md LICENSE.txt
%endif
%changelog
* 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