Blob Blame History Raw
%if 0%{?rhel} >= 8 || 0%{?fedora} >= 16
%bcond_without python3
%else
%bcond_with python3
%endif

%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

%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://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-devel
BuildRequires:  python-setuptools
%if %{with python3}
BuildRequires:  python3-devel
%endif


%description
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, ...


%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 %{upname}-%{version}


%build


%install
%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
%{__python} setup.py test
%if %{with python3}
%{__python3} setup.py test
%endif


%files
%{_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

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.200.3-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.200.3-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Tue Feb 19 2013 Michael Schwendt <mschwendt@fedoraproject.org> - 3.200.3-4
- Merge "remove-newlines" (from alt tags) patch (Debian #299027).
- Include html2text script as python-html2script.
- Minor spec cleanup.

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.200.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.200.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Fri Jan 13 2012 Michael Schwendt <mschwendt@fedoraproject.org> - 3.200.3-1
- TODO: decide on the new /usr/bin/html2text this one wants to install
- update to 3.200.3

* Tue Apr 12 2011 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 3.02-2
- add disttag

* Mon Apr 11 2011 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 3.02-1
- update to 3.02
- download tarball from github
- use setuptools

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.38-3.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 2.38-2.1
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild

* Sun Jul 04 2010 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 2.38-1
- update to 2.38

* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.35-3.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.35-2.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Sat Dec 13 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 2.35-1
- update to 2.35

* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 2.34-2.1
- Rebuild for Python 2.6

* Sat Oct 11 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 2.34-1
- update to 2.34

* Sat Sep 27 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 2.33-1
- update to 2.33

* Fri Aug 01 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 2.32-1
- update to 2.32

* Sun Jul 27 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 2.31-1
- update to 2.31

* Fri Jul 04 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 2.30-1
- update to 2.30 (GPLv3 now)

* Fri Nov 02 2007 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 2.29-1
- update to 2.29

* Thu Oct 04 2007 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 2.28-1
- update to 2.28 (just one line actually different)

* Thu Oct 04 2007 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 2.26-3
- BR python (fixes #317211)

* Fri Aug 03 2007 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info>
- Update License field due to the "Licensing guidelines changes"

* Sat Mar 24 2007 Thorsten Leemhuis <fedora[AT]leemhuis.info> - 2.26-2
- Use sed instead of dos2unix

* Sat Mar 24 2007 Thorsten Leemhuis <fedora[AT]leemhuis.info> - 2.26-1
- Initial package