From 0211b0e9f75e0c672e8aea79c0a5beca0a1c42a2446bc7f5deb22fa9241acdb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=C3=A9ta=20Machov=C3=A1?= Date: Mon, 16 Jun 2025 12:21:10 +0000 Subject: [PATCH 1/2] - Convert to libalternatives OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-ansi2html?expand=0&rev=18 --- .gitattributes | 23 +++++++ .gitignore | 1 + python-ansi2html.changes | 126 +++++++++++++++++++++++++++++++++++++++ python-ansi2html.spec | 75 +++++++++++++++++++++++ v1.9.2.tar.gz | 3 + 5 files changed, 228 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 python-ansi2html.changes create mode 100644 python-ansi2html.spec create mode 100644 v1.9.2.tar.gz diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/python-ansi2html.changes b/python-ansi2html.changes new file mode 100644 index 0000000..49e0779 --- /dev/null +++ b/python-ansi2html.changes @@ -0,0 +1,126 @@ +------------------------------------------------------------------- +Mon Jun 16 12:20:51 UTC 2025 - Markéta Machová + +- Convert to libalternatives + +------------------------------------------------------------------- +Sun Jun 23 07:43:43 UTC 2024 - Johannes Kastl + +- update to 1.9.2: + * github.com/psf/black.git: 24.1.1 → 24.4.2 + + * github.com/pre-commit/pre-commit-hooks.git: v4.5.0 → v4.6.0 + + * github.com/pycqa/pylint: v3.0.3 → v3.2.2 + + * github.com/pre-commit/mirrors-mypy: v1.8.0 → v1.10.0 + + +------------------------------------------------------------------- +Wed Dec 13 08:54:07 UTC 2023 - Johannes Kastl + +- update to 1.9.1 (skipping non-existent release 1.9.0): + * Bugfixes + - Enable testing with py312 (#230) @ssbarnea + - Fix project description (#229) @ssbarnea + - Fix RTD builds (#228) @ssbarnea + - tests/test_ansi2html.py: use sys.executable instead of + hardcoded python3 (#214) @johanneskastl + - Replace optparse with argparse (#205) @ssbarnea + - Replace sphinx with mkdocs (#204) @ssbarnea +- remove patch + 0001-tests-test_ansi2html.py-use-sys.executable-instead-o.patch +- change upstream to pycontribs/ansi2html + +------------------------------------------------------------------- +Tue May 9 12:02:38 UTC 2023 - Johannes Kastl + +- add patch + 0001-tests-test_ansi2html.py-use-sys.executable-instead-o.patch + to replace a hardcoded 'python3' in a test (which leads to errors + on SLES15 with python3.11) + https://github.com/pycontribs/ansi2html/issues/210 + +------------------------------------------------------------------- +Tue May 9 11:20:43 UTC 2023 - Johannes Kastl + +- add sle15_python_module_pythons + +------------------------------------------------------------------- +Thu Aug 4 08:46:29 UTC 2022 - Otto Hollmann + +- Update to 1.8.0: + * Fix for ANSI color codes that include blank values (#178) + * style.py: Drop unused CSS class .bold (#161) + * Added py.typed file (#176) + * style.py: Get CSS class .inv_foreground in sync with .body_foreground (#160) + * Fix --input-encoding= regression added in PR #143 + related tests (alternative to PR #162) (#172) + * Migrate from mock to unittest.mock of Python >=3.3 (fixes #169) (#171) + * Add ability to also recognize colons in ANSI escapes (#167) + * Fixes to respect bright colors in palette (#126) + * CHANGELOG.rst: Fix misleading 1.6.0 entry and missing 1.7.0 entries (#159) + * Add comments to reduce reader research time (#158) + +------------------------------------------------------------------- +Wed Apr 27 11:41:26 UTC 2022 - pgajdos@suse.com + +- version update to 1.7.0 + 1.7.0 + ----- + Minor Changes + ^^^^^^^^^^^^^ + * Replace recommendation of using system packages with pip3 @ssbarnea + * Add truecolor support @miltolstoy + * Generate documentation with Sphinx and use Read the Docs @tristanlatr + * Adds support for OSC hyperlink sequences. @hakonhagland + Bugfixes + ^^^^^^^^ + * Add test coverage @ziegenberg + * Replace pkg_resources with importlib.metadata @ziegenberg + * fix including of CHANGELOG.rst @ziegenberg + * Update linting dependencies @ziegenberg + * Upgrade the build process @ziegenberg + * Add type hinting @ziegenberg + * Update CI badges in readme @ssbarnea + * Bump setuptools-scm version @ssbarnea + 1.6.0 + ----- + Changes + ^^^^^^^ + * Switching from nosetest to unittest @paolostivanin + * Add dracula colorscheme @ahmubashshir + * Refactor packaging by replacing old setup.py based packaging with modern pep517 based one + * Replace travis with github actions @ssbarnea + Bugfixes + ^^^^^^^^ + * Correct author metadata @ssbarnea + Deprecations + ^^^^^^^^^^^^ + * Officialy retire support for python <= 3.6 @ssbarnea +- deleted patches + - remove_nose.patch (upstreamed) + +------------------------------------------------------------------- +Thu Mar 26 07:34:53 UTC 2020 - Paolo Stivanin + +- Add remove_nose.patch + +------------------------------------------------------------------- +Fri Feb 15 14:23:43 UTC 2019 - Jan Engelhardt + +- Use noun phrase in descriptions. + +------------------------------------------------------------------- +Thu Feb 14 13:31:49 UTC 2019 - Tomáš Chvátal + +- Update to 1.5.2 release: + * Many various drawing fixes + * Css parsing improvements +- Sort out with spec-cleaner +- Enable tests + +------------------------------------------------------------------- +Tue Oct 24 15:13:53 UTC 2017 - rolf@rotkraut.de + +- Initial version + diff --git a/python-ansi2html.spec b/python-ansi2html.spec new file mode 100644 index 0000000..d2cb8eb --- /dev/null +++ b/python-ansi2html.spec @@ -0,0 +1,75 @@ +# +# spec file for package python-ansi2html +# +# Copyright (c) 2025 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%bcond_without libalternatives +%{?sle15_python_module_pythons} +Name: python-ansi2html +Version: 1.9.2 +Release: 0 +Summary: Python module to convert text with ANSI color codes to HTML or LaTeX +License: LGPL-3.0-or-later +Group: Development/Languages/Python +URL: https://github.com/pycontribs/ansi2html/ +Source: https://github.com/pycontribs/ansi2html/archive/v%{version}.tar.gz +BuildRequires: %{python_module pip} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: alts +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: alts +BuildArch: noarch +%python_subpackages + +%description +Convert text with ANSI color codes to HTML or to LaTeX. + +Inspired by and developed off of the work of pixelbeat and blackjack. + +Read the [docs](https://ansi2html.readthedocs.io/) for more informations. + +%prep +%setup -q -n ansi2html-%{version} + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} +%python_clone -a %{buildroot}%{_bindir}/ansi2html + +%check +# https://github.com/pycontribs/ansi2html/issues/169 +sed -i 's:from mock:from unittest.mock:' tests/test_ansi2html.py +# ansi2html not available (update alternatives); solvable +# but it runs just ansi2html --version +%pytest -k 'not test_command_script' + +%pre +%python_libalternatives_reset_alternative ansi2html + +%files %{python_files} +%license LICENSE +%doc README.md +%python_alternative %{_bindir}/ansi2html +%{python_sitelib}/ansi2html/ +%{python_sitelib}/ansi2html-*.dist-info/ + +%changelog diff --git a/v1.9.2.tar.gz b/v1.9.2.tar.gz new file mode 100644 index 0000000..96b202b --- /dev/null +++ b/v1.9.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d4a12e0d0ed06af467882bcc24fad34ddcf7d4d61f237125ce7713f7f1341c3f +size 40333 From 1ae0d685b3fa4cca72aa4fb90347406bed4ddaa4b812c71e34c0725aa7332ce9 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Tue, 17 Jun 2025 20:31:23 +0000 Subject: [PATCH 2/2] - Add opensuse-test.patch making the tests work even with versioned executables in the testing environment (i.e., before the alts scriptlets kick in). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-ansi2html?expand=0&rev=19 --- opensuse-test.patch | 34 ++++++++++++++++++++++++++++++++++ python-ansi2html.changes | 7 +++++++ python-ansi2html.spec | 10 ++++++++-- 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 opensuse-test.patch diff --git a/opensuse-test.patch b/opensuse-test.patch new file mode 100644 index 0000000..429fd58 --- /dev/null +++ b/opensuse-test.patch @@ -0,0 +1,34 @@ +--- + tests/test_ansi2html.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +Index: ansi2html-1.9.2/tests/test_ansi2html.py +=================================================================== +--- ansi2html-1.9.2.orig/tests/test_ansi2html.py 2024-06-22 19:22:24.000000000 +0200 ++++ ansi2html-1.9.2/tests/test_ansi2html.py 2025-06-17 22:27:11.354092953 +0200 +@@ -50,6 +50,7 @@ + + class TestAnsi2HTML: + maxDiff = None ++ cmd_exe = "ansi2html-" + '.'.join([str(x) for x in sys.version_info[:2]]) + + def test_linkify(self) -> None: + ansi = "http://threebean.org#foobar" +@@ -465,7 +466,7 @@ + assert target in html + + def test_command_script(self) -> None: +- result = run(["ansi2html", "--version"], check=True) ++ result = run([self.cmd_exe, "--version"], check=True) + assert result.returncode == 0 + + def test_command_input_output_encoding(self) -> None: +@@ -480,7 +481,7 @@ + + with Popen( + [ +- "ansi2html", ++ self.cmd_exe, + "--inline", + f"--input-encoding={input_encoding}", + f"--output-encoding={output_encoding}", diff --git a/python-ansi2html.changes b/python-ansi2html.changes index 49e0779..e2176a8 100644 --- a/python-ansi2html.changes +++ b/python-ansi2html.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Jun 17 20:29:28 UTC 2025 - Matej Cepl + +- Add opensuse-test.patch making the tests work even with + versioned executables in the testing environment (i.e., before + the alts scriptlets kick in). + ------------------------------------------------------------------- Mon Jun 16 12:20:51 UTC 2025 - Markéta Machová diff --git a/python-ansi2html.spec b/python-ansi2html.spec index d2cb8eb..10a54ac 100644 --- a/python-ansi2html.spec +++ b/python-ansi2html.spec @@ -26,6 +26,11 @@ License: LGPL-3.0-or-later Group: Development/Languages/Python URL: https://github.com/pycontribs/ansi2html/ Source: https://github.com/pycontribs/ansi2html/archive/v%{version}.tar.gz +# PATCH-FIX-OPENSUSE opensuse-test.patch bsc#[0-9]+ mcepl@suse.com +# Make tests work with versioned executables before alts kick in +# If any other test fails, because the executable is not +# "ansi2html", replace it with self.cmd_exe +Patch0: opensuse-test.patch BuildRequires: %{python_module pip} BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} @@ -45,7 +50,7 @@ Inspired by and developed off of the work of pixelbeat and blackjack. Read the [docs](https://ansi2html.readthedocs.io/) for more informations. %prep -%setup -q -n ansi2html-%{version} +%autosetup -p1 -n ansi2html-%{version} %build %pyproject_wheel @@ -58,9 +63,10 @@ Read the [docs](https://ansi2html.readthedocs.io/) for more informations. %check # https://github.com/pycontribs/ansi2html/issues/169 sed -i 's:from mock:from unittest.mock:' tests/test_ansi2html.py +export PATH=$PATH:%{buildroot}%{_bindir} # ansi2html not available (update alternatives); solvable # but it runs just ansi2html --version -%pytest -k 'not test_command_script' +%pytest %pre %python_libalternatives_reset_alternative ansi2html