From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: bob.c.feng@intel.com) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by groups.io with SMTP; Mon, 06 May 2019 20:53:42 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 May 2019 20:53:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,440,1549958400"; d="scan'208";a="140792606" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga008.jf.intel.com with ESMTP; 06 May 2019 20:53:41 -0700 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 6 May 2019 20:53:29 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 6 May 2019 20:53:29 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.129]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.18]) with mapi id 14.03.0415.000; Tue, 7 May 2019 11:53:19 +0800 From: "Bob Feng" To: "Fan, ZhijuX" , "devel@edk2.groups.io" CC: "Gao, Liming" Subject: Re: [PATCH] BaseTools:The code used to test python module is moved to edksetup Thread-Topic: [PATCH] BaseTools:The code used to test python module is moved to edksetup Thread-Index: AdT++qa6Qb/hWb3eRCKan8n3nqgOaAFja5Vg Date: Tue, 7 May 2019 03:53:18 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D16010465E@SHSMSX101.ccr.corp.intel.com> References: In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: bob.c.feng@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Bob Feng -----Original Message----- From: Fan, ZhijuX=20 Sent: Tuesday, April 30, 2019 10:16 AM To: devel@edk2.groups.io Cc: Gao, Liming ; Feng, Bob C Subject: [PATCH] BaseTools:The code used to test python module is moved to = edksetup BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=3D1582 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 Cc: Liming Gao Signed-off-by: Zhiju.Fan --- 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 inde= x 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 =20 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 } =20 +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 } =20 I=3D$# -- 2.14.1.windows.1