From a3fd188750fead0b617c4f6c8a230b1d8088bb05 Mon Sep 17 00:00:00 2001 From: Devansh Srivastava Date: Tue, 1 Apr 2025 14:56:54 +0530 Subject: [PATCH 1/4] fixed conflicts --- src/sage/features/fricas.py | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/sage/features/fricas.py b/src/sage/features/fricas.py index 8c3c32c0edd..b104c55a7fd 100644 --- a/src/sage/features/fricas.py +++ b/src/sage/features/fricas.py @@ -14,6 +14,7 @@ import subprocess from . import Executable, FeatureTestResult +from packaging.version import Version class FriCAS(Executable): @@ -26,6 +27,8 @@ class FriCAS(Executable): sage: FriCAS().is_present() # optional - fricas FeatureTestResult('fricas', True) """ + MINIMUM_VERSION = "1.3.8" + def __init__(self): r""" TESTS:: @@ -38,6 +41,23 @@ def __init__(self): executable='fricas', url='https://fricas.github.io') + def get_version(self): + r""" + Retrieve the installed FriCAS version + + EXAMPLES:: + sage: from sage.features.fricas import FriCAS + sage: FriCAS().get_version() # optional - fricas + '1.3.8' + """ + try: + output = subprocess.check_output(['fricas', '--version'], stderr=subprocess.STDOUT) + version_line = output.decode('utf-8').strip() + version = version_line.split()[1] + return version + except subprocess.CalledProcessError: + return None + def is_functional(self): r""" Check whether ``fricas`` works on trivial input. @@ -53,14 +73,24 @@ def is_functional(self): 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)) + 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)) + reason="Call `{command}` did not produce output which contains `{expected}`".format(command=" ".join(command), + expected=expected)) + version = self.get_version() + if version is None: + return FeatureTestResult(self, False, + reason="Could not determine FriCAS version") - return FeatureTestResult(self, True) + try: + if Version(version) < Version(self.MINIMUM_VERSION): + return FeatureTestResult(self, False, reason=f"FriCAS version {version} is too old; minimum required is {self.MINIMUM_VERSION}") + return FeatureTestResult(self, True) + except ValueError: + return FeatureTestResult(self, False, reason="Invalid Version Format") def all_features(): From 9897efb815bbb7bec1f92df1cbeb2b9944bf8575 Mon Sep 17 00:00:00 2001 From: Devansh Srivastava Date: Fri, 4 Apr 2025 10:41:23 +0530 Subject: [PATCH 2/4] fix: changed the test for fricas version --- src/sage/features/fricas.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/features/fricas.py b/src/sage/features/fricas.py index b104c55a7fd..1c433abfae5 100644 --- a/src/sage/features/fricas.py +++ b/src/sage/features/fricas.py @@ -48,7 +48,7 @@ def get_version(self): EXAMPLES:: sage: from sage.features.fricas import FriCAS sage: FriCAS().get_version() # optional - fricas - '1.3.8' + '1.3...' """ try: output = subprocess.check_output(['fricas', '--version'], stderr=subprocess.STDOUT) From a9e094be0a538798151fc9b2aa4e9a16520eedd7 Mon Sep 17 00:00:00 2001 From: Devansh Srivastava Date: Sun, 6 Apr 2025 22:21:42 +0530 Subject: [PATCH 3/4] added suggested changes --- build/pkgs/fricas/spkg-configure.m4 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build/pkgs/fricas/spkg-configure.m4 b/build/pkgs/fricas/spkg-configure.m4 index 905859f6a95..2c8944e5a19 100644 --- a/build/pkgs/fricas/spkg-configure.m4 +++ b/build/pkgs/fricas/spkg-configure.m4 @@ -1,4 +1,7 @@ SAGE_SPKG_CONFIGURE( +dnl +dnl make sure that the minimal version is also set in src/sage/feature/fricas.py +dnl [fricas], [ AC_CACHE_CHECK([for FriCAS >= 1.3.8], [ac_cv_path_FRICAS], [ AC_PATH_PROGS_FEATURE_CHECK([FRICAS], [fricas], [ From 1e9cf1ddcd2536652b141f8dcdf7bc49103430fd Mon Sep 17 00:00:00 2001 From: Devansh Srivastava Date: Wed, 9 Apr 2025 14:18:43 +0530 Subject: [PATCH 4/4] fixed syntax errors caused by dnl --- build/pkgs/fricas/spkg-configure.m4 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/pkgs/fricas/spkg-configure.m4 b/build/pkgs/fricas/spkg-configure.m4 index 2c8944e5a19..97353140bac 100644 --- a/build/pkgs/fricas/spkg-configure.m4 +++ b/build/pkgs/fricas/spkg-configure.m4 @@ -1,8 +1,8 @@ SAGE_SPKG_CONFIGURE( -dnl -dnl make sure that the minimal version is also set in src/sage/feature/fricas.py -dnl [fricas], [ + dnl + dnl make sure that the minimal version is also set in src/sage/feature/fricas.py + dnl 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 \