Re-instate "create_command_string fix for py3"
This reverts commit 79b3444ab8262a26d67394c43ac893357e29126f.
Change-Id: I44601fdd89b8f2c309f20cdda43376889f13d9a6
diff --git a/lib/gen_cmd.py b/lib/gen_cmd.py
index 0f18cb6..c611d5c 100644
--- a/lib/gen_cmd.py
+++ b/lib/gen_cmd.py
@@ -693,10 +693,10 @@
my program -pass 0 -fail 0 pos_parm1
- Note to programmers who wish to write a wrapper to this function: To get
- the options to be processed correctly, the wrapper function must include a
- _stack_frame_ix_ keyword argument to allow this function to properly
- re-order options:
+ Note to programmers who wish to write a wrapper to this function: If the
+ python version is less than 3.6, to get the options to be processed
+ correctly, the wrapper function must include a _stack_frame_ix_ keyword
+ argument to allow this function to properly re-order options:
def create_ipmi_ext_command_string(command, **kwargs):
@@ -738,14 +738,11 @@
else:
# Either get stack_frame_ix from the caller via options or set it to
# the default value.
- if '_stack_frame_ix_' in options:
- stack_frame_ix = options['_stack_frame_ix_']
- del options['_stack_frame_ix_']
- else:
- stack_frame_ix = 1
- # Re-establish the original options order as specified on the
- # original line of code. This function depends on correct order.
- options = re_order_kwargs(stack_frame_ix, **options)
+ stack_frame_ix = options.pop('_stack_frame_ix_', 1)
+ if gm.python_version < gm.ordered_dict_version:
+ # Re-establish the original options order as specified on the
+ # original line of code. This function depends on correct order.
+ options = re_order_kwargs(stack_frame_ix, **options)
for key, value in options.items():
# Check for special values in options and process them.
if key == "arg_dashes":