Blob Blame History Raw
%global with_python3 1

%if 0%{?rhel} && 0%{?rhel} <= 7
%global with_python3 0
%endif

%global pypi_name spec

Name:           python-%{pypi_name}
Version:        1.0.0
Release:        6%{?dist}
Summary:        Specification-style output for python2-nose

License:        MIT
URL:            https://github.com/bitprophet/spec
Source0:        https://pypi.python.org/packages/source/s/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
# LICENSE file from Github
# https://raw.githubusercontent.com/bitprophet/spec/master/LICENSE
Source1:        LICENSE
BuildArch:      noarch

BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
%if 0%{?with_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
%endif # if with_python3

Requires:       python2-nose >= 1.3
Requires:       python2-six

Provides:       python2-spec

%description
spec is a Python 2 testing tool that provides:

* Colorized, specification style output
* Colorized tracebacks and summary
* Test-running CLI tool which enables useful non-default options and implements
relaxed test discovery for less test_annoying.py:TestBoilerplate.test_code and
more readable.py:Classes.and_methods. 


%if 0%{?with_python3}
%package -n python3-spec
Summary:        Specification-style output for python3-nose
Group:          Development/Libraries
Requires:       python3-nose >= 1.3
Requires:       python3-six

%description -n python3-spec
spec is a Python 3 testing tool that provides:

* Colorized, specification style output
* Colorized tracebacks and summary
* Test-running CLI tool which enables useful non-default options and implements
relaxed test discovery for less test_annoying.py:TestBoilerplate.test_code and
more readable.py:Classes.and_methods.
%endif # with_python3

%prep
%setup -q -n %{pypi_name}-%{version}
cp -p %{SOURCE1} .
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif # with_python3


%build
%{__python2} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3


%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --prefix=%{_prefix} --root=%{buildroot}
mv %{buildroot}/%{_bindir}/spec %{buildroot}%{_bindir}/spec-%{python3_version}
ln -s spec-%{python3_version} %{buildroot}%{_bindir}/spec-3
popd
%endif # with_python3

%{__python2} setup.py install -O1 --skip-build --prefix=%{_prefix} --root=%{buildroot}
mv %{buildroot}/%{_bindir}/spec %{buildroot}%{_bindir}/spec-%{python2_version}
ln -s spec-%{python2_version} %{buildroot}%{_bindir}/spec-2
ln -s spec-%{python2_version} %{buildroot}%{_bindir}/spec

# Upstream queried to include license file
%files
%{!?_licensedir:%global license %%doc}
%license LICENSE
%{_bindir}/spec-2*
%{_bindir}/spec
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info

%if 0%{?with_python3}
%files -n python3-spec
%{!?_licensedir:%global license %%doc}
%license LICENSE
%{_bindir}/spec-3*
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%endif # with_python3


%changelog
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Sun Dec  6 2015 Toshio Kuratomi <toshio@fedoraproject.org> - - 1.0.0-5
- Add provides for python2-spec

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

* Thu Nov  5 2015 Toshio Kuratomi <toshio@fedoraproject.org> - 1.0.0-3
- Fix the python2 and python3 scripts to coexist according to the
  Packaging:Python guidelines
- Fix dist tag

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

* Sat Mar 28 2015 Eduardo Mayorga Téllez <mayorga@fedoraproject.org> - 1.0.0-1
- Update to 1.0.0

* Sun Aug 03 2014 Eduardo Mayorga Téllez <mayorga@fedoraproject.org> - 0.11.1-2
- Changing Requires from python2- to python-

* Tue Jul 29 2014 Eduardo Mayorga Téllez <mayorga@fedoraproject.org> - 0.11.1-1
- Initial packaging