forked from sagemath/sage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sagemathgh-35838: FriCAS spkg-configure and Feature
As FriCAS is only used as an executable, this is straightforward; quite a number of systems has Fricas 1.3.8, so this is useful, too. The FriCAS pexpect interface now uses the new `Executable` feature to determine the absolute pathname of the fricas executable (unless executed remotely). This is made possible by a simple refactor of the `sage.interfaces.expect.Expect` class: Computing the effective command line is no longer done in `set_server_and_command` (called by `__init__`); it is delayed until an interface is started and needs the command line. - Fixes sagemath#35837 - Fixes sagemath#33575 Dependencies: The changes in `sage.interfaces` outside of `.expect` and `.fricas` are all from the following PR and do not need review. - Depends on sagemath#36656 (merged here) URL: sagemath#35838 Reported by: Dima Pasechnik Reviewer(s): Dima Pasechnik, François Bissey, Matthias Köppe
- Loading branch information
Showing
38 changed files
with
1,685 additions
and
1,367 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fricas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
math/fricas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sci-mathematics/fricas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fricas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
SAGE_SPKG_CONFIGURE( | ||
[fricas], [ | ||
AC_CACHE_CHECK([for FriCAS >= 1.3.8], [ac_cv_path_FRICAS], [ | ||
AC_PATH_PROGS_FEATURE_CHECK([FRICAS], [fricas], [ | ||
fricas_version=`echo ")quit" | $ac_path_FRICAS -nox -noclef | grep Version | tail -1 2>&1 \ | ||
| $SED -n -e 's/.* Version: FriCAS //p'` | ||
AS_IF([test -n "$fricas_version"], [ | ||
AX_COMPARE_VERSION([$fricas_version], [ge], [1.3.8], [ | ||
ac_cv_path_FRICAS="$ac_path_FRICAS" | ||
ac_path_FRICAS_found=: | ||
]) | ||
]) | ||
]) | ||
]) | ||
AS_IF([test -z "$ac_cv_path_FRICAS"], [sage_spkg_install_fricas=yes]) | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
r""" | ||
Features for testing the presence of ``fricas`` | ||
""" | ||
|
||
# ***************************************************************************** | ||
# Copyright (C) 2023 Dima Pasechnik | ||
# | ||
# Distributed under the terms of the GNU General Public License (GPL) | ||
# as published by the Free Software Foundation; either version 2 of | ||
# the License, or (at your option) any later version. | ||
# https://www.gnu.org/licenses/ | ||
# ***************************************************************************** | ||
|
||
import os | ||
import subprocess | ||
from . import Executable, FeatureTestResult | ||
|
||
class FriCAS(Executable): | ||
r""" | ||
A :class:`~sage.features.Feature` which checks for the :ref:`fricas <fricas>` binary. | ||
EXAMPLES:: | ||
sage: from sage.features.fricas import FriCAS | ||
sage: FriCAS().is_present() # optional - fricas | ||
FeatureTestResult('fricas', True) | ||
""" | ||
def __init__(self): | ||
r""" | ||
TESTS:: | ||
sage: from sage.features.fricas import FriCAS | ||
sage: isinstance(FriCAS(), FriCAS) | ||
True | ||
""" | ||
Executable.__init__(self, name="fricas", spkg="fricas", | ||
executable="fricas", | ||
url="https://fricas.github.io") | ||
|
||
def is_functional(self): | ||
r""" | ||
Check whether ``fricas`` works on trivial input. | ||
EXAMPLES:: | ||
sage: from sage.features.fricas import FriCAS | ||
sage: FriCAS().is_functional() # optional - fricas | ||
FeatureTestResult('fricas', True) | ||
""" | ||
command = ['fricas -nosman -eval ")quit"'] | ||
try: | ||
lines = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True) | ||
except subprocess.CalledProcessError as e: | ||
return FeatureTestResult(self, False, | ||
reason="Call `{command}` failed with exit code {e.returncode}".format(command=" ".join(command), e=e)) | ||
|
||
expected = b"FriCAS" | ||
if lines.find(expected) == -1: | ||
return FeatureTestResult(self, False, | ||
reason="Call `{command}` did not produce output which contains `{expected}`".format(command=" ".join(command), expected=expected)) | ||
|
||
return FeatureTestResult(self, True) | ||
|
||
def all_features(): | ||
return [FriCAS()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.