6956ef5
%if 0%{?fedora} > 12
6956ef5
%global with_python3 1
6956ef5
%endif
6956ef5
f6a25f9
%if 0%{?el6} 
6956ef5
%{!?__python2: %global __python2 /usr/bin/python2}
f6a25f9
%{!?python2_version: %global python2_version 2.6}
6956ef5
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
6956ef5
%endif
6956ef5
6956ef5
# Tests are available in head version but not in release 0.5
6956ef5
# enable them at next release.
6956ef5
%global with_checks 0
6956ef5
6956ef5
Name:           python-humanize
29b0325
Version:        0.5.1
824545b
Release:        4%{?dist}
6956ef5
Summary:        Turns dates in to human readable format, e.g '3 minutes ago'
6956ef5
6956ef5
License:        MIT
6956ef5
URL:            https://github.com/jmoiron/humanize
29b0325
Source0:        https://pypi.python.org/packages/source/h/humanize/humanize-%{version}.tar.gz
6956ef5
6956ef5
BuildArch:      noarch
6956ef5
BuildRequires:  python-setuptools
6956ef5
BuildRequires:  python2-devel
6956ef5
%if 0%{?with_python3}
6956ef5
BuildRequires:  python3-devel
6956ef5
BuildRequires:  python3-setuptools
6956ef5
BuildRequires:  python3-tools
6956ef5
%endif
6956ef5
6956ef5
6956ef5
%description
6956ef5
This modest package contains various common humanization utilities, like turning
6956ef5
a number into a fuzzy human readable duration ('3 minutes ago') or into a human
6956ef5
readable size or throughput.
6956ef5
6956ef5
6956ef5
%if 0%{?with_python3}
6956ef5
%package -n python3-humanize
6956ef5
Summary:        Turns dates in to human readable format, e.g '3 minutes ago'
6956ef5
6956ef5
%description -n python3-humanize
6956ef5
This modest package contains various common humanization utilities, like turning
6956ef5
a number into a fuzzy human readable duration ('3 minutes ago') or into a human
6956ef5
readable size or throughput.
6956ef5
%endif
6956ef5
6956ef5
%prep
6956ef5
%setup -q -n humanize-%{version}
6956ef5
6956ef5
# Remove shebangs from libs.
6956ef5
for lib in humanize/time.py humanize/filesize.py humanize/number.py; do
6956ef5
 sed '1{\@^#!/usr/bin/env python@d}' $lib > $lib.new &&
6956ef5
 touch -r $lib $lib.new && mv $lib.new $lib
6956ef5
done
6956ef5
6956ef5
%if 0%{?with_python3}
6956ef5
rm -rf %{py3dir}
6956ef5
cp -a . %{py3dir}
6956ef5
%endif
6956ef5
6956ef5
%build
6956ef5
%if 0%{?with_python3}
6956ef5
pushd %{py3dir}
6956ef5
# LANG required so README.rst can be parsed.
6956ef5
LANG=en_US.UTF-8 %{__python3} setup.py build
6956ef5
popd
6956ef5
%endif
6956ef5
6956ef5
%{__python2} setup.py build
6956ef5
6956ef5
%install
6956ef5
%if 0%{?with_python3}
6956ef5
pushd %{py3dir}
6956ef5
LANG=en_US.UTF-8 %{__python3} setup.py install --skip-build --root %{buildroot}
6956ef5
%find_lang humanize
6956ef5
popd
6956ef5
%endif
6956ef5
6956ef5
%{__python2} setup.py install --skip-build --root %{buildroot}
f6a25f9
%if ! 0%{?el6}
6956ef5
%find_lang humanize
f6a25f9
%else
f6a25f9
touch humanize.lang
f6a25f9
%endif
6956ef5
6956ef5
# Remove python3 lang files
6956ef5
%if 0%{?with_python3}
6956ef5
sed -i 's|^.*%{python3_sitelib}.*||' humanize.lang
6956ef5
%endif
6956ef5
6956ef5
%check
6956ef5
%if 0%{?with_checks}
6956ef5
%{__python2} setup.py test
6956ef5
%if 0%{?with_python3}
6956ef5
pushd %{py3dir}
6956ef5
LANG=en_US.UTF-8 %{__python3} setup.py test
6956ef5
popd
6956ef5
%endif
6956ef5
%endif
6956ef5
6956ef5
%files -f humanize.lang
6956ef5
%doc README.rst LICENCE
6956ef5
%dir %{python2_sitelib}/humanize
6956ef5
%{python2_sitelib}/humanize/*.py*
6956ef5
%{python2_sitelib}/humanize-%{version}-py%{python2_version}.egg-info
f6a25f9
%if ! 0%{?el6}
6956ef5
%exclude %{_usr}/lib/python*/site-packages/humanize/locale/*/LC_MESSAGES/*.po
f6a25f9
%else
f6a25f9
%{python2_sitelib}/humanize/locale
f6a25f9
%endif
6956ef5
6956ef5
%if 0%{?with_python3}
6956ef5
%files -n python3-humanize -f %{py3dir}/humanize.lang
6956ef5
%doc README.rst LICENCE
6956ef5
%dir %{python3_sitelib}/humanize
6956ef5
%{python3_sitelib}/humanize/*.py
6956ef5
%{python3_sitelib}/humanize/__pycache__
6956ef5
%{python3_sitelib}/humanize-%{version}-py%{python3_version}.egg-info
6956ef5
%exclude %{_usr}/lib/python*/site-packages/humanize/locale/*/LC_MESSAGES/*.po
6956ef5
%endif
6956ef5
6956ef5
%changelog
824545b
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-4
824545b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
824545b
Robert Kuska 368eecc
* Fri Nov 06 2015 Robert Kuska <rkuska@redhat.com> - 0.5.1-3
Robert Kuska 368eecc
- Rebuilt for Python3.5 rebuild
Robert Kuska 368eecc
8e0ba5e
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.1-2
8e0ba5e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
8e0ba5e
29b0325
* Mon Jun 1 2015 Steve Traylen <steve.traylen@cern.ch> 0.5.1-1
29b0325
- New 0.5.1
29b0325
4c65e5c
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5-6
4c65e5c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
4c65e5c
02385f2
* Wed May 28 2014 Kalev Lember <kalevlember@gmail.com> - 0.5-5
02385f2
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
02385f2
f6a25f9
* Wed May 14 2014 Steve Traylen <steve.traylen@cern.ch> 0.5-4
f6a25f9
- lang fixes for .el6 target.
f6a25f9
6956ef5
* Wed Apr 23 2014 Steve Traylen <steve.traylen@cern.ch> 0.5-3
6956ef5
- Use __python2 rather than __python throughout. - rhbz#1088882
6956ef5
6956ef5
* Tue Apr 22 2014 Steve Traylen <steve.traylen@cern.ch> 0.5-2
6956ef5
- Add python3 package - rhbz#1088882.
6956ef5
6956ef5
* Thu Apr 17 2014 Steve Traylen <steve.traylen@cern.ch> 0.5-1
6956ef5
- First release
6956ef5