Fix compilation errors due to python-termcolor update to 2.3.0

This commit is contained in:
starlet-dx 2023-05-05 15:57:47 +08:00
parent 4d8c47cf6a
commit 9a32fb9564
2 changed files with 43 additions and 2 deletions

View File

@ -0,0 +1,37 @@
From b391bcaf11f142135f549c1a69fd0c1560f3cff3 Mon Sep 17 00:00:00 2001
From: Matthew Peveler <matt.peveler@gmail.com>
Date: Tue, 27 Dec 2022 09:48:42 -0500
Subject: [PATCH] Fix forcing color through termcolor (#204)
---
tests/test_tldr.py | 3 ++-
tldr.py | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/tests/test_tldr.py b/tests/test_tldr.py
index 0ed0dd1..b49c3ed 100644
--- a/tests/test_tldr.py
+++ b/tests/test_tldr.py
@@ -12,7 +12,8 @@
@pytest.mark.parametrize("page_name", page_names)
-def test_whole_page(page_name):
+def test_whole_page(page_name, monkeypatch):
+ monkeypatch.setenv("FORCE_COLOR", "1")
with open(f"tests/data/{page_name}.md", "rb") as f_original:
with open(f"tests/data/{page_name}_rendered", "rb") as f_rendered:
old_stdout = sys.stdout
diff --git a/tldr.py b/tldr.py
index 7e96807..1ac6c39 100755
--- a/tldr.py
+++ b/tldr.py
@@ -493,6 +493,8 @@ def main() -> None:
options = parser.parse_args()
colorama.init(strip=options.color)
+ if options.color is False:
+ os.environ["FORCE_COLOR"] = "true"
if options.update_cache:
update_cache(language=options.language)

View File

@ -1,11 +1,12 @@
Name: tldr
Version: 3.1.0
Release: 1
Release: 2
Summary: Simplified and community-driven man pages
License: MIT
URL: https://github.com/tldr-pages/tldr-python-client
Source0: https://github.com/tldr-pages/tldr-python-client/archive/%{version}/%{name}-%{version}.tar.gz
Patch0: Fix-forcing-color-through-termcolor.patch
BuildArch: noarch
BuildRequires: python3-colorama
@ -32,7 +33,7 @@ A Python command line client for tldr - Simplified and community-driven
man pages http://tldr-pages.github.io/.
%prep
%autosetup -n %{name}-python-client-%{version}
%autosetup -n %{name}-python-client-%{version} -p1
# Remove bundled egg-info
rm -rf %{name}.egg-info
@ -58,6 +59,9 @@ pytest -k "not test_error_message"
%{python3_sitelib}/%{name}-%{version}-py%{python3_version}.egg-info
%changelog
* Fri May 05 2023 yaoxin <yao_xin001@hoperun.com> - 3.1.0-2
- Fix compilation errors due to python-termcolor update to 2.3.0
* Fri Apr 21 2023 wulei <wu_lei@hoperun.com> - 3.1.0-1
- Upgrade package to version 3.1.0