Message ID | 20201023081411.33229-2-yufengx.mo@intel.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | framework: check the python version | expand |
> implement a method to check the python version of tester and the server that > run dts. > If the version is python2, print a warning message. > > Signed-off-by: yufengmx <yufengx.mo@intel.com> An update of your comment is needed.
What comment is needed? > -----Original Message----- > From: Tu, Lijuan > Sent: Friday, October 23, 2020 5:12 PM > To: Mo, YufengX <yufengx.mo@intel.com>; dts@dpdk.org; Ma, LihongX <lihongx.ma@intel.com> > Subject: RE: [dts][PATCH V4 1/3] framework: check the python version > > > implement a method to check the python version of tester and the server that > > run dts. > > If the version is python2, print a warning message. > > > > Signed-off-by: yufengmx <yufengx.mo@intel.com> > > An update of your comment is needed.
> > > implement a method to check the python version of tester and the > > > server that run dts. > > > If the version is python2, print a warning message. > > > > > > Signed-off-by: yufengmx <yufengx.mo@intel.com> > > > > An update of your comment is needed. > What comment is needed? Your patch is check if the version is greater than 3.6.9.
diff --git a/framework/utils.py b/framework/utils.py index e74e6c5..6084ea6 100644 --- a/framework/utils.py +++ b/framework/utils.py @@ -32,6 +32,7 @@ import json # json format import re import os +import sys import inspect import socket import struct @@ -280,3 +281,30 @@ def get_backtrace_object(file_name, obj_name): obj = getattr(frame.f_locals['self'], obj_name, None) return obj + + +def check_crb_python_version(crb): + cmd = 'python3 -V' + out = crb.send_expect(cmd, '#', 5) + pat = "Python (\d+).(\d+).(\d+)" + result = re.findall(pat, out) + if not result or \ + int(result[0][0]) < 3 or \ + (int(result[0][0]) == 3 and int(result[0][1]) < 6) or \ + (int(result[0][0]) == 3 and int(result[0][1]) == 6 and int(result[0][2]) < 9): + crb.logger.warning( + ("WARNING: Tester node python version is lower than python 3.6, " + "it is deprecated for use in DTS, " + "and will not work in future releases.")) + crb.logger.warning("Please use Python >= 3.6.9 instead") + + +def check_dts_python_version(): + if sys.version_info.major < 3 or \ + (sys.version_info.major == 3 and sys.version_info.minor < 6) or \ + (sys.version_info.major == 3 and sys.version_info.minor == 6 and sys.version_info.micro < 9): + print(RED( + ("WARNING: Dts running node python version is lower than python 3.6, " + "it is deprecated for use in DTS, " + "and will not work in future releases.")), file=sys.stderr) + print(RED("Please use Python >= 3.6.9 instead"), file=sys.stderr)
implement a method to check the python version of tester and the server that run dts. If the version is python2, print a warning message. Signed-off-by: yufengmx <yufengx.mo@intel.com> --- framework/utils.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)