laforge submitted this change.

View Change


Approvals: fixeria: Looks good to me, but someone else must approve Jenkins Builder: Verified laforge: Looks good to me, approved
pySim-shell: fix compatibility problem with cmd2 >= 2.0.0 (include_ipy)

In version 2.0.0, the use_ipython parameter in the Cmd constructor is
renamed to include_ipy. There are still plenty of older cmd2
installations around, so let's work around this using a version check.

See also: https://github.com/python-cmd2/cmd2

Commit: 2397280cad072a27a51f5ec1cc64908039d14bd1
Author: Kevin Van Brunt <kmvanbrunt@gmail.com>
Date: 2021-03-26 18:56:33

This commit is based on pySim gerrit changes:
Ifce40410587c85ae932774144b9548b154ee8ad0
I19d28276e73e7024f64ed693c3b5e37c1344c687

Change-Id: Ibc0e18b002a03ed17933be4d0b4f4e86ad99c26e
---
M pySim-shell.py
1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/pySim-shell.py b/pySim-shell.py
index fab5d09..ae783c6 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -135,8 +135,13 @@
CUSTOM_CATEGORY = 'pySim Commands'

def __init__(self, card, rs, sl, ch, script=None):
+ if version.parse(cmd2.__version__) < version.parse("2.0.0"):
+ kwargs = {'use_ipython': True}
+ else:
+ kwargs = {'include_ipy': True}
+
super().__init__(persistent_history_file='~/.pysim_shell_history', allow_cli_args=False,
- use_ipython=True, auto_load_commands=False, startup_script=script)
+ auto_load_commands=False, startup_script=script, **kwargs)
self.intro = style('Welcome to pySim-shell!', fg=fg.red)
self.default_category = 'pySim-shell built-in commands'
self.card = None

To view, visit change 32533. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ibc0e18b002a03ed17933be4d0b4f4e86ad99c26e
Gerrit-Change-Number: 32533
Gerrit-PatchSet: 7
Gerrit-Owner: dexter <pmaier@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: markb <markboldyrev@gmail.com>
Gerrit-MessageType: merged