BaseTools/Source/Python/build/build.py:
authorjljusten <jljusten@7335b38e-4728-0410-8992-fb3ffe349368>
Mon, 29 Oct 2007 07:14:25 +0000 (07:14 +0000)
committerjljusten <jljusten@7335b38e-4728-0410-8992-fb3ffe349368>
Mon, 29 Oct 2007 07:14:25 +0000 (07:14 +0000)
BaseTools/Source/Python/AutoGen/AutoGen.py:
  Changes for python on unix.  Subprocess.Popen on unix requires
  a tuple to send parameters to the command.

git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@858 7335b38e-4728-0410-8992-fb3ffe349368

Source/Python/AutoGen/AutoGen.py
Source/Python/build/build.py

index 9344785..fa4f69e 100755 (executable)
@@ -251,16 +251,18 @@ class PlatformAutoGen:
             Arch = [Arch]\r
         else:\r
             Arch = self.ArchList\r
             Arch = [Arch]\r
         else:\r
             Arch = self.ArchList\r
-        CommandString = ""\r
+        Command = tuple()\r
         for A in Arch:\r
             if A in self.BuildInfo and "MAKE" in self.BuildInfo[A].ToolPath:\r
         for A in Arch:\r
             if A in self.BuildInfo and "MAKE" in self.BuildInfo[A].ToolPath:\r
-                CommandString = self.BuildInfo[A].ToolPath["MAKE"]\r
+                Command += (self.BuildInfo[A].ToolPath["MAKE"],)\r
                 if "MAKE" in self.BuildInfo[A].ToolOption:\r
                 if "MAKE" in self.BuildInfo[A].ToolOption:\r
-                    CommandString = CommandString + " " + self.BuildInfo[A].ToolOption["MAKE"]\r
+                    newOption = self.BuildInfo[A].ToolOption["MAKE"].strip()\r
+                    if newOption != '':\r
+                      Command += (newOption,)\r
                 break\r
                 break\r
-        if CommandString == "":\r
+        if len(Command) == 0:\r
             EdkLogger.error("AutoGen", OPTION_MISSING, "No MAKE command defined. Please check your tools_def.txt!")\r
             EdkLogger.error("AutoGen", OPTION_MISSING, "No MAKE command defined. Please check your tools_def.txt!")\r
-        return CommandString\r
+        return Command\r
 \r
     ## Parse build_rule.txt in $(WORKSPACE)/Conf/build_rule.txt\r
     #\r
 \r
     ## Parse build_rule.txt in $(WORKSPACE)/Conf/build_rule.txt\r
     #\r
index 6db895e..b48eb57 100644 (file)
@@ -71,14 +71,11 @@ def CheckEnvVariable():
         EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "Please set environment variable: PATH!\n")\r
 \r
     PathString = os.environ["PATH"]\r
         EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "Please set environment variable: PATH!\n")\r
 \r
     PathString = os.environ["PATH"]\r
-    if sys.platform == "win32":\r
-        ToolPath = os.path.normpath(os.path.join(os.environ["EDK_TOOLS_PATH"], "Bin\\Win32"))\r
-    elif sys.platform == "win64":\r
-        ToolPath = os.path.normpath(os.path.join(os.environ["EDK_TOOLS_PATH"], "Bin\\Win64"))\r
-    else:\r
-        ToolPath = os.path.normpath(os.path.join(os.environ["EDK_TOOLS_PATH"], "Bin/Linux"))\r
+    ToolPath = os.path.normpath(os.path.join(os.environ["EDK_TOOLS_PATH"], 'Bin', sys.platform.title()))\r
 \r
     if PathString.find(ToolPath) == -1:\r
 \r
     if PathString.find(ToolPath) == -1:\r
+        os.environ['PATH'] = os.path.pathsep.join((os.environ['PATH'], ToolPath))\r
+            \r
         EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "Please execute %s to set %s in environment variable: PATH!\n"\r
                             % (os.path.normpath(os.path.join(PathString, 'edksetup.bat')), ToolPath))\r
 \r
         EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "Please execute %s to set %s in environment variable: PATH!\n"\r
                             % (os.path.normpath(os.path.join(PathString, 'edksetup.bat')), ToolPath))\r
 \r
@@ -845,10 +842,10 @@ class Build():
 \r
         EdkLogger.info("")\r
         BuildCommand = AutoGenResult.GetBuildCommand()\r
 \r
         EdkLogger.info("")\r
         BuildCommand = AutoGenResult.GetBuildCommand()\r
-        if BuildCommand == None or BuildCommand == "":\r
+        if BuildCommand == None or len(BuildCommand) == 0:\r
             EdkLogger.error("build", OPTION_MISSING, ExtraData="No MAKE command found for [%s, %s, %s]" % Key)\r
 \r
             EdkLogger.error("build", OPTION_MISSING, ExtraData="No MAKE command found for [%s, %s, %s]" % Key)\r
 \r
-        BuildCommand = "%s %s" % (BuildCommand, Target)\r
+        BuildCommand = BuildCommand + (Target,)\r
         LaunchCommand(BuildCommand, os.path.join(self.WorkspaceDir, AutoGenResult.GetMakeFileDir()))\r
 \r
     ## Build active platform for different build targets and different tool chains\r
         LaunchCommand(BuildCommand, os.path.join(self.WorkspaceDir, AutoGenResult.GetMakeFileDir()))\r
 \r
     ## Build active platform for different build targets and different tool chains\r