dexter has uploaded this change for review. (
https://gerrit.osmocom.org/c/pysim/+/30075
)
Change subject: Fix compatibility with cmd2 >= 2.3.0
......................................................................
Fix compatibility with cmd2 >= 2.3.0
cmd2.fg and cmd2.bg have been deprecated in cmd2 2.3.0 and removed
in cmd2 2.4.0. Let's work around this by a version check.
Related upstream commits:
commit f57b08672af97f9d973148b6c30d74fe4e712d14
Author: Kevin Van Brunt <kmvanbrunt(a)gmail.com>
Date: Mon Oct 11 15:20:46 2021 -0400
and
commit f217861feae45a0a1abb56436e68c5dd859d64c0
Author: Kevin Van Brunt <kmvanbrunt(a)gmail.com>
Date: Wed Feb 16 13:34:13 2022 -0500
Change-Id: I9fd32c0fd8f6d40e00a318602af97c288605e8e5
---
M pySim-shell.py
M pySim/ts_102_222.py
2 files changed, 7 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/75/30075/1
diff --git a/pySim-shell.py b/pySim-shell.py
index e52c4ef..938223a 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -23,7 +23,13 @@
import traceback
import cmd2
-from cmd2 import style, fg, bg
+from cmd2 import style
+# cmd2 >= 2.3.0 has deprecated the bg/fg in favor of Bg/Fg :(
+from packaging import version
+if version.parse(cmd2.__version__) < version.parse("2.3.0"):
+ from cmd2 import fg, bg
+else:
+ from cmd2 import Fg as fg, Bg as bg
from cmd2 import CommandSet, with_default_category, with_argparser
import argparse
diff --git a/pySim/ts_102_222.py b/pySim/ts_102_222.py
index c7cff85..3c57e5b 100644
--- a/pySim/ts_102_222.py
+++ b/pySim/ts_102_222.py
@@ -20,7 +20,6 @@
from typing import List
import cmd2
-from cmd2 import style, fg, bg
from cmd2 import CommandSet, with_default_category, with_argparser
import argparse
--
To view, visit
https://gerrit.osmocom.org/c/pysim/+/30075
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I9fd32c0fd8f6d40e00a318602af97c288605e8e5
Gerrit-Change-Number: 30075
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange