]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/ReplacePkg.py
BaseTools: Clean up source files
[mirror_edk2.git] / BaseTools / Source / Python / UPT / ReplacePkg.py
index efbf68a4ecc638a6b350d1c5268be9dfd672fe27..9531eb53e91737ed26839bdccb6bae830df3c4a6 100644 (file)
@@ -1,11 +1,11 @@
 ## @file\r
 # Replace distribution package.\r
 #\r
-# Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2014 - 2018, 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
-# distribution. The full text of the license may be found at \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
+# distribution. The full text of the license may be found at\r
 # http://opensource.org/licenses/bsd-license.php\r
 #\r
 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
@@ -51,27 +51,27 @@ def Main(Options = None):
         WorkspaceDir = GlobalData.gWORKSPACE\r
         Dep = DependencyRules(DataBase)\r
         DistPkg, ContentZipFile, DpPkgFileName, DistFile = UnZipDp(WorkspaceDir, Options.PackFileToReplace)\r
-        \r
+\r
         StoredDistFile, OrigDpGuid, OrigDpVersion = GetInstalledDpInfo(Options.PackFileToBeReplaced, \\r
                                                                        Dep, DataBase, WorkspaceDir)\r
-        \r
+\r
         #\r
         # check dependency\r
         #\r
         CheckReplaceDpx(Dep, DistPkg, OrigDpGuid, OrigDpVersion)\r
-        \r
+\r
         #\r
         # Remove the old distribution\r
         #\r
         RemoveDist(OrigDpGuid, OrigDpVersion, StoredDistFile, DataBase, WorkspaceDir, Options.Yes)\r
-        \r
+\r
         #\r
         # Install the new distribution\r
         #\r
         InstallDp(DistPkg, DpPkgFileName, ContentZipFile, Options, Dep, WorkspaceDir, DataBase)\r
         ReturnCode = 0\r
-        \r
-    except FatalError, XExcept:\r
+\r
+    except FatalError as XExcept:\r
         ReturnCode = XExcept.args[0]\r
         if Logger.GetLevel() <= Logger.DEBUG_9:\r
             Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(),\r
@@ -102,11 +102,11 @@ def Main(Options = None):
         for TempDir in GlobalData.gUNPACK_DIR:\r
             rmtree(TempDir)\r
         GlobalData.gUNPACK_DIR = []\r
-        Logger.Quiet(ST.MSG_REMOVE_TEMP_FILE_DONE)        \r
+        Logger.Quiet(ST.MSG_REMOVE_TEMP_FILE_DONE)\r
 \r
     if ReturnCode == 0:\r
         Logger.Quiet(ST.MSG_FINISH)\r
-    \r
+\r
     return ReturnCode\r
 \r
 def CheckReplaceDpx(Dep, DistPkg, OrigDpGuid, OrigDpVersion):\r
@@ -125,18 +125,18 @@ def CheckReplaceDpx(Dep, DistPkg, OrigDpGuid, OrigDpVersion):
         if Dep.CheckDpExists(DistPkg.Header.GetGuid(), DistPkg.Header.GetVersion()):\r
             Logger.Error("\nReplacePkg", UPT_ALREADY_INSTALLED_ERROR,\r
                 ST.WRN_DIST_PKG_INSTALLED,\r
-                ExtraData=ST.MSG_REPLACE_ALREADY_INSTALLED_DP)    \r
+                ExtraData=ST.MSG_REPLACE_ALREADY_INSTALLED_DP)\r
 \r
     #\r
     # check whether the original distribution could be replaced by new distribution\r
-    #    \r
+    #\r
     Logger.Verbose(ST.MSG_CHECK_DP_FOR_REPLACE%(NewDpInfo, OrigDpInfo))\r
     DepInfoResult = Dep.CheckDpDepexForReplace(OrigDpGuid, OrigDpVersion, NewDpPkgList)\r
     Replaceable = DepInfoResult[0]\r
     if not Replaceable:\r
         Logger.Error("\nReplacePkg", UNKNOWN_ERROR,\r
             ST.ERR_PACKAGE_NOT_MATCH_DEPENDENCY)\r
-    \r
+\r
     #\r
     # check whether new distribution could be installed by dependency rule\r
     #\r