Message ID | 20201014071448.32119-2-yufengx.mo@intel.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers |
Return-Path: <dts-bounces@dpdk.org> X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C83F9A04C0; Wed, 14 Oct 2020 09:19:11 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BEFD31DCA3; Wed, 14 Oct 2020 09:19:10 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 762AF1DC67 for <dts@dpdk.org>; Wed, 14 Oct 2020 09:19:08 +0200 (CEST) IronPort-SDR: XOmlTekGNaS1bW7C4Rdr3SOGS7IMkEcm3vnquM4Nh23hw4mGDIbikEE6WhCc8U8XbNd6EyH57y w4kMPELyzpBQ== X-IronPort-AV: E=McAfee;i="6000,8403,9773"; a="145364898" X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="145364898" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 00:19:06 -0700 IronPort-SDR: Ka4N75MUdR5v7YRM78qlp2hZN/6kuCARleaTCQy0wipsPDksIJdEG7YquXwbIdr0YdJnvYROda fKMdCR+keprw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,373,1596524400"; d="scan'208";a="530719483" Received: from dpdk-moyufen06.sh.intel.com ([10.67.116.208]) by orsmga005.jf.intel.com with ESMTP; 14 Oct 2020 00:19:05 -0700 From: yufengmx <yufengx.mo@intel.com> To: dts@dpdk.org, lihongx.ma@intel.com Cc: yufengmx <yufengx.mo@intel.com> Date: Wed, 14 Oct 2020 15:14:46 +0800 Message-Id: <20201014071448.32119-2-yufengx.mo@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20201014071448.32119-1-yufengx.mo@intel.com> References: <20201014071448.32119-1-yufengx.mo@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dts] [PATCH V2 1/3] framework: check the python version X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions <dts.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dts>, <mailto:dts-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dts/> List-Post: <mailto:dts@dpdk.org> List-Help: <mailto:dts-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dts>, <mailto:dts-request@dpdk.org?subject=subscribe> Errors-To: dts-bounces@dpdk.org Sender: "dts" <dts-bounces@dpdk.org> |
Series |
framework: check the python version
|
|
Commit Message
Yufen.Mo
Oct. 14, 2020, 7:14 a.m. UTC
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 | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
Comments
DTS only support Python3 now, it doesn't support Python2. But it requires Python minus version. E.g. Python3.4 is not supported, it requires version larger than 3.6x. > +def check_crb_python_version(crb): > + cmd = 'python3 -V' It seems you are telling python version for python 3. If you are using python3, how can it tell you python2. > + 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: > + crb.logger.warning( > + ("WARNING: Tester node python version is lower than python 3, " > + "it is deprecated for use in DTS, " Python2 have been replaced by Python2 in DTS, so the message is not reasonable. > + "and will not work in future releases.")) > + crb.logger.warning("Please use Python 3 instead") > + > + > +def check_dts_python_version(): > + if sys.version_info.major < 3: > + print(RED( > + ("WARNING: Dts running node python version is lower than python 3, " > + "it is deprecated for use in DTS, " > + "and will not work in future releases.")), file=sys.stderr) > + print(RED("Please use Python 3 instead"), file=sys.stderr) > -- > 2.21.0
So, checking python version > 3.6.0 is what you want to do? > -----Original Message----- > From: Tu, Lijuan > Sent: Thursday, October 22, 2020 9:18 AM > To: Mo, YufengX <yufengx.mo@intel.com>; dts@dpdk.org; Ma, LihongX <lihongx.ma@intel.com> > Cc: Mo, YufengX <yufengx.mo@intel.com> > Subject: RE: [dts] [PATCH V2 1/3] framework: check the python version > > DTS only support Python3 now, it doesn't support Python2. But it requires Python minus version. E.g. Python3.4 is not supported, it > requires version larger than 3.6x. > > > +def check_crb_python_version(crb): > > + cmd = 'python3 -V' > > It seems you are telling python version for python 3. If you are using python3, how can it tell you python2. > > > + 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: > > + crb.logger.warning( > > + ("WARNING: Tester node python version is lower than python 3, " > > + "it is deprecated for use in DTS, " > Python2 have been replaced by Python2 in DTS, so the message is not reasonable. > > > + "and will not work in future releases.")) > > + crb.logger.warning("Please use Python 3 instead") > > + > > + > > +def check_dts_python_version(): > > + if sys.version_info.major < 3: > > + print(RED( > > + ("WARNING: Dts running node python version is lower than python 3, " > > + "it is deprecated for use in DTS, " > > + "and will not work in future releases.")), file=sys.stderr) > > + print(RED("Please use Python 3 instead"), file=sys.stderr) > > -- > > 2.21.0
Hi Lihong, Investigation of what's python version DTS support need to be completed first. > -----Original Message----- > From: Mo, YufengX <yufengx.mo@intel.com> > Sent: 2020年10月22日 10:30 > To: Tu, Lijuan <lijuan.tu@intel.com>; dts@dpdk.org; Ma, LihongX > <lihongx.ma@intel.com> > Subject: RE: [dts] [PATCH V2 1/3] framework: check the python version > > So, checking python version > 3.6.0 is what you want to do? > > > > -----Original Message----- > > From: Tu, Lijuan > > Sent: Thursday, October 22, 2020 9:18 AM > > To: Mo, YufengX <yufengx.mo@intel.com>; dts@dpdk.org; Ma, LihongX > > <lihongx.ma@intel.com> > > Cc: Mo, YufengX <yufengx.mo@intel.com> > > Subject: RE: [dts] [PATCH V2 1/3] framework: check the python version > > > > DTS only support Python3 now, it doesn't support Python2. But it > > requires Python minus version. E.g. Python3.4 is not supported, it requires > version larger than 3.6x. > > > > > +def check_crb_python_version(crb): > > > + cmd = 'python3 -V' > > > > It seems you are telling python version for python 3. If you are using python3, > how can it tell you python2. > > > > > + 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: > > > + crb.logger.warning( > > > + ("WARNING: Tester node python version is lower than python 3, " > > > + "it is deprecated for use in DTS, " > > Python2 have been replaced by Python2 in DTS, so the message is not > reasonable. > > > > > + "and will not work in future releases.")) > > > + crb.logger.warning("Please use Python 3 instead") > > > + > > > + > > > +def check_dts_python_version(): > > > + if sys.version_info.major < 3: > > > + print(RED( > > > + ("WARNING: Dts running node python version is lower than python 3, > " > > > + "it is deprecated for use in DTS, " > > > + "and will not work in future releases.")), file=sys.stderr) > > > + print(RED("Please use Python 3 instead"), file=sys.stderr) > > > -- > > > 2.21.0
Lijuan and yufen The python3 version should >= 3.6.9 Regards, Ma,lihong > -----Original Message----- > From: Tu, Lijuan <lijuan.tu@intel.com> > Sent: Thursday, October 22, 2020 10:54 AM > To: Mo, YufengX <yufengx.mo@intel.com>; dts@dpdk.org; Ma, LihongX > <lihongx.ma@intel.com> > Subject: RE: [dts] [PATCH V2 1/3] framework: check the python version > > Hi Lihong, > Investigation of what's python version DTS support need to be completed > first. > > > -----Original Message----- > > From: Mo, YufengX <yufengx.mo@intel.com> > > Sent: 2020年10月22日 10:30 > > To: Tu, Lijuan <lijuan.tu@intel.com>; dts@dpdk.org; Ma, LihongX > > <lihongx.ma@intel.com> > > Subject: RE: [dts] [PATCH V2 1/3] framework: check the python version > > > > So, checking python version > 3.6.0 is what you want to do? > > > > > > > -----Original Message----- > > > From: Tu, Lijuan > > > Sent: Thursday, October 22, 2020 9:18 AM > > > To: Mo, YufengX <yufengx.mo@intel.com>; dts@dpdk.org; Ma, LihongX > > > <lihongx.ma@intel.com> > > > Cc: Mo, YufengX <yufengx.mo@intel.com> > > > Subject: RE: [dts] [PATCH V2 1/3] framework: check the python > > > version > > > > > > DTS only support Python3 now, it doesn't support Python2. But it > > > requires Python minus version. E.g. Python3.4 is not supported, it > > > requires > > version larger than 3.6x. > > > > > > > +def check_crb_python_version(crb): > > > > + cmd = 'python3 -V' > > > > > > It seems you are telling python version for python 3. If you are > > > using python3, > > how can it tell you python2. > > > > > > > + 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: > > > > + crb.logger.warning( > > > > + ("WARNING: Tester node python version is lower than > python 3, " > > > > + "it is deprecated for use in DTS, " > > > Python2 have been replaced by Python2 in DTS, so the message is not > > reasonable. > > > > > > > + "and will not work in future releases.")) > > > > + crb.logger.warning("Please use Python 3 instead") > > > > + > > > > + > > > > +def check_dts_python_version(): > > > > + if sys.version_info.major < 3: > > > > + print(RED( > > > > + ("WARNING: Dts running node python version is lower > > > > +than python 3, > > " > > > > + "it is deprecated for use in DTS, " > > > > + "and will not work in future releases.")), > file=sys.stderr) > > > > + print(RED("Please use Python 3 instead"), > > > > + file=sys.stderr) > > > > -- > > > > 2.21.0 >
diff --git a/framework/utils.py b/framework/utils.py index e74e6c5..371fe52 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,25 @@ 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: + crb.logger.warning( + ("WARNING: Tester node python version is lower than python 3, " + "it is deprecated for use in DTS, " + "and will not work in future releases.")) + crb.logger.warning("Please use Python 3 instead") + + +def check_dts_python_version(): + if sys.version_info.major < 3: + print(RED( + ("WARNING: Dts running node python version is lower than python 3, " + "it is deprecated for use in DTS, " + "and will not work in future releases.")), file=sys.stderr) + print(RED("Please use Python 3 instead"), file=sys.stderr)