From e34b854b7faeb222309bf241951e30c6b1b0eaf1 Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Dec 06 2021 19:52:19 +0000 Subject: Update to 1.6.0. Fixes rhbz#1888556. Implement new Fedora Python Packaging Guidelines. Fix licensing Replace mock with unittests.mock and use tox. Use %{srcname} globally Move to new upstream Signed-off-by: Maxwell G --- diff --git a/.gitignore b/.gitignore index 014f96b..9028428 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ tests/artifacts *.retry /ansi2html-1.5.1.tar.gz +/ansi2html-1.6.0.tar.gz +/ansi2html-1.6.0 diff --git a/0000-replace-mock.patch b/0000-replace-mock.patch new file mode 100644 index 0000000..a8a35c3 --- /dev/null +++ b/0000-replace-mock.patch @@ -0,0 +1,22 @@ +--- a/tests/test_ansi2html.py ++++ b/tests/test_ansi2html.py +@@ -27,7 +27,7 @@ from io import StringIO + from os.path import abspath, dirname, join + from subprocess import run + +-from mock import patch ++from unittest.mock import patch + + from ansi2html import Ansi2HTMLConverter + from ansi2html.converter import ( +--- a/tox.ini ++++ b/tox.ini +@@ -10,8 +10,6 @@ setenv = + PYTHONWARNINGS=error::FutureWarning + # Aim to replace with below once other issues are fixed: + # PYTHONWARNINGS=error +-deps = +- mock + sitepackages = False + commands = + python -m unittest tests/test_ansi2html.py diff --git a/python-ansi2html.spec b/python-ansi2html.spec index 4a77eb9..860c72f 100644 --- a/python-ansi2html.spec +++ b/python-ansi2html.spec @@ -1,62 +1,80 @@ +# Run tests by default +%bcond_without tests + %global srcname ansi2html -Name: python-ansi2html -Version: 1.5.1 -Release: 13%{?dist} +Name: python-%{srcname} +Version: 1.6.0 +Release: 1%{?dist} Summary: Python module that converts text with ANSI color to HTML - -License: GPLv3+ -URL: http://github.com/ralphbean/ansi2html -Source0: https://pypi.io/packages/source/a/ansi2html/ansi2html-%{version}.tar.gz +# While the project was previously licensed as GPLv3+, it is now LGPLv3. +# See https://github.com/pycontribs/ansi2html/issues/72 for more info. +# In this issue, all of the previous contributors agreed to relicense their code. +# However, the project never removed the GPLv3+ headers from some of the files. +License: LGPLv3 +URL: http://github.com/pycontribs/%{srcname} +Source0: %{pypi_source} +# See https://fedoraproject.org/wiki/Changes/DeprecatePythonMock for more info. +Patch0: 0000-replace-mock.patch BuildArch: noarch BuildRequires: python3-devel -BuildRequires: python3-setuptools -BuildRequires: python3-nose -BuildRequires: python3-mock -BuildRequires: python3-six - -%global _description\ -The ansi2html module can convert text with ANSI color codes to HTML. +# Needed for building manpages +BuildRequires: /usr/bin/make +BuildRequires: /usr/bin/a2x -%description %_description +%global _description %{expand: +The ansi2html module can convert text with ANSI color codes to HTML.} -%package -n python3-ansi2html -Summary: %summary -%{?python_provide:%python_provide python3-ansi2html} +%description %{_description} -Requires: python3 -Requires: python3-setuptools -Requires: python3-six +%package -n python3-%{srcname} +Summary: %{summary} -%description -n python3-ansi2html %_description +%description -n python3-%{srcname} %_description %prep -%setup -q -n %{srcname}-%{version} +%autosetup -n %{srcname}-%{version} -p1 -# Remove bundled egg-info just in case it is included. -rm -rf *.egg* +%generate_buildrequires +# The -t is set if %%{with_tests} is true +%pyproject_buildrequires %{?with_tests:-t} %build -%py3_build +# Build manpages +make man/ansi2html.1 + +# Build wheel +%pyproject_wheel %install -mkdir -p %{buildroot}%{_mandir}/man1/ -mv man/ansi2html.1 %{buildroot}%{_mandir}/man1/ansi2html.1 -%py3_install +%pyproject_install +%pyproject_save_files %{srcname} + +# Install manpage +install -Dpm 644 man/%{srcname}.1 %{buildroot}%{_mandir}/man1/%{srcname}.1 %check -PYTHONPATH=. nosetests-%{python3_version} tests/*.py +%if %{with tests} +%tox +%endif -%files -n python3-ansi2html -%doc LICENSE README.rst -%{python3_sitelib}/ansi2html -%{python3_sitelib}/ansi2html-%{version}-* -%{_bindir}/ansi2html -%{_mandir}/man1/ansi2html.1.gz +%files -n python3-%{srcname} -f %{pyproject_files} +%doc README.rst +%license LICENSE +%{_bindir}/%{srcname} +%{_mandir}/man1/%{srcname}.1* %changelog +* Wed Nov 17 2021 Maxwell G - 1.6.0-1 +- Update to 1.6.0. Fixes rhbz#1888556. +- Implement new Fedora Python Packaging Guidelines. +- Fix licensing +- Replace mock with unittests.mock and use tox. +- Use %%{srcname} globally +- Move to new upstream + * Fri Jul 23 2021 Fedora Release Engineering - 1.5.1-13 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild diff --git a/sources b/sources index 1e29f12..6ef9f59 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ansi2html-1.5.1.tar.gz) = 5be71b5cbdc40dafaa0e1af9877561b84f546bab7889ca7368148a0fb583abb05b274fc3ebdb8975ab63850b772c1a9e736d9cfacf36f3a9eb95fe7f7c525cb5 +SHA512 (ansi2html-1.6.0.tar.gz) = 35e5fb6cee96fe41a658c005734a58b08bc05e8ad5903ad18684c316bdad351a70c534b4162416225bc2ca774d01b4ac1bb8a8dad3170d0738aa7b3daf46b3c0