From patchwork Fri Oct 23 07:09:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yufen.Mo" X-Patchwork-Id: 81864 Return-Path: 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 A9E56A04DE; Fri, 23 Oct 2020 09:14:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6558E6CBF; Fri, 23 Oct 2020 09:14:38 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 8C87A6C98 for ; Fri, 23 Oct 2020 09:14:36 +0200 (CEST) IronPort-SDR: MfuIGqpaFZZh6NbnhzCQbS1z6ozDLwXDnPnkx5qjxM0+NhyXQ5lxhbS9opkeX85bUGaPyrI1+i Aa8Bw+JAQtSA== X-IronPort-AV: E=McAfee;i="6000,8403,9782"; a="229272902" X-IronPort-AV: E=Sophos;i="5.77,407,1596524400"; d="scan'208";a="229272902" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Oct 2020 00:14:31 -0700 IronPort-SDR: swxl24slrmPq6kt+94WIaCLSJd3bXqYAkEXBo4XUu3odzHXAOgC2T7Q88lX8o5LbYYrCfLi2C2 KkS7HW9Sx5Qw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,407,1596524400"; d="scan'208";a="321645527" Received: from dpdk-moyufen06.sh.intel.com ([10.67.116.208]) by orsmga006.jf.intel.com with ESMTP; 23 Oct 2020 00:14:30 -0700 From: yufengmx To: dts@dpdk.org, lijuan.tu@intel.com, lihongx.ma@intel.com Cc: yufengmx Date: Fri, 23 Oct 2020 15:09:57 +0800 Message-Id: <20201023070959.32951-2-yufengx.mo@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20201023070959.32951-1-yufengx.mo@intel.com> References: <20201023070959.32951-1-yufengx.mo@intel.com> MIME-Version: 1.0 Subject: [dts] [PATCH V3 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" 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 --- framework/utils.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/framework/utils.py b/framework/utils.py index e74e6c5..9082e35 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][1]) < 6 or \ + 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.minor < 6 or \ + 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)