* [bitbake-devel][PATCH] fetch2/crate: move cmp_to_key import to module level
@ 2026-05-07 14:37 thomas.perrot
0 siblings, 0 replies; only message in thread
From: thomas.perrot @ 2026-05-07 14:37 UTC (permalink / raw)
To: bitbake-devel; +Cc: thomas.petazzoni, Thomas Perrot
From: Thomas Perrot <thomas.perrot@bootlin.com>
The import was duplicated inside both latest_versionstring() and
latest_versionstring_from_index(). Move it to the top of the module.
Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com>
---
lib/bb/fetch2/crate.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/lib/bb/fetch2/crate.py b/lib/bb/fetch2/crate.py
index eb1fd5719e8c..b46d4f1a9801 100644
--- a/lib/bb/fetch2/crate.py
+++ b/lib/bb/fetch2/crate.py
@@ -14,6 +14,7 @@ import hashlib
import json
import os
import subprocess
+from functools import cmp_to_key
import bb
from bb.fetch2 import logger, subprocess_setup, UnpackError
from bb.fetch2.wget import Wget
@@ -159,7 +160,6 @@ class Crate(Wget):
"""
Return the latest version available when versionsurl is the [name]/versions URL.
"""
- from functools import cmp_to_key
json_data = json.loads(self._fetch_index(ud.versionsurl, ud, d))
versions = [(0, i["num"], "") for i in json_data["versions"]]
versions = sorted(versions, key=cmp_to_key(bb.utils.vercmp))
@@ -172,8 +172,6 @@ class Crate(Wget):
file.
https://doc.rust-lang.org/cargo/reference/registry-index.html#index-files
"""
- from functools import cmp_to_key
-
versions = []
response = self._fetch_index(ud.versionsurl, ud, d)
for line in response.splitlines():
--
2.54.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-05-07 14:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-07 14:37 [bitbake-devel][PATCH] fetch2/crate: move cmp_to_key import to module level thomas.perrot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox