]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/MkPkg.py
BaseTools: Replace StandardError with Expression
[mirror_edk2.git] / BaseTools / Source / Python / UPT / MkPkg.py
index b8b78e4515504c1492db461db0ba940fd9e6712a..e7ec328a78d9be0830c51fcd4bebd087c2dd7bfb 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # Install distribution package.\r
 #\r
-# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>\r
 #\r
 # This program and the accompanying materials are licensed and made available \r
 # under the terms and conditions of the BSD License which accompanies this \r
@@ -45,12 +45,12 @@ import Logger.Log as Logger
 from Xml.XmlParser import DistributionPackageXml\r
 from Xml.IniToXml import IniToXml\r
 \r
-from Library.Misc import CheckEnvVariable\r
 from Library import GlobalData\r
 from Library.ParserValidate import IsValidPath\r
 \r
 from Core.DistributionPackageClass import DistributionPackageClass\r
 from Core.PackageFile import PackageFile\r
+from Common.MultipleWorkspace import MultipleWorkspace as mws\r
 \r
 ## CheckForExistingDp\r
 #\r
@@ -73,12 +73,11 @@ def CheckForExistingDp(Path):
 #\r
 #\r
 def Main(Options = None):\r
-    if Options == None:\r
+    if Options is None:\r
         Logger.Error("\nMkPkg", OPTION_UNKNOWN_ERROR, ST.ERR_OPTION_NOT_FOUND)\r
     try:\r
         DataBase = GlobalData.gDB        \r
         ContentFileClosed = True\r
-        CheckEnvVariable()\r
         WorkspaceDir = GlobalData.gWORKSPACE\r
 \r
         #\r
@@ -138,7 +137,7 @@ def Main(Options = None):
                 # write().\r
                 #\r
                 FromFile = os.path.normpath(FileObject.GetURI()).encode('utf_8')\r
-                FileFullPath = os.path.normpath(os.path.join(WorkspaceDir, FromFile))\r
+                FileFullPath = mws.join(WorkspaceDir, FromFile)\r
                 if FileFullPath in RePkgDict:\r
                     (DpGuid, DpVersion, DpName, Repackage) = RePkgDict[FileFullPath]\r
                     if not Repackage:\r
@@ -185,7 +184,7 @@ def Main(Options = None):
                     DistPkg.Header.RePackage = True\r
           \r
         Cwd = getcwd()\r
-        chdir(WorkspaceDir)        \r
+        chdir(WorkspaceDir)\r
         ContentFile.PackFiles(FileList)\r
         chdir(Cwd)\r
         \r
@@ -214,7 +213,7 @@ def Main(Options = None):
         Logger.Quiet(ST.MSG_FINISH)\r
         ReturnCode = 0\r
 \r
-    except FatalError, XExcept:\r
+    except FatalError as XExcept:\r
         ReturnCode = XExcept.args[0]        \r
         if Logger.GetLevel() <= Logger.DEBUG_9:\r
             Logger.Quiet(ST.MSG_PYTHON_ON % \\r
@@ -266,7 +265,7 @@ def CheckFileList(QualifiedExt, FileList, ErrorStringExt, ErrorStringFullPath):
                          ErrorStringExt % Item)\r
         \r
         Item = os.path.normpath(Item)\r
-        Path = os.path.normpath(os.path.join(WorkspaceDir, Item))\r
+        Path = mws.join(WorkspaceDir, Item)\r
         if not os.path.exists(Path):\r
             Logger.Error("\nMkPkg", FILE_NOT_FOUND, ST.ERR_NOT_FOUND % Item)\r
         elif Item == Path:\r