From 5bc7b704f53130aa9c06f1d664f32940f7312956 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 31 Oct 2024 22:24:09 -0400 Subject: [PATCH] src/sage/features/info.py: new feature for GNU Info Before we can replace our hand-rolled parser for Singular's info file, we need to be able to detect the "info" program from the GNU Info package. The goal is to politely disable access to Singular's info if GNU Info is unavailable. This avoids a hard dependency on GNU Info in the sage library. --- src/sage/features/info.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/sage/features/info.py diff --git a/src/sage/features/info.py b/src/sage/features/info.py new file mode 100644 index 00000000000..fd3ad17e22a --- /dev/null +++ b/src/sage/features/info.py @@ -0,0 +1,31 @@ +# sage_setup: distribution = sagemath-environment +r""" +Feature for testing the presence of ``info``, from GNU Info +""" + +from . import Executable + +class Info(Executable): + r""" + A :class:`~sage.features.Feature` describing the presence of :ref:`info `. + + EXAMPLES:: + + sage: from sage.features.info import Info + sage: Info().is_present() # needs info + FeatureTestResult('info', True) + + """ + def __init__(self): + r""" + TESTS:: + + sage: from sage.features.info import Info + sage: isinstance(Info(), Info) + True + """ + Executable.__init__(self, 'info', executable='info', + spkg='info', type='standard') + +def all_features(): + return [Info()]