|
14 | 14 |
|
15 | 15 | import subprocess
|
16 | 16 | from . import Executable, FeatureTestResult
|
| 17 | +from packaging.version import Version |
17 | 18 |
|
18 | 19 |
|
19 | 20 | class FriCAS(Executable):
|
@@ -43,6 +44,12 @@ def __init__(self):
|
43 | 44 | def get_version(self):
|
44 | 45 | r"""
|
45 | 46 | Retrieve the installed FriCAS version
|
| 47 | +
|
| 48 | + EXAMPLES:: |
| 49 | +
|
| 50 | + sage: from sage.features.fricas import FriCAS |
| 51 | + sage: FriCAS().get_version() # optional - fricas |
| 52 | + '1.3.8' |
46 | 53 | """
|
47 | 54 | try:
|
48 | 55 | output = subprocess.check_output(['fricas', '--version'], stderr=subprocess.STDOUT)
|
@@ -79,11 +86,13 @@ def is_functional(self):
|
79 | 86 | return FeatureTestResult(self, False,
|
80 | 87 | reason="Could not determine FriCAS version")
|
81 | 88 |
|
82 |
| - from pkg_resources import parse_version |
83 |
| - if parse_version(version) < parse_version(self.MINIMUM_VERSION): |
84 |
| - return FeatureTestResult(self, False, |
85 |
| - reason=f"FriCAS version {version} is too old; minimum required is {self.MINIMUM_VERSION}") |
86 |
| - return FeatureTestResult(self, True) |
| 89 | + try: |
| 90 | + if Version(version) < Version(self.MINIMUM_VERSION): |
| 91 | + return FeatureTestResult(self, False, |
| 92 | + reason=f"FriCAS version {version} is too old; minimum required is {self.MINIMUM_VERSION}") |
| 93 | + return FeatureTestResult(self, True) |
| 94 | + except ValueError: |
| 95 | + return FeatureTestResult(self, False, reason="Invalid Version Format") |
87 | 96 |
|
88 | 97 |
|
89 | 98 | def all_features():
|
|
0 commit comments