%global pypi_name extras
# There is a circular dependency to run the tests:
# We need python-testtools to run the tests but that package requires
# python-extras.
# The bootstrap flag prevents the tests from running until python-extras and
# python-testtools are present in the repository.
%global bootstrap 1
Name: python-extras
Version: 1.0.0
Release: 1%{?dist}
Summary: Useful extra bits for Python
License: MIT
URL: https://github.com/testing-cabal/extras
Source0: %{pypi_source}
BuildArch: noarch
BuildRequires: python-devel
BuildRequires: python-setuptools
%if ! 0%{bootstrap}
BuildRequires: python-testtools
%endif
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
%if ! 0%{bootstrap}
BuildRequires: python%{python3_pkgversion}-testtools
%endif
%description
extras is a set of extensions to the Python standard library, originally
written to make the code within testtools cleaner, but now split out for
general use outside of a testing context.
%package -n python%{python3_pkgversion}-extras
Summary: Useful extra bits for Python
%{?python_provide:%python_provide python%{python3_pkgversion}-extras}
%description -n python%{python3_pkgversion}-extras
extras is a set of extensions to the Python standard library, originally
written to make the code within testtools cleaner, but now split out for
general use outside of a testing context.
%prep
%setup -q -n extras-%{version}
# Remove bundled egg-info
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python}|'
%build
%py2_build
pushd %{py3dir}
%py3_build
popd
%install
# Must do the python3 install first because the scripts in /usr/bin are
# overwritten with every setup.py install (and we want the python2 version
# to be the default for now).
pushd %{py3dir}
%py3_install
popd
%py2_install
%check
%if ! 0%{bootstrap}
%{__python} setup.py test
pushd %{py3dir}
%{__python3} setup.py test
popd
%endif
%files
%license LICENSE
%doc NEWS README.rst
# For noarch packages: sitelib
%{python_sitelib}/*
%files -n python%{python3_pkgversion}-extras
%license LICENSE
%doc NEWS README.rst
%{python3_sitelib}/*
%changelog
* Tue Apr 14 2020 Felix Schwarz <fschwarz@fedoraproject.org> - 1.0.0-1
- update to 1.0.0
* Sun Feb 9 2020 Scott K Logan <logans@cottsay.net> - 0.0.3-3
- Add python 3 subpackage for EPEL 7
* Wed May 29 2013 Matthias Runge <mrunge@redhat.com> - 0.0.3-2
- spec cleanup and enable tests
* Wed May 1 2013 Michel Salim <salimma@fedoraproject.org> - 0.0.3-1
- Initial package