From 3968806fd32888b80b50ed10c43f70bb950bd467 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 2 Jan 2022 22:23:33 +0100 Subject: [PATCH] Add Maxima version query --- pymbolic/interop/maxima.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pymbolic/interop/maxima.py b/pymbolic/interop/maxima.py index 93a7299a..1e56673b 100644 --- a/pymbolic/interop/maxima.py +++ b/pymbolic/interop/maxima.py @@ -297,6 +297,21 @@ def _initialize(self): # }}} + # {{{ check maxima version + + self.child.sendline( + f'"{self.executable}" --version') + + ver_output = self.child.expect(["Maxima ([0-9.]+)"]) + if ver_output != 0: + raise RuntimeError( + "unable to find maxima version from '{self.executable}'") + + ver_match = self.child.match.group(1) + self.maxima_version = tuple(int(n) for n in ver_match.split(b".")) + + # }}} + import tempfile with tempfile.NamedTemporaryFile(suffix=".lisp") as maxima_init_f: