Skip to content

Commit 5f507cc

Browse files
Merge pull request #1263 from ultimate-pa/ultimate-launcher-jars
Ultimate toolinfo-module: Use wildcard matching for launcher JARs
2 parents b7957ae + 01ab6e4 commit 5f507cc

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

benchexec/tools/ultimate.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,7 @@
3333
_SVCOMP17_VERSIONS = {"f7c3ed31"}
3434
_SVCOMP17_FORBIDDEN_FLAGS = {"--full-output", "--architecture"}
3535
_ULTIMATE_VERSION_REGEX = re.compile(r"^Version is (.*)$", re.MULTILINE)
36-
# .jar files that are used as launcher arguments with most recent .jar first
37-
_LAUNCHER_JARS = [
38-
"plugins/org.eclipse.equinox.launcher_1.5.800.v20200727-1323.jar",
39-
"plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar",
40-
"plugins/org.eclipse.equinox.launcher_1.6.800.v20240513-1750.jar",
41-
]
36+
_JAR_LAUNCHER_PATTERN = r"plugins/org.eclipse.equinox.launcher_*.jar"
4237

4338

4439
class UltimateTool(benchexec.tools.template.BaseTool2):
@@ -81,7 +76,7 @@ def executable(self, tool_locator):
8176
exe = tool_locator.find_executable("Ultimate.py")
8277
dir_name = Path(os.path.dirname(exe))
8378
logging.debug("Checking if %s contains a launcher jar", dir_name)
84-
if any((dir_name / rel_launcher).exists() for rel_launcher in _LAUNCHER_JARS):
79+
if any(dir_name.glob(_JAR_LAUNCHER_PATTERN)):
8580
return exe
8681
msg = (
8782
f"ERROR: Did find a Ultimate.py in {os.path.dirname(exe)} "
@@ -169,11 +164,12 @@ def _query_ultimate_version(self, cmd, api):
169164
@functools.lru_cache
170165
def _get_current_launcher_jar(self, executable):
171166
ultimate_dir = os.path.dirname(executable)
172-
for jar in _LAUNCHER_JARS:
173-
launcher_jar = os.path.join(ultimate_dir, jar)
174-
if os.path.isfile(launcher_jar):
175-
return launcher_jar
176-
raise FileNotFoundError(f"No suitable launcher jar found in {ultimate_dir}")
167+
launcher_candidates = glob.glob(_JAR_LAUNCHER_PATTERN, root_dir=ultimate_dir)
168+
if not launcher_candidates:
169+
raise FileNotFoundError(f"No suitable launcher jar found in {ultimate_dir}")
170+
if len(launcher_candidates) > 1:
171+
raise FileNotFoundError(f"Multiple launcher jars found in {ultimate_dir}")
172+
return os.path.join(ultimate_dir, launcher_candidates[0])
177173

178174
@functools.lru_cache
179175
def version(self, executable):

0 commit comments

Comments
 (0)