%if 0%{?fedora}
%bcond_without python3 # with
%else
%bcond_with python3 # without
%endif
%global srcname fuckit
Name: python-%{srcname}
Version: 4.8.0
Release: 2%{?dist}
Summary: The Python Error Steamroller
License: WTFPL
URL: https://github.com/ajalt/fuckitpy
Source0: https://pypi.python.org/packages/source/f/fuckit/fuckit-4.8.0.zip
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python-setuptools
BuildRequires: python-nose
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-nose
%endif # if with_python3
%description
FuckIt.py uses state-of-the-art technology to make sure your Python code runs
whether it has any right to or not. Some code has an error? Fuck it.
%if 0%{?with_python3}
%package -n python3-%{srcname}
Summary: The Python Error Steamroller
%description -n python3-%{srcname}
FuckIt.py uses state-of-the-art technology to make sure your Python code runs
whether it has any right to or not. Some code has an error? Fuck it.
%endif # with_python3
%prep
%setup -qn %{srcname}-%{version}
find -name '*.txt' | xargs chmod -x
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif # with_python3
find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'
%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 --root %{buildroot}
popd
%endif # with_python3
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
%check
%{__python2} setup.py test
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py test
rm -rf %{buildroot}%{python3_sitelib}/__pycache__
popd
%endif # with_python3
%files
# The license text is available in README.md
%doc README.md
%{python2_sitelib}/%{srcname}.py*
%{python2_sitelib}/%{srcname}-%{version}*.egg-info
%if 0%{?with_python3}
%files -n python3-%{srcname}
# The license text is available in README.md
%doc README.md
%{python3_sitelib}/%{srcname}.py*
%{python3_sitelib}/%{srcname}-%{version}*.egg-info
%endif # with_python3
%changelog
* Mon Nov 10 2014 Ian Weller <ian@ianweller.org> - 4.8.0-2
- Only build for Python 3 on EPEL
* Mon Sep 15 2014 Ian Weller <ian@ianweller.org> - 4.8.0-1
- Update to 4.8.0 and fix packaging concerns
* Fri Dec 06 2013 Ian Weller <iweller@redhat.com> - 1.0.0-1.20131206gitb8cf18f
- Initial package build