aboutsummaryrefslogtreecommitdiffstats
path: root/pySim-shell.py
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2023-04-27 17:10:17 +0200
committerPhilipp Maier <pmaier@sysmocom.de>2023-05-17 17:30:49 +0200
commitc85d4067fdbf641f6ca63be862023c0aca726c29 (patch)
treeca7b2d59ce8d339193e8333dbad8b32ec5446e10 /pySim-shell.py
parent93aac3abe6b536984f369bc4d07087801fb97807 (diff)
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
Diffstat (limited to 'pySim-shell.py')
-rwxr-xr-xpySim-shell.py7
1 files changed, 6 insertions, 1 deletions
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 @@ 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