Remove epydoc imports and epydoc calls

(cherry picked from commit b36b5ce04a29f3f19f01a25feee1f2d4add4a66d)
This commit is contained in:
wang--ge 2023-11-28 11:25:38 +08:00 committed by openeuler-sync-bot
parent bfbad15695
commit 9c71304d67
2 changed files with 84 additions and 1 deletions

View File

@ -0,0 +1,79 @@
From 2c2d91e430fe841ee0afe8deaec318b74d756cee Mon Sep 17 00:00:00 2001
From: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
Date: Sun, 28 Jul 2019 18:19:59 +0200
Subject: [PATCH] Remove epydoc imports and epydoc calls
Epydoc is no longer maintained and only supported for Python 2 whereas
most distributions package targetcli-fb for Python 3 (RHEL, Fedora,
Debian). As a consequence, the help messages for configshell commands
are not rendered with Epydoc on most systems and it is probably safe
to remove the Epydoc dependency entirely.
For more information, see:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=881554
Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
---
configshell/console.py | 31 +++++++++----------------------
1 file changed, 9 insertions(+), 22 deletions(-)
diff --git a/configshell/console.py b/configshell/console.py
index 8ed6b50..80e723c 100644
--- a/configshell/console.py
+++ b/configshell/console.py
@@ -26,12 +26,6 @@ import tty
from .prefs import Prefs
-# avoid requiring epydoc at runtime
-try:
- import epydoc.markup.epytext
-except ImportError:
- pass
-
class Console(object):
'''
Implements various utility methods providing a console UI support toolkit,
@@ -166,19 +160,12 @@ class Console(object):
Renders and print and epytext-formatted text on the console.
'''
text = self.dedent(text)
- try:
- dom_tree = epydoc.markup.epytext.parse(text, None)
- except NameError:
- # epydoc not installed, strip markup
- dom_tree = text
- dom_tree = dom_tree.replace("B{", "")
- dom_tree = dom_tree.replace("I{", "")
- dom_tree = dom_tree.replace("C{", "")
- dom_tree = dom_tree.replace("}", "")
- dom_tree += "\n"
- except:
- self.display(text)
- raise
+ dom_tree = text
+ dom_tree = dom_tree.replace("B{", "")
+ dom_tree = dom_tree.replace("I{", "")
+ dom_tree = dom_tree.replace("C{", "")
+ dom_tree = dom_tree.replace("}", "")
+ dom_tree += "\n"
text = self.render_domtree(dom_tree)
# We need to remove the last line feed, but there might be
# escape characters after it...
@@ -412,9 +399,9 @@ class Console(object):
text = self.render_text(
childstr, styles=['underline'], todefault=True)
elif tree.tag == 'symbol':
- text = '%s' \
- % epydoc.markup.epytext.SYMBOL_TO_PLAINTEXT.get(
- childstr, childstr)
+ # Should not occur because this module does not have
+ # docstrings with symbols (e.g. S{alpha}).
+ raise NotImplementedError
elif tree.tag == 'graph':
text = '<<%s graph: %s>>' \
% (variables[0], ', '.join(variables[1:]))
--
2.42.0.windows.2

View File

@ -4,13 +4,14 @@
Name: python-configshell
Summary: Python library that provides a framework for building simple but nice CLI-based applications.
Version: 1.1.27
Release: 5
Release: 6
License: ASL 2.0
URL: https://github.com/open-iscsi/configshell-fb
Source0: https://github.com/open-iscsi/configshell-fb/archive/v1.1.27.tar.gz
BuildArch: noarch
Patch01: 0001-Ensure-that-all-output-reaches-the-client-when-daemo.patch
Patch02: 0002-Remove-epydoc-imports-and-epydoc-calls.patch
%global _description\
%{name} is a Python library that provides a framework for building simple but nice CLI-based applications.\
@ -49,6 +50,9 @@ popd
%doc README.md
%changelog
* Tue Nov 28 2023 liubo <liubo1@xfusion.com> - 1.1.27-6
- Remove epydoc imports and epydoc calls
* Wed Nov 1 2023 liubo <liubo1@xfusion.com> - 1.1.27-5
- Repair log message