From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1A8FEA04B7; Wed, 14 Oct 2020 05:19:15 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E85321DBAA; Wed, 14 Oct 2020 05:19:13 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id BAF4E1DBA9 for ; Wed, 14 Oct 2020 05:19:12 +0200 (CEST) IronPort-SDR: TUE+k7kuQvTaowD5rkMm1D68F6qEu2+NtN8xX6vuHZAvFiaiHCPSF6xe963p2O4r/4TheYl24r IiCvcd61HHkw== X-IronPort-AV: E=McAfee;i="6000,8403,9773"; a="183536289" X-IronPort-AV: E=Sophos;i="5.77,373,1596524400"; d="scan'208";a="183536289" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2020 20:19:08 -0700 IronPort-SDR: Xzu56SnJUOdv74qnPjDj1Ayue8zi0e9o1GGOJ3Atbe+PBmlEQvbiwi/Utg0AzTLZHx+7eGQbEA QzaehogoN/8g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,373,1596524400"; d="scan'208";a="351354838" Received: from dpdk-moyufen06.sh.intel.com ([10.67.116.208]) by fmsmga002.fm.intel.com with ESMTP; 13 Oct 2020 20:19:08 -0700 From: yufengmx To: dts@dpdk.org, lihongx.ma@intel.com Cc: yufengmx Date: Wed, 14 Oct 2020 11:14:51 +0800 Message-Id: <20201014031451.31487-2-yufengx.mo@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20201014031451.31487-1-yufengx.mo@intel.com> References: <20201014031451.31487-1-yufengx.mo@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dts] [PATCH V1 1/1] 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 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/framework/utils.py b/framework/utils.py index e74e6c5..335090b 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,16 @@ def get_backtrace_object(file_name, obj_name): obj = getattr(frame.f_locals['self'], obj_name, None) return obj + + +def check_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: + print("WARNING: Test node is using Python 2, it is deprecated for use in DTS, and will not work in future releases.", file=sys.stderr) + print("Please use Python 3 instead", file=sys.stderr) + if sys.version_info.major < 3: + print("WARNING: Dts running node is using Python 2, it is deprecated for use in DTS, and will not work in future releases.", file=sys.stderr) + print("Please use Python 3 instead", file=sys.stderr) -- 2.21.0