Skip to contentSkip to conversation

oeqa/utils/commands.py: Fix get_bb_vars() when called without arguments

PATCH In review [email protected] 2 participants 4 messages Dec 14, 2016 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 oeqa/utils/commands.py: Fix get_bb_vars() when called without arguments

From: Mariano Lopez <[email protected]>

Commit 9d55e9d489cd78be592fb9b4d6484f9060c62fdd broke calling get_bb_vars() when called without arguments. This fix this issue.

---
 meta/lib/oeqa/utils/commands.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/lib/oeqa/utils/commands.py +2 -1
index 6acb24a..aecf8cf 100644
@@ -149,7 +149,8 @@ def get_bb_vars(variables=None, target=None, postconfig=None):
     """Get values of multiple bitbake variables"""
     bbenv = get_bb_env(target, postconfig=postconfig)
 
-    variables = variables.copy()
+    if variables is not None:
+        variables = variables.copy()
     var_re = re.compile(r'^(export )?(?P<var>\w+)="(?P<value>.*)"$')
     unset_re = re.compile(r'^unset (?P<var>\w+)$')
     lastline = None
Signature · 1 line
2.6.6
#2 lore raw
Quoted 15 lines · On 12/14/2016 01:45 AM, [email protected] wrote:

From: Mariano Lopez <[email protected]>

Commit 9d55e9d489cd78be592fb9b4d6484f9060c62fdd broke calling get_bb_vars() when called without arguments. This fix this issue.

---
  meta/lib/oeqa/utils/commands.py | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
meta/lib/oeqa/utils/commands.py +0 -0
index 6acb24a..aecf8cf 100644

meta/lib/oeqa/utils/commands.py def get_bb_vars(variables=None, target=None, postconfig=None): · line 153

Quoted 6 lines
meta/lib/oeqa/utils/commands.py +2 -1
@@ -149,7 +149,8 @@ def get_bb_vars(variables=None, target=None, postconfig=None):
      """Get values of multiple bitbake variables"""
      bbenv = get_bb_env(target, postconfig=postconfig)
 
-    variables = variables.copy()
+    if variables is not None:
+        variables = variables.copy()

Is 'variables' type is a dict (or some derived type)? I see some get_bb_env calls using lists and lists do not have the copy method.

Quoted 3 lines
meta/lib/oeqa/utils/commands.py +0 -0
      var_re = re.compile(r'^(export )?(?P<var>\w+)="(?P<value>.*)"$')
      unset_re = re.compile(r'^unset (?P<var>\w+)$')
      lastline = None
#3 lore raw
Quoted 13 lines · Leonardo Sandoval
Quoted 10 lines · On 12/14/2016 01:45 AM, [email protected] wrote:

From: Mariano Lopez <[email protected]>

Commit 9d55e9d489cd78be592fb9b4d6484f9060c62fdd broke calling get_bb_vars() when called without arguments. This fix this issue.

---
  meta/lib/oeqa/utils/commands.py | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 13 lines

meta/lib/oeqa/utils/commands.py def get_bb_vars(variables=None, target=None, postconfig=None): · line 153

Quoted 11 lines
meta/lib/oeqa/utils/commands.py +0 -0
index 6acb24a..aecf8cf 100644
@@ -149,7 +149,8 @@ def get_bb_vars(variables=None, target=None, 

postconfig=None):
"""Get values of multiple bitbake variables""" bbenv = get_bb_env(target, postconfig=postconfig)
- variables = variables.copy()

meta/lib/oeqa/utils/commands.py +2 -0
+    if variables is not None:
+        variables = variables.copy()

Is 'variables' type is a dict (or some derived type)? I see some get_bb_env calls using lists and lists do not have the copy method.

I only see 3 calls in OE core, two of them uses None as first argument, and the last one uses a list, also if you check the function it will handle the argument as a list; so the function expect a list or None. And the list support the copy method, I just double check it:

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

l = [1,2,3]
l.copy()

[1, 2, 3]

#4 lore raw
Quoted 30 lines · Mariano
Quoted 13 lines · Leonardo Sandoval
Quoted 10 lines · On 12/14/2016 01:45 AM, [email protected] wrote:

From: Mariano Lopez <[email protected]>

Commit 9d55e9d489cd78be592fb9b4d6484f9060c62fdd broke calling get_bb_vars() when called without arguments. This fix this issue.

---
  meta/lib/oeqa/utils/commands.py | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 13 lines

meta/lib/oeqa/utils/commands.py def get_bb_vars(variables=None, target=None, postconfig=None): · line 153

Quoted 11 lines
meta/lib/oeqa/utils/commands.py +0 -0
index 6acb24a..aecf8cf 100644
@@ -149,7 +149,8 @@ def get_bb_vars(variables=None, target=None, 

postconfig=None):
"""Get values of multiple bitbake variables""" bbenv = get_bb_env(target, postconfig=postconfig)
- variables = variables.copy()

meta/lib/oeqa/utils/commands.py +2 -0
+    if variables is not None:
+        variables = variables.copy()

Is 'variables' type is a dict (or some derived type)? I see some get_bb_env calls using lists and lists do not have the copy method.

Quoted 5 lines

I only see 3 calls in OE core, two of them uses None as first argument, and the last one uses a list, also if you check the function it will handle the argument as a list; so the function expect a list or None. And the list support the copy method, I just double check it:

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

l = [1,2,3]
l.copy()

[1, 2, 3]

Sorry, I was using the python2 interpreter when I was doing this check. P3 included the copy method on the list data structure.

Quoted 2 lines