]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/BuildEnv.py
Make scripts work from $WORKSPACE/BaseTools.
[mirror_edk2.git] / BaseTools / BuildEnv.py
index 7ce9798bbd8572a11c307567edf763ee0d929a15..98b5ca1f457d34995c8c35a3b70668d52929ca25 100755 (executable)
@@ -65,7 +65,7 @@ class SetupBuildEnvironmentApp:
       }\r
 \r
   def ProcessCommandLine(self):\r
-    Parser = OptionParser(description=__copyright__,version=__version__,prog="Tools/BuildEnv")\r
+    Parser = OptionParser(description=__copyright__,version=__version__,prog="BaseTools/BuildEnv")\r
     Parser.add_option("-q", "--quiet", action="store_true", type=None, help="Disable all messages except FATAL ERRORS.")\r
     Parser.add_option("-v", "--verbose", action="store_true", type=None, help="Turn on verbose output with informational messages printed, "\\r
                                                                                "including library instances selected, final dependency expression, "\\r
@@ -198,13 +198,15 @@ class SetupBuildEnvironmentApp:
     todo = self.conf['templates and Conf directory']\r
     workspace = os.path.realpath(self.Opt.workspace)\r
     templatesDir = \\r
-      os.path.join(workspace, 'Tools', 'BaseTools', 'ConfTemplates', sys.platform.title())\r
+      os.path.join(workspace, 'BaseTools', 'ConfTemplates', sys.platform.title())\r
     confDir = \\r
       os.path.join(workspace, 'Conf')\r
     print\r
     print 'Templates & Conf directory'\r
     print '  Templates dir:', self.RelativeToWorkspace(templatesDir)\r
     for filename in os.listdir(templatesDir):\r
+      if filename.startswith('.'): continue\r
+\r
       srcFilename = os.path.join(templatesDir, filename)\r
       destFilename = os.path.join(confDir, filename)\r
       print ' ', self.RelativeToWorkspace(destFilename),\r
@@ -242,9 +244,28 @@ class SetupBuildEnvironmentApp:
     print 'Storing environment configuration into',\r
     print   self.RelativeToWorkspace(scriptFilename)\r
     script = open(scriptFilename, 'w')\r
+\r
     print >> script, 'export WORKSPACE="%s"' % workspace\r
     print >> script, 'export TOOLCHAIN="%s"' % self.conf['compiler']\r
     print >> script, 'export EDK_CC_PATH_PREFIX="%s"' % self.conf['compiler-prefix']\r
+\r
+    EDK_TOOLS_PATH = os.path.join(workspace, 'BaseTools')\r
+    print >> script, 'if [ $EDK_TOOLS_PATH=="" ]'\r
+    print >> script, 'then'\r
+    print >> script, '  export EDK_TOOLS_PATH="%s"' % EDK_TOOLS_PATH\r
+    print >> script, 'fi'\r
+\r
+    #\r
+    # Change PATH variable\r
+    #\r
+    newPath = os.environ['PATH'].split(os.path.pathsep)\r
+    binDir = \\r
+      os.path.join(workspace, 'BaseTools', 'Bin', sys.platform.title())\r
+    if binDir not in newPath:\r
+      newPath.append(binDir)\r
+    newPath = os.path.pathsep.join(newPath)\r
+    print >> script, 'export PATH=%s' % newPath\r
+\r
     script.close()\r
 \r
   def RelativeToWorkspace(self, path):\r