diff mbox series

[master,mickledore,1/2] fetch2/crate: Simplify extraction of crate names and versions from URIs

Message ID 20230429012329.1799116-1-pkj@axis.com
State New
Headers show
Series [master,mickledore,1/2] fetch2/crate: Simplify extraction of crate names and versions from URIs | expand

Commit Message

Peter Kjellerstedt April 29, 2023, 1:23 a.m. UTC
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---

@Steve Sakoman: Since this is a clean up patch, I will leave it up to
you to decide if you want to take it for Mickledore once it makes it
into master.

 bitbake/lib/bb/fetch2/crate.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/bitbake/lib/bb/fetch2/crate.py b/bitbake/lib/bb/fetch2/crate.py
index a7021e5b36..2b8b6bc7a1 100644
--- a/bitbake/lib/bb/fetch2/crate.py
+++ b/bitbake/lib/bb/fetch2/crate.py
@@ -59,11 +59,11 @@  class Crate(Wget):
         # version is expected to be the last token
         # but ignore possible url parameters which will be used
         # by the top fetcher class
-        version, _, _ = parts[len(parts) -1].partition(";")
+        version = parts[-1].split(";")[0]
         # second to last field is name
-        name = parts[len(parts) - 2]
+        name = parts[-2]
         # host (this is to allow custom crate registries to be specified
-        host = '/'.join(parts[2:len(parts) - 2])
+        host = '/'.join(parts[2:-2])
 
         # if using upstream just fix it up nicely
         if host == 'crates.io':