Blob Blame History Raw
%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.12.13
Release:        2%{?dist}
URL:            https://github.com/amoffat/sh/
Source:         https://github.com/amoffat/%{oname}/archive/%{version}.tar.gz
Patch2:         no-coverage.patch
Patch3:         pep-0538-test-fix.patch

BuildArch:      noarch
BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
BuildRequires:  lsof

%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.

%package -n python2-%{oname}
Summary:        Python module to simplify calling shell commands
%{?python_provide:%python_provide python2-%{oname}}

%description -n python2-%{oname}
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
%{?python_provide:%python_provide python3-%{oname}}

%description -n python3-sh
A Python module to simplify calling shell commands.
Also known as PBS, or Python Bash Scripting.
%endif

%prep
%setup -n %{oname}-%{version}
%patch2 -p1
%if 0%{?fedora} >= 26
%patch3 -p1
%endif


%build
%py2_build

%if 0%{?with_python3}
%py3_build
%endif

%install
# Must do the python2 install first because the scripts in /usr/bin are
# overwritten with every setup.py install, and in general we want the
# python3 version to be the default.
# If, however, we're installing separate executables for python2 and python3,
# the order needs to be reversed so the unversioned executable is the python2 one.
%py2_install
%if 0%{?with_python3}
%py3_install
%endif

%check
%{__python2} sh.py travis
%if 0%{?with_python3}
%{__python3} sh.py travis
%endif

%files -n python2-%{oname}
%license LICENSE.txt
%{python_sitelib}/sh.py*
%{python_sitelib}/%{oname}-%{version}*
%doc CHANGELOG.md README.rst

%if 0%{?with_python3}
%files -n python3-sh
%license LICENSE.txt
%{python3_sitelib}/sh.py
%{python3_sitelib}/__pycache__/sh*.py*
%{python3_sitelib}/%{oname}-%{version}*
%doc CHANGELOG.md README.rst
%endif

%changelog
* 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

* 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