Skip to content

Commit bc1509b

Browse files
committed
add 26.0 check
1 parent a7b710b commit bc1509b

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

oclp_r/support/kdk_handler.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ def _get_latest_kdk(self, host_build: str = None, host_version: str = None) -> N
211211

212212
# If no exact match, check for closest match
213213
if self.kdk_url == "":
214+
count_kdks=[]
214215
for kdk in remote_kdk_version:
215216
kdk_version = cast(packaging.version.Version, packaging.version.parse(kdk["version"]))
216217
if kdk_version > parsed_version:
@@ -219,14 +220,23 @@ def _get_latest_kdk(self, host_build: str = None, host_version: str = None) -> N
219220
continue
220221
if kdk_version.minor not in range(parsed_version.minor - 1, parsed_version.minor + 1):
221222
continue
222-
223-
# The KDK list is already sorted by version then date, so the first match is the closest
224-
self.kdk_closest_match_url = kdk["url"]
225-
self.kdk_closest_match_url_build = kdk["build"]
226-
self.kdk_closest_match_url_version = kdk["version"]
227-
self.kdk_closest_match_url_expected_size = kdk["fileSize"]
223+
count_kdks.append(kdk)
224+
if count_kdks:
225+
count_kdks.sort(key=lambda x: x["build"], reverse=True)
226+
closest = None
227+
for kdk in count_kdks:
228+
if kdk["build"] <= host_build:
229+
closest = kdk
230+
break
231+
if closest is None:
232+
closest = count_kdks[-1]
233+
self.kdk_closest_match_url = closest["url"]
234+
self.kdk_closest_match_url_build = closest["build"]
235+
self.kdk_closest_match_url_version = closest["version"]
236+
self.kdk_closest_match_url_expected_size = closest["fileSize"]
228237
self.kdk_url_is_exactly_match = False
229-
break
238+
239+
230240

231241
if self.kdk_url == "":
232242
if self.kdk_closest_match_url == "":
@@ -418,8 +428,7 @@ def _local_kdk_installed(self, match: str = None, check_version: bool = False) -
418428
match = self.host_version
419429
else:
420430
match = self.host_build
421-
if match == "24A354":
422-
match = "24A353"
431+
423432
if not Path(KDK_INSTALL_PATH).exists():
424433
return None
425434

0 commit comments

Comments
 (0)