diff --git a/.gitignore b/.gitignore index 4bad3b0..1c05d99 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ html2text-2.38.py /python-html2text-3.02.tar.gz /aaronsw-html2text-3.02-77-gc368b14.tar.gz +/html2text-2015.6.6.tar.gz diff --git a/aaronsw-html2text-remove-newlines.patch b/aaronsw-html2text-remove-newlines.patch deleted file mode 100644 index 54f8b85..0000000 --- a/aaronsw-html2text-remove-newlines.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -Nur aaronsw-html2text-c368b14-orig/html2text.py aaronsw-html2text-c368b14/html2text.py ---- aaronsw-html2text-c368b14-orig/html2text.py 2012-01-07 16:01:09.000000000 +0100 -+++ aaronsw-html2text-c368b14/html2text.py 2013-02-19 11:53:09.609134393 +0100 -@@ -479,6 +479,7 @@ - if has_key(attrs, 'src'): - attrs['href'] = attrs['src'] - alt = attrs.get('alt', '') -+ alt = re.sub('\n', ' ', alt) - if self.inline_links: - self.o("![") - self.o(alt) diff --git a/python-html2text.spec b/python-html2text.spec index 41c9577..d134c52 100644 --- a/python-html2text.spec +++ b/python-html2text.spec @@ -1,27 +1,35 @@ -%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} - -%global tardirname aaronsw-html2text-c368b14 - -Name: python-html2text -Version: 3.200.3 -Release: 7%{?dist} +%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://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 - 2015.6.6-1 +- Upgrade to the latest upstream (RHBZ #1229552) + * Mon Jun 30 2014 Toshio Kuratomi - 3.200.3-7 - Replace python-setuptools-devel BR with python-setuptools diff --git a/sources b/sources index 7c8eba3..43cdffc 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -5aab989207988e8ec1ebbf43ed1d84a4 aaronsw-html2text-3.02-77-gc368b14.tar.gz +c03ae2481d7abddb01c14bbee4c1e85f html2text-2015.6.6.tar.gz