## @file\r
# Install distribution package.\r
#\r
-# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2011 - 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
## CheckForExistingDp\r
#\r
# Check if there is a same name DP file existing\r
-# @param Path: The path to be checked \r
+# @param Path: The path to be checked\r
#\r
def CheckForExistingDp(Path):\r
if os.path.exists(Path):\r
#\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
+ DataBase = GlobalData.gDB\r
ContentFileClosed = True\r
WorkspaceDir = GlobalData.gWORKSPACE\r
\r
#\r
if not Options.PackFileToCreate:\r
Logger.Error("\nMkPkg", OPTION_UNKNOWN_ERROR, ST.ERR_OPTION_NOT_FOUND)\r
- \r
+\r
#\r
# Handle if the distribution package file already exists\r
#\r
# Check package file existing and valid\r
#\r
CheckFileList('.DEC', Options.PackageFileList, ST.ERR_INVALID_PACKAGE_NAME, ST.ERR_INVALID_PACKAGE_PATH)\r
- # \r
+ #\r
# Check module file existing and valid\r
#\r
CheckFileList('.INF', Options.ModuleFileList, ST.ERR_INVALID_MODULE_NAME, ST.ERR_INVALID_MODULE_PATH)\r
# Get list of files that installed with RePackage attribute available\r
#\r
RePkgDict = DataBase.GetRePkgDict()\r
- \r
- ContentFile = PackageFile(GlobalData.gCONTENT_FILE, "w") \r
+\r
+ ContentFile = PackageFile(GlobalData.gCONTENT_FILE, "w")\r
ContentFileClosed = False\r
- \r
+\r
#\r
# Add temp distribution header\r
#\r
\r
#\r
# add distribution level tool/misc files\r
- # before pack, current dir should be workspace dir, else the full \r
+ # before pack, current dir should be workspace dir, else the full\r
# path will be in the pack file\r
#\r
Cwd = getcwd()\r
FileList += MiscObject.GetFileList()\r
for FileObject in FileList:\r
#\r
- # If you have unicode file names, please convert them to byte \r
- # strings in your desired encoding before passing them to \r
+ # If you have unicode file names, please convert them to byte\r
+ # strings in your desired encoding before passing them to\r
# write().\r
#\r
FromFile = os.path.normpath(FileObject.GetURI()).encode('utf_8')\r
DistPkg.Header.RePackage = True\r
ContentFile.PackFile(FromFile)\r
chdir(Cwd)\r
- \r
- # \r
+\r
+ #\r
# Add init dp information\r
#\r
else:\r
DistPkg.Header.Name = 'Distribution Package'\r
DistPkg.Header.Guid = str(uuid4())\r
DistPkg.Header.Version = '1.0'\r
- \r
+\r
DistPkg.GetDistributionPackage(WorkspaceDir, Options.PackageFileList, \\r
Options.ModuleFileList)\r
FileList, MetaDataFileList = DistPkg.GetDistributionFileList()\r
for File in FileList + MetaDataFileList:\r
FileFullPath = os.path.normpath(os.path.join(WorkspaceDir, File))\r
#\r
- # check whether file was included in a distribution that can not \r
+ # check whether file was included in a distribution that can not\r
# be repackaged\r
#\r
if FileFullPath in RePkgDict:\r
)\r
else:\r
DistPkg.Header.RePackage = True\r
- \r
+\r
Cwd = getcwd()\r
chdir(WorkspaceDir)\r
ContentFile.PackFiles(FileList)\r
chdir(Cwd)\r
- \r
- Logger.Verbose(ST.MSG_COMPRESS_DISTRIBUTION_PKG) \r
- \r
+\r
+ Logger.Verbose(ST.MSG_COMPRESS_DISTRIBUTION_PKG)\r
+\r
ContentFile.Close()\r
ContentFileClosed = True\r
- \r
+\r
#\r
# Add Md5Sigature\r
#\r
# Add current Date\r
#\r
DistPkg.Header.Date = str(strftime("%Y-%m-%dT%H:%M:%S", localtime()))\r
- \r
+\r
#\r
# Finish final dp file\r
#\r
Logger.Quiet(ST.MSG_FINISH)\r
ReturnCode = 0\r
\r
- except FatalError, XExcept:\r
- ReturnCode = XExcept.args[0] \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
(python_version(), platform) + format_exc())\r
\r
\r
## CheckFileList\r
-# \r
+#\r
# @param QualifiedExt: QualifiedExt\r
# @param FileList: FileList\r
# @param ErrorStringExt: ErrorStringExt\r
if Ext.upper() != QualifiedExt.upper():\r
Logger.Error("\nMkPkg", OPTION_VALUE_INVALID, \\r
ErrorStringExt % Item)\r
- \r
+\r
Item = os.path.normpath(Item)\r
Path = mws.join(WorkspaceDir, Item)\r
if not os.path.exists(Path):\r
elif not IsValidPath(Item, WorkspaceDir):\r
Logger.Error("\nMkPkg", OPTION_VALUE_INVALID, \\r
ErrorStringExt % Item)\r
- \r
+\r
if not os.path.split(Item)[0]:\r
Logger.Error("\nMkPkg", OPTION_VALUE_INVALID, \\r
ST.ERR_INVALID_METAFILE_PATH % Item)\r