Skip to content

Commit

Permalink
BaseTools:The code used to test python module is moved to edksetup
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Liming Gao <[email protected]>
Signed-off-by: Zhiju.Fan <[email protected]>
Reviewed-by: Bob Feng <[email protected]>
  • Loading branch information
zhijufan authored and BobCF committed May 8, 2019
1 parent 26e2b29 commit df7c81b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
8 changes: 0 additions & 8 deletions BaseTools/Tests/RunTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
15 changes: 13 additions & 2 deletions edksetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=$#
Expand Down

0 comments on commit df7c81b

Please sign in to comment.