test suite reviews and discussions
 help / color / mirror / Atom feed
From: yufengmx <yufengx.mo@intel.com>
To: dts@dpdk.org, lihongx.ma@intel.com
Cc: yufengmx <yufengx.mo@intel.com>
Subject: [dts] [PATCH V2 1/3] framework: check the python version
Date: Wed, 14 Oct 2020 15:14:46 +0800	[thread overview]
Message-ID: <20201014071448.32119-2-yufengx.mo@intel.com> (raw)
In-Reply-To: <20201014071448.32119-1-yufengx.mo@intel.com>


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(+)

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)
-- 
2.21.0


  reply	other threads:[~2020-10-14  7:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-14  7:14 [dts] [PATCH V2 0/3] " yufengmx
2020-10-14  7:14 ` yufengmx [this message]
2020-10-22  1:18   ` [dts] [PATCH V2 1/3] " Tu, Lijuan
2020-10-22  2:30     ` Mo, YufengX
2020-10-22  2:53       ` Tu, Lijuan
2020-10-22  6:36         ` Ma, LihongX
2020-10-14  7:14 ` [dts] [PATCH V2 2/3] " yufengmx
2020-10-14  7:14 ` [dts] [PATCH V2 3/3] " yufengmx
2020-10-14  7:25   ` Ma, LihongX

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201014071448.32119-2-yufengx.mo@intel.com \
    --to=yufengx.mo@intel.com \
    --cc=dts@dpdk.org \
    --cc=lihongx.ma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).