]> code.ossystems Code Review - openembedded-core.git/commitdiff
base: Clean up unneeded len() calls
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 9 Oct 2021 16:46:17 +0000 (17:46 +0100)
committerSteve Sakoman <steve@sakoman.com>
Fri, 29 Oct 2021 14:48:40 +0000 (04:48 -1000)
This code pattern isn't very pythonic, improve it to drop the unneeded
len() calls.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 69376ac1a6147b26fe1abaa4cf68414024814d63)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
meta/classes/base.bbclass

index 8a1b5f79c130688c50771b52f27e119e99d74e25..a3e98d1b50e72eb64a254f457734dd8094de755d 100644 (file)
@@ -153,7 +153,7 @@ do_fetch[vardeps] += "SRCREV"
 python base_do_fetch() {
 
     src_uri = (d.getVar('SRC_URI') or "").split()
-    if len(src_uri) == 0:
+    if not src_uri:
         return
 
     try:
@@ -170,7 +170,7 @@ do_unpack[cleandirs] = "${@d.getVar('S') if os.path.normpath(d.getVar('S')) != o
 
 python base_do_unpack() {
     src_uri = (d.getVar('SRC_URI') or "").split()
-    if len(src_uri) == 0:
+    if not src_uri:
         return
 
     try:
@@ -688,7 +688,7 @@ python () {
             if os.path.basename(p) == machine and os.path.isdir(p):
                 paths.append(p)
 
-        if len(paths) != 0:
+        if paths:
             for s in srcuri.split():
                 if not s.startswith("file://"):
                     continue
@@ -721,7 +721,7 @@ do_cleansstate[nostamp] = "1"
 
 python do_cleanall() {
     src_uri = (d.getVar('SRC_URI') or "").split()
-    if len(src_uri) == 0:
+    if not src_uri:
         return
 
     try: