Blob Blame Raw
%global upstream_name blessings

%if 0%{?fedora} || 0%{?rhel} > 6
%bcond_without python3
%else
%bcond_with python3
%endif

Name:           python-%{upstream_name}
Version:        1.5
Release:        1%{?dist}
Summary:        Python library for terminal coloring, styling, and positioning
License:        MIT
URL:            https://github.com/erikrose/blessings
Source0:        http://pypi.python.org/packages/source/b/%{upstream_name}/%{upstream_name}-%{version}.tar.gz
# https://github.com/erikrose/blessings/issues/25
Patch0:         blessings-1.5-tests-without-tty.patch
BuildArch:      noarch
BuildRequires:  python2-devel
BuildRequires:  python-setuptools
BuildRequires:  python-nose
%if %{with python3}
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-nose
%endif

%description
Blessings is a thin, practical wrapper around terminal coloring, styling, and 
positioning in Python.

%if %{with python3}
%package -n python3-%{upstream_name}
Summary:        Python library for terminal coloring, styling, and positioning

%description -n python3-%{upstream_name}
Blessings is a thin, practical wrapper around terminal coloring, styling, and 
positioning in Python.
%endif

%prep
%setup -q -n %{upstream_name}-%{version}
%patch0 -p1
rm -rf blessings.egg-info

%if %{with python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif

%build
%{__python} setup.py build

%if %{with python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif

%install
%if %{with python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif

%{__python} setup.py install --skip-build --root %{buildroot}

%check
%{__python} setup.py test

%if %{with python3}
pushd %{py3dir}
%if %{?fedora} <= 17
nosetests-3.2 build/lib
%else
nosetests-3.3 build/lib
%endif
popd
%endif

%files
%doc README.rst LICENSE
%{python_sitelib}/blessings
%{python_sitelib}/blessings*.egg-info

%if %{with python3}
%files -n python3-%{upstream_name}
%doc README.rst LICENSE
%{python3_sitelib}/blessings
%{python3_sitelib}/blessings*.egg-info
%endif

%changelog
* Fri Nov 30 2012 Dan Callaghan <dcallagh@redhat.com> - 1.5-1
- initial version