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>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
import os\r
import sys\r
import unittest\r
-\r
-try:\r
- import distutils.util\r
-except ModuleNotFoundError:\r
- sys.exit('''\r
-Python reported: "No module named 'distutils.util"\r
-''')\r
-\r
import TestTools\r
\r
def GetCTestSuite():\r
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=$#