Skip to content

Commit

Permalink
more improved SDK lookup.
Browse files Browse the repository at this point in the history
  • Loading branch information
oraluben committed Aug 14, 2023
1 parent a350cc4 commit f99b440
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mx_ide_intellij.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,12 @@ def verSort(path):
xmlSdks.sort(key=verSort, reverse=True)

sdk_version_regexes = {
intellij_java_sdk_type: re.compile(r'^java\s+version\s+"([^"]+)"$|^(Oracle OpenJDK )?version\s+(.+)$|^([\d._]+)$'),
# Examples:
# java version "21"
# GraalVM version 21 (vendor name may change)
intellij_java_sdk_type: re.compile(r'^java\s+version\s+"([^"]+)"$|'
r'^(?:.+ )?version\s+(.+)$|'
r'^([\d._]+)$'),
intellij_python_sdk_type: re.compile(r'^Python\s+(.+)$'),

# Examples:
Expand Down Expand Up @@ -170,7 +175,7 @@ def verSort(path):
sdk_version = sdk.find("version").get("value")
match = version_re.match(sdk_version)
if match:
version = match.group(1)
version = next(filter(None, match.groups()), None)
lang = sdk_languages[kind]
if kind == intellij_python_sdk_type:
import mx_enter
Expand Down

0 comments on commit f99b440

Please sign in to comment.