public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] BaseTools:The code used to test python module is moved to edksetup
@ 2019-04-30  2:16 Fan, ZhijuX
  2019-05-07  3:53 ` Bob Feng
  0 siblings, 1 reply; 4+ messages in thread
From: Fan, ZhijuX @ 2019-04-30  2:16 UTC (permalink / raw)
  To: devel@edk2.groups.io; +Cc: Gao, Liming, Feng, Bob C

[-- Attachment #1: Type: text/plain, Size: 1556 bytes --]

BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1582

testing for presence of python modules should be done in edksetup
to reduce impact on subsequent build times.
This code currently exists in BaseTools/Tests/RunTest.py.

This patch is going to fix this issue.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
---
 BaseTools/Tests/RunTests.py |  8 --------
 edksetup.sh                 | 15 +++++++++++++--
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/BaseTools/Tests/RunTests.py b/BaseTools/Tests/RunTests.py
index 81af736cd8..e8acf1b348 100644
--- a/BaseTools/Tests/RunTests.py
+++ b/BaseTools/Tests/RunTests.py
@@ -12,14 +12,6 @@
 import os
 import sys
 import unittest
-
-try:
-    import distutils.util
-except ModuleNotFoundError:
-    sys.exit('''
-Python reported: "No module named 'distutils.util"
-''')
-
 import TestTools
 
 def GetCTestSuite():
diff --git a/edksetup.sh b/edksetup.sh
index c7b2e1e201..add18ca7c0 100755
--- a/edksetup.sh
+++ b/edksetup.sh
@@ -177,11 +177,22 @@ function SetupPython()
   SetupPython3
 }
 
+function TestUtilModule()
+{
+  if ( $PYTHON_COMMAND -c "import distutils.util" >/dev/null 2>&1 );then
+    return 1
+  else
+    echo Error: "No module named 'distutils.util"
+    return 0
+  fi
+}
+
 function SourceEnv()
 {
   SetWorkspace &&
-  SetupEnv
-  SetupPython
+  SetupEnv &&
+  SetupPython &&
+  TestUtilModule
 }
 
 I=$#
-- 
2.14.1.windows.1


[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 4111 bytes --]

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

end of thread, other threads:[~2019-05-08 11:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-30  2:16 [PATCH] BaseTools:The code used to test python module is moved to edksetup Fan, ZhijuX
2019-05-07  3:53 ` Bob Feng
2019-05-08 11:38   ` [edk2-devel] " Leif Lindholm
2019-05-08 11:45     ` Leif Lindholm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox