test suite reviews and discussions
 help / color / Atom feed
* [dts] [PATCH V1 0/1] framework: check the python version
@ 2020-10-14  3:14 yufengmx
  2020-10-14  3:14 ` [dts] [PATCH V1 1/1] " yufengmx
  0 siblings, 1 reply; 2+ messages in thread
From: yufengmx @ 2020-10-14  3:14 UTC (permalink / raw)
  To: dts, lihongx.ma; +Cc: yufengmx


v1: 
 - 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. 

yufengmx (1):
  framework: check the python version

 framework/utils.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [dts] [PATCH V1 1/1] framework: check the python version
  2020-10-14  3:14 [dts] [PATCH V1 0/1] framework: check the python version yufengmx
@ 2020-10-14  3:14 ` " yufengmx
  0 siblings, 0 replies; 2+ messages in thread
From: yufengmx @ 2020-10-14  3:14 UTC (permalink / raw)
  To: dts, lihongx.ma; +Cc: yufengmx


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14  3:14 [dts] [PATCH V1 0/1] framework: check the python version yufengmx
2020-10-14  3:14 ` [dts] [PATCH V1 1/1] " yufengmx

test suite reviews and discussions

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/dts/0 dts/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dts dts/ http://inbox.dpdk.org/dts \
		dts@dpdk.org
	public-inbox-index dts


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dts


AGPL code for this site: git clone https://public-inbox.org/ public-inbox