Skip to content

Commit

Permalink
Updated version detection
Browse files Browse the repository at this point in the history
  • Loading branch information
mapgccv committed Mar 20, 2024
1 parent 727e515 commit abdf3f8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/end2end/scripts/python/AMPLRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import math
from pathlib import Path
from shutil import which
from token import LBRACE

from Solver import Solver
from amplpy import AMPL, Kind, OutputHandler, ErrorHandler, Environment
Expand Down Expand Up @@ -186,15 +187,14 @@ def _getSolverVersion(self, solver) -> tuple:
command = f"shell \"{solver} -v\";"
print(f"Executing {command}")
v=self._ampl.get_output(command)
print(f"Output:\n{v}")
v=v.splitlines()[0]
driver_version = None
import re
driver_match = re.search(r'driver\((\d+)\)', v)
if driver_match:
driver_version = driver_match.group(1)
else:
driver_version = None

for l in v.splitlines():
driver_match = re.search(r'driver\((\d+)\)', l)
if driver_match:
driver_version = driver_match.group(1)
v=l
break
return (driver_version, v)


Expand Down

0 comments on commit abdf3f8

Please sign in to comment.