Blob Blame History Raw
%{!?__python2: %global __python2 %{__python}}
%{!?python2_sitelib: %global python2_sitelib %{python_sitelib}}
%{!?python2_sitearch: %global python2_sitearch %{python_sitearch}}
%{!?python2_version: %global python2_version %{python_version}}

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

%global upname html2text
%global common_sum Convert HTML to Markdown-formatted text
%global common_desc %{upname} 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).


Name:           python-%{upname}
Version:        2016.9.19
Release:        1%{?dist}
Summary:        %{common_sum}

License:        GPLv3
URL:            http://alir3z4.github.io/%{upname}
Source0:        https://files.pythonhosted.org/packages/source/h/%{upname}/%{upname}-%{version}.tar.gz

BuildArch:      noarch

BuildRequires:  help2man

%description
%{common_desc}


%package -n python2-%{upname}
Summary:        %{common_sum}

BuildRequires:  python-devel
BuildRequires:  python-setuptools

%{?python_provide:%python_provide python2-%{upname}}

%if !%{with python3}
Provides:       %{upname} = %{version}-%{release}
Obsoletes:      %{upname} <= 1.3.2a-16
%endif
%description -n python2-%{upname}
%{common_desc}


%if %{with python3}
%package -n python3-%{upname}
Summary:        %{common_sum}

BuildRequires:  python3-devel
BuildRequires:  python3-setuptools

%{?python_provide:%python_provide python3-%{upname}}

Provides:       %{upname} = %{version}-%{release}
Obsoletes:      %{upname} <= 1.3.2a-16

%description -n python3-%{upname}
%{common_desc}
%endif # with_python3


%prep
%autosetup -n %{upname}-%{version}
%{__rm} -fr *.egg-info


%build
%py2_build
%if %{with python3}
%py3_build
%endif


%install
%{__mkdir} -p %{buildroot}%{_mandir}/man1
%py2_install
export PYTHONPATH="%{buildroot}%{python2_sitelib}"
%{__mv} -f %{buildroot}%{_bindir}/%{upname} %{buildroot}%{_bindir}/%{upname}-%{python2_version}
%{_bindir}/help2man -s 1 -N -o %{buildroot}%{_mandir}/man1/%{upname}-%{python2_version}.1 %{buildroot}%{_bindir}/%{upname}-%{python2_version}
/bin/echo '%{_bindir}/%{upname}-%{python2_version}' > py2.mf
/bin/echo '%{_mandir}/man1/%{upname}-%{python2_version}.1*' >> py2.mf
for f in $(%{_bindir}/find %{buildroot}%{python2_sitelib} -name '*.py' -type f); do
  %{__sed} -e'/^#!.*/d' < ${f} > ${f}.new
  /bin/touch -r ${f} ${f}.new
  %{__mv} -f ${f}.new ${f}
done
%{_bindir}/find %{buildroot}%{python2_sitelib} -type f | %{_bindir}/xargs %{__chmod} -c 0644
%if %{with python3}
export PYTHONPATH="%{buildroot}%{python3_sitelib}"
%py3_install
%{__mv} -f %{buildroot}%{_bindir}/%{upname} %{buildroot}%{_bindir}/%{upname}-%{python3_version}
/bin/ln -f %{buildroot}%{_bindir}/%{upname}-%{python3_version} %{buildroot}%{_bindir}/%{upname}
/bin/ln -f %{buildroot}%{_bindir}/%{upname}-%{python3_version} %{buildroot}%{_bindir}/%{name}
%{_bindir}/help2man -s 1 -N -o %{buildroot}%{_mandir}/man1/%{upname}-%{python3_version}.1 %{buildroot}%{_bindir}/%{upname}-%{python3_version}
%{_bindir}/help2man -s 1 -N -o %{buildroot}%{_mandir}/man1/%{upname}.1 %{buildroot}%{_bindir}/%{upname}
%{_bindir}/help2man -s 1 -N -o %{buildroot}%{_mandir}/man1/%{name}.1 %{buildroot}%{_bindir}/%{name}
/bin/echo '%{_bindir}/%{upname}-%{python3_version}' > py3.mf
/bin/echo '%{_mandir}/man1/%{upname}-%{python3_version}.1*' >> py3.mf
/bin/echo '%{_bindir}/%{upname}' >> py3.mf
/bin/echo '%{_mandir}/man1/%{upname}.1*' >> py3.mf
/bin/echo '%{_bindir}/%{name}' >> py3.mf
/bin/echo '%{_mandir}/man1/%{name}.1*' >> py3.mf
for f in $(%{_bindir}/find %{buildroot}%{python3_sitelib} -name '*.py' -type f); do
  %{__sed} -e'/^#!.*/d' < ${f} > ${f}.new
  /bin/touch -r ${f} ${f}.new
  %{__mv} -f ${f}.new ${f}
done
%{_bindir}/find %{buildroot}%{python3_sitelib} -type f | %{_bindir}/xargs %{__chmod} -c 0644
%else
export PYTHONPATH="%{buildroot}%{python2_sitelib}"
/bin/ln -f %{buildroot}%{_bindir}/%{upname}-%{python2_version} %{buildroot}%{_bindir}/%{upname}
/bin/ln -f %{buildroot}%{_bindir}/%{upname}-%{python2_version} %{buildroot}%{_bindir}/%{name}
%{_bindir}/help2man -s 1 -N -o %{buildroot}%{_mandir}/man1/%{upname}.1 %{buildroot}%{_bindir}/%{upname}
%{_bindir}/help2man -s 1 -N -o %{buildroot}%{_mandir}/man1/%{name}.1 %{buildroot}%{_bindir}/%{name}
/bin/echo '%{_bindir}/%{upname}' >> py2.mf
/bin/echo '%{_mandir}/man1/%{upname}.1*' >> py2.mf
/bin/echo '%{_bindir}/%{name}' >> py2.mf
/bin/echo '%{_mandir}/man1/%{name}.1*' >> py2.mf
%endif


%check
%{__python2} setup.py test -vv
%if %{with python3}
%{__python3} setup.py test -vv
%endif


%files -n python2-%{upname} -f py2.mf
%license AUTHORS.* COPYING
%doc README.* ChangeLog.* PKG-INFO
%{python2_sitelib}/%{upname}
%{python2_sitelib}/%{upname}-%{version}-py%{python2_version}.egg-info


%if %{with python3}
%files -n python3-%{upname} -f py3.mf
%license AUTHORS.* COPYING
%doc README.* ChangeLog.* PKG-INFO
%{python3_sitelib}/%{upname}
%{python3_sitelib}/%{upname}-%{version}-py%{python3_version}.egg-info
%endif


%changelog
* Wed Jan 25 2017 Björn Esser <besser82@fedoraproject.org> - 2016.9.19-1
- Update to latest upstream
- Package license and documentation
- Adapt to recent guidelines
- Fix other packaging issues

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 2015.6.6-7
- Rebuild for Python 3.6

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2015.6.6-6
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2015.6.6-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Mon Dec 07 2015 Matěj Cepl <mcepl@redhat.com> - 2015.6.6-4
- Provide/Obsolete html2text package. (#1288748)
- Temporarily switch off tests.

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2015.6.6-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2015.6.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* 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