mirror of https://gerrit.osmocom.org/pysim
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
This commit is contained in:
parent
93aac3abe6
commit
c85d4067fd
|
@ -135,8 +135,13 @@ class PysimApp(cmd2.Cmd):
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue