Skip to content

Commit

Permalink
src/sage/features/info.py: new feature for GNU Info
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
orlitzky committed Nov 1, 2024
1 parent 1b3f398 commit 5bc7b70
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/sage/features/info.py
Original file line number Diff line number Diff line change
@@ -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 <spkg_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()]

0 comments on commit 5bc7b70

Please sign in to comment.