From 83dd05a3355f1c46499454180152a7c1d2734f0e Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 13 Sep 2024 17:55:53 -0400 Subject: [PATCH] src/sage/features/giac.py: add new feature for the giac program In preparation for adding a --disable-giac option, we add a new feature that detects the presence of the "giac" executable. We already have a feature for sage.libs.giac, but that only guards the libgiac interface; we still have code that runs "giac" behind pexpect. This will allow us to skip those tests when giac is not installed. --- src/sage/features/giac.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/sage/features/giac.py diff --git a/src/sage/features/giac.py b/src/sage/features/giac.py new file mode 100644 index 00000000000..6f9fe2ccfba --- /dev/null +++ b/src/sage/features/giac.py @@ -0,0 +1,30 @@ +# sage_setup: distribution = sagemath-environment +r""" +Feature for testing the presence of ``giac`` +""" + +from . import Executable, FeatureTestResult + +class Giac(Executable): + r""" + A :class:`~sage.features.Feature` describing the presence of :ref:`giac `. + + EXAMPLES:: + + sage: from sage.features.giac import Giac + sage: Giac().is_present() # needs giac + FeatureTestResult('giac', True) + """ + def __init__(self): + r""" + TESTS:: + + sage: from sage.features.giac import Giac + sage: isinstance(Giac(), Giac) + True + """ + Executable.__init__(self, 'giac', executable='giac', + spkg='giac', type='standard') + +def all_features(): + return [Giac()]