Skip to content

Commit

Permalink
Merge pull request sosy-lab#1102 from ultimate-pa/update-ultimate-jdk21
Browse files Browse the repository at this point in the history
Update Ultimate tool info module
  • Loading branch information
PhilippWendler authored Nov 7, 2024
2 parents f7d8955 + e292b96 commit 2ca9b4a
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions benchexec/tools/ultimate.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import glob
import logging
import os
from pathlib import Path
import re
import shlex
import shutil
Expand All @@ -30,6 +31,7 @@
_LAUNCHER_JARS = [
"plugins/org.eclipse.equinox.launcher_1.5.800.v20200727-1323.jar",
"plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar",
"plugins/org.eclipse.equinox.launcher_1.6.800.v20240513-1750.jar",
]


Expand Down Expand Up @@ -71,15 +73,13 @@ def project_url(self):

def executable(self, tool_locator):
exe = tool_locator.find_executable("Ultimate.py")
dir_name = os.path.dirname(exe)
logging.debug("Looking in %s for Ultimate and plugins/", dir_name)
for _, dir_names, file_names in os.walk(dir_name):
if "Ultimate" in file_names and "plugins" in dir_names:
return exe
break
dir_name = Path(os.path.dirname(exe))
logging.debug("Checking if %s contains a launcher jar", dir_name)
if any([(dir_name / rel_launcher).exists() for rel_launcher in _LAUNCHER_JARS]):
return exe
msg = (
f"ERROR: Did find a Ultimate.py in {os.path.dirname(exe)} "
f"but no 'Ultimate' or no 'plugins' directory besides it"
f"but no launcher .jar besides it"
)
raise ToolNotFoundException(msg)

Expand Down Expand Up @@ -466,6 +466,8 @@ def get_value_from_output(self, output, identifier):
return None

def get_java_installations(self):
# The code in this method is (and should remain) consistent with the method `get_java` in
# <https://github.com/ultimate-pa/ultimate/blob/dev/releaseScripts/default/adds/Ultimate.py>.
candidates = [
"java",
"/usr/bin/java",
Expand All @@ -474,11 +476,16 @@ def get_java_installations(self):
"/usr/lib/jvm/java-*-openjdk-amd64/bin/java",
]

candidates = [c for entry in candidates for c in glob.glob(entry)]
candidates_extended = []
for c in candidates:
if "*" in c:
candidates_extended += glob.glob(c)
else:
candidates_extended += [c]
pattern = r'"(\d+\.\d+).*"'

rtr = {}
for c in candidates:
for c in candidates_extended:
candidate = shutil.which(c)
if not candidate:
continue
Expand Down

0 comments on commit 2ca9b4a

Please sign in to comment.