Skip to content

Commit f76c8c0

Browse files
committed
improve kdk match
1 parent 78ceb3d commit f76c8c0

2 files changed

Lines changed: 8 additions & 22 deletions

File tree

oclp_r/support/kdk_handler.py

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
kdk_handler.py: Module for parsing and determining best Kernel Debug Kit for host OS
33
"""
44

5+
import json
56
import logging
67
import plistlib
78
import requests
@@ -210,33 +211,18 @@ def _get_latest_kdk(self, host_build: str = None, host_version: str = None) -> N
210211
break
211212

212213
# If no exact match, check for closest match
213-
if self.kdk_url == "":
214-
count_kdks=[]
215-
for kdk in remote_kdk_version:
216-
kdk_version = cast(packaging.version.Version, packaging.version.parse(kdk["version"]))
217-
if kdk_version > parsed_version:
218-
continue
219-
if kdk_version.major != parsed_version.major:
220-
continue
221-
if kdk_version.minor not in range(parsed_version.minor - 1, parsed_version.minor + 1):
222-
continue
223-
count_kdks.append(kdk)
214+
if not self.kdk_url_is_exactly_match:
215+
count_kdks=remote_kdk_version
224216
if count_kdks:
225217
count_kdks.sort(key=lambda x: x["build"], reverse=True)
218+
226219
closest = None
227220
for kdk in count_kdks:
228221
# Need same version (example: 26.3==26.3 -> 26D==26D)
229222
if kdk["build"][0:3] == host_build[0:3]:
230223
# We need to check beta versions
231-
if kdk["build"][-1]>="a" and kdk["build"][-1]<="z":
232-
# example: 25D5087f -> macOS 26.3 Beta
233-
# earlier than 25D125
234-
logging.info(self.trans["This is macOS beta's KDK"])
235-
closest=kdk
236-
break
237-
else:
238-
closest=kdk
239-
break
224+
closest=kdk
225+
break
240226

241227
elif kdk["build"][0:2] == host_build[0:2] and ord(kdk["build"][2])-1==ord(host_build[2]):
242228
closest=kdk
@@ -252,7 +238,7 @@ def _get_latest_kdk(self, host_build: str = None, host_version: str = None) -> N
252238

253239

254240

255-
if self.kdk_url == "":
241+
if not self.kdk_url_is_exactly_match:
256242
if self.kdk_closest_match_url == "":
257243
logging.warning(self.trans["No KDKs found for {0} ({1})"].format(host_build, host_version))
258244
self.error_msg = self.trans["No KDKs found for {0} ({1})"].format(host_build, host_version)

oclp_r/support/network_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
DEFAULT_ALLOWED_DOMAINS = {
3838
"next.oclpapi.simplehac.cn",
3939
"oclpapi.simplehac.cn",
40-
"simplehac.cn","gitapi.simplehac.top",
40+
"simplehac.cn","gitapi.simplehac.top",
4141
"ghfast.top","gh-proxy.com","gh.llkk.cc",
4242
'github.com', 'api.github.com', 'codeload.github.com',
4343
'github-releases.githubusercontent.com',

0 commit comments

Comments
 (0)