public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Liming Gao <liming.gao@intel.com>
To: edk2-devel@lists.01.org
Cc: Yonghong Zhu <yonghong.zhu@intel.com>,
	Michael Kinney <michael.d.kinney@intel.com>,
	Erik Bjorge <erik.c.bjorge@intel.com>
Subject: [Patch 2/4] BaseTools: Update python tool to call external tools with shell true mode
Date: Tue, 13 Sep 2016 00:03:28 +0800	[thread overview]
Message-ID: <1473696210-6264-3-git-send-email-liming.gao@intel.com> (raw)
In-Reply-To: <1473696210-6264-1-git-send-email-liming.gao@intel.com>

Python tool may run from source as the dos batch files. So, update python
code to call external tools with shell true mode.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
 BaseTools/Source/Python/Common/VpdInfoFile.py | 7 ++++---
 BaseTools/Source/Python/build/build.py        | 5 ++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py b/BaseTools/Source/Python/Common/VpdInfoFile.py
index cc79ee2..d45fb4c 100644
--- a/BaseTools/Source/Python/Common/VpdInfoFile.py
+++ b/BaseTools/Source/Python/Common/VpdInfoFile.py
@@ -233,14 +233,15 @@ def CallExtenalBPDGTool(ToolPath, VpdFileName):
     OutputBinFileName = os.path.join(OutputDir, "%s.bin" % BaseName)
           
     try:
-        PopenObject = subprocess.Popen([ToolPath,
+        PopenObject = subprocess.Popen(' '.join([ToolPath,
                                         '-o', OutputBinFileName, 
                                         '-m', OutputMapFileName,
                                         '-q',
                                         '-f',
-                                        VpdFileName],
+                                        VpdFileName]),
                                         stdout=subprocess.PIPE, 
-                                        stderr= subprocess.PIPE)
+                                        stderr= subprocess.PIPE,
+                                        shell=True)
     except Exception, X:
         EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, ExtraData="%s" % (str(X)))
     (out, error) = PopenObject.communicate()
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index be02119..20f726f 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -266,14 +266,13 @@ def LaunchCommand(Command, WorkingDir):
     # ubuntu may fail with an error message that the command is not found.
     # So here we may need convert command from string to list instance.
     if not isinstance(Command, list):
-        if platform.system() != 'Windows':
-            Command = Command.split()
+        Command = Command.split()
 
     Proc = None
     EndOfProcedure = None
     try:
         # launch the command
-        Proc = Popen(Command, stdout=PIPE, stderr=PIPE, env=os.environ, cwd=WorkingDir, bufsize=-1)
+        Proc = Popen(' '.join(Command), stdout=PIPE, stderr=PIPE, env=os.environ, cwd=WorkingDir, bufsize=-1, shell=True)
 
         # launch two threads to read the STDOUT and STDERR
         EndOfProcedure = Event()
-- 
2.8.0.windows.1



  parent reply	other threads:[~2016-09-12 16:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-12 16:03 [Patch 0/4] Add support for running python tools from source on Windows Liming Gao
2016-09-12 16:03 ` [Patch 1/4] BaseTools: Add Windows batch files to run python tool from Source Liming Gao
2016-09-12 23:59   ` Bjorge, Erik C
2016-09-12 16:03 ` Liming Gao [this message]
2016-09-13  0:00   ` [Patch 2/4] BaseTools: Update python tool to call external tools with shell true mode Bjorge, Erik C
2016-09-12 16:03 ` [Patch 3/4] BaseTools: Update Python Makefile not to depend on PYTHON_FREEZER_PATH Liming Gao
2016-09-13  0:00   ` Bjorge, Erik C
2016-09-12 16:03 ` [Patch 4/4] BaseTools: Update toolsetup.bat to set PYTHONPATH env to run python source Liming Gao
2016-09-13  0:13   ` Bjorge, Erik C
2016-09-21  2:50 ` [Patch 0/4] Add support for running python tools from source on Windows Zhu, Yonghong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1473696210-6264-3-git-send-email-liming.gao@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox