From: Thomas Perrot <[email protected]>
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 <[email protected]>
---
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.