Upgrade to the latest upstream (RHBZ #1229552)

This commit is contained in:
Matěj Cepl 2015-06-09 22:28:25 +02:00
commit 33cb2abb5a
4 changed files with 63 additions and 34 deletions

View file

@ -1,27 +1,35 @@
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%if 0%{?rhel} >= 8 || 0%{?fedora} >= 16
%bcond_without python3
%else
%bcond_with python3
%endif
%global tardirname aaronsw-html2text-c368b14
%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif
Name: python-html2text
Version: 3.200.3
Release: 7%{?dist}
%global upname html2text
Name: python-%{upname}
Version: 2015.6.6
Release: 1%{?dist}
Summary: Converts a page of HTML into plain ASCII text
Group: Development/Languages
License: GPLv3
URL: http://www.aaronsw.com/2002/html2text/
#Source0: https://github.com/aaronsw/html2text/tarball/%{version}/%{name}-%{version}.tar.gz
# git clone git://github.com/aaronsw/html2text.git aaronsw-html2text-c368b14 ; cd aaronsw-html2text-c368b14 ; git checkout c368b14
Source0: aaronsw-html2text-3.02-77-gc368b14.tar.gz
URL: http://alir3z4.github.io/html2text/
Source0: https://pypi.python.org/packages/source/h/%{upname}/%{upname}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: python
BuildRequires: python-devel
BuildRequires: python-setuptools
# Debian bug #299027
Patch0: aaronsw-html2text-remove-newlines.patch
%if %{with python3}
BuildRequires: python3-devel
%endif
%description
@ -31,32 +39,63 @@ be valid Markdown (a text-to-HTML format).
Also known as: THE ASCIINATOR, html to text, htm to txt, htm2txt, ...
%if %{with python3}
%package -n python3-%{upname}
Summary: Easily build and distribute Python 3 packages
Group: Applications/System
%description -n python3-%{upname}
html2text is a Python script that converts a page of HTML into clean,
easy-to-read plain ASCII text. Better yet, that ASCII also happens to
be valid Markdown (a text-to-HTML format).
Also known as: THE ASCIINATOR, html to text, htm to txt, htm2txt, ...
This package contains python3 version of the package.
%endif # with_python3
%prep
%setup -q -n %{tardirname}
%patch0 -p1 -b .remove-newlines
%setup -q -n %{upname}-%{version}
%build
%install
%{__python} setup.py install --root $RPM_BUILD_ROOT
# new script in 3.200.3 : conflicts with package' html2text' obviously
mv $RPM_BUILD_ROOT/usr/bin/html2text $RPM_BUILD_ROOT/usr/bin/%{name}
%if %{with python3}
%{__python3} setup.py install --root %{buildroot}
# we don't need second binary
rm -fv $RPM_BUILD_ROOT%{_bindir}/html2text
%endif
%{__python2} setup.py install --root %{buildroot}
# new script in 3.200.3 : conflicts with package' html2text' obviously
mv $RPM_BUILD_ROOT%{_bindir}/html2text $RPM_BUILD_ROOT%{_bindir}/%{name}
%check
cd test
PYTHONPATH=${RPM_BUILD_ROOT}%{python_sitelib} %{__python} run_tests.py
%{__python} setup.py test
%if %{with python3}
%{__python3} setup.py test
%endif
%files
/usr/bin/%{name}
%{python_sitelib}/*
%{_bindir}/%{name}
%{python2_sitelib}/*
%doc COPYING
%if %{with python3}
%files -n python3-%{upname}
%{python3_sitelib}/*
%doc COPYING
%endif
%changelog
* Tue Jun 09 2015 Matej Cepl <mcepl@redhat.com> - 2015.6.6-1
- Upgrade to the latest upstream (RHBZ #1229552)
* Mon Jun 30 2014 Toshio Kuratomi <toshio@fedoraproject.org> - 3.200.3-7
- Replace python-setuptools-devel BR with python-setuptools