15
0

- Remove dependency on unittetst2

Added remove_unittest2.patch to facilitate that

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-html2text?expand=0&rev=25
This commit is contained in:
2018-08-13 08:39:20 +00:00
committed by Git OBS Bridge
parent 1910c611c5
commit ae2dd37aa0
3 changed files with 100 additions and 27 deletions

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-html2text
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,27 +16,26 @@
#
%bcond_without tests
#
%define upname html2text
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-html2text
%bcond_without tests
Name: python-%{upname}
Version: 2016.9.19
Release: 0
Url: https://github.com/Alir3z4/html2text/
Summary: Turn HTML into equivalent Markdown-structured text
License: GPL-3.0
License: GPL-3.0-only
Group: Development/Languages/Python
Source: https://files.pythonhosted.org/packages/source/h/html2text/html2text-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: fdupes
BuildRequires: python-rpm-macros
URL: https://github.com/Alir3z4/html2text/
Source: https://files.pythonhosted.org/packages/source/h/%{upname}/%{upname}-%{version}.tar.gz
Patch0: remove_unittest2.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
%if %{with tests}
BuildRequires: python2-unittest2
%endif
Requires(post): update-alternatives
Requires(preun): update-alternatives
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires(post): update-alternatives
Requires(preun): update-alternatives
BuildArch: noarch
%python_subpackages
@@ -46,9 +45,10 @@ easy-to-read plain ASCII text. Better yet, that ASCII also happens to
be valid Markdown (a text-to-HTML format).
%prep
%setup -q -n html2text-%{version}
%setup -q -n %{upname}-%{version}
%patch0 -p1
# remove useless shebang
sed -i '/^#!/d' html2text/__init__.py
sed -i '/^#!/d' %{upname}/__init__.py
%build
%python_build
@@ -58,15 +58,18 @@ sed -i '/^#!/d' html2text/__init__.py
%python_expand %fdupes %{buildroot}%{$python_sitelib}
# To avoid conflicts with the rst2html5 package
mv %{buildroot}%{_bindir}/html2text %{buildroot}%{_bindir}/html2text-python
ln -s -f %{_sysconfdir}/alternatives/html2text %{buildroot}%{_bindir}/html2text
mv %{buildroot}%{_bindir}/%{upname} %{buildroot}%{_bindir}/%{upname}-python
ln -s -f %{_sysconfdir}/alternatives/%{upname} %{buildroot}%{_bindir}/%{upname}
# remove executable bits from egg files
%python_expand chmod -x %{buildroot}%{$python_sitelib}/%{upname}-*.egg-info/*
%post
update-alternatives --install %{_bindir}/html2text html2text %{_bindir}/html2text-python 15
update-alternatives --install %{_bindir}/%{upname} %{upname} %{_bindir}/%{upname}-python 15
%preun
if [ ! -f %{_bindir}/html2text-python ] ; then
update-alternatives --remove html2text %{_bindir}/html2text-python
if [ ! -f %{_bindir}/%{upname}-python ] ; then
update-alternatives --remove %{upname} %{_bindir}/%{upname}-python
fi
%if %{with tests}
@@ -74,12 +77,12 @@ fi
%python_exec setup.py test
%endif
%files %python_files
%defattr(-,root,root,-)
%doc COPYING README.md AUTHORS.rst ChangeLog.rst
%python3_only %{_bindir}/html2text
%python3_only %{_bindir}/html2text-python
%python3_only %ghost %{_sysconfdir}/alternatives/html2text
%files %{python_files}
%license COPYING
%doc README.md AUTHORS.rst ChangeLog.rst
%python3_only %{_bindir}/%{upname}
%python3_only %{_bindir}/%{upname}-python
%python3_only %ghost %{_sysconfdir}/alternatives/%{upname}
%{python_sitelib}/*
%changelog