#\r
# This file contained the logical of transfer package object to INF files.\r
#\r
-# Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2011 - 2017, 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
#\r
FileHeader = GenHeaderCommentSection(ModuleAbstract, ModuleDescription, ModuleCopyright, ModuleLicense, False, \\r
DT.TAB_COMMENT_EDK1_SPLIT)\r
- GenModuleUNIEncodeFile(ModuleObject, FileHeader)\r
+ ModuleUniFile = GenModuleUNIEncodeFile(ModuleObject, FileHeader)\r
+ if ModuleUniFile:\r
+ ModuleObject.SetModuleUniFile(os.path.basename(ModuleUniFile))\r
\r
#\r
# Judge whether the INF file is an AsBuild INF.\r
Content += GenGuidSections(ModuleObject.GetGuidList())\r
Content += GenBinaries(ModuleObject)\r
Content += GenDepex(ModuleObject)\r
- Content += GenUserExtensions(ModuleObject)\r
+ __UserExtensionsContent = GenUserExtensions(ModuleObject)\r
+ Content += __UserExtensionsContent\r
if ModuleObject.GetEventList() or ModuleObject.GetBootModeList() or ModuleObject.GetHobList():\r
Content += '\n'\r
#\r
# generate [Event], [BootMode], [Hob] section\r
#\r
- Content += GenSpecialSections(ModuleObject.GetEventList(), 'Event')\r
- Content += GenSpecialSections(ModuleObject.GetBootModeList(), 'BootMode')\r
- Content += GenSpecialSections(ModuleObject.GetHobList(), 'Hob')\r
+ Content += GenSpecialSections(ModuleObject.GetEventList(), 'Event', __UserExtensionsContent)\r
+ Content += GenSpecialSections(ModuleObject.GetBootModeList(), 'BootMode', __UserExtensionsContent)\r
+ Content += GenSpecialSections(ModuleObject.GetHobList(), 'Hob', __UserExtensionsContent)\r
SaveFileOnChange(ContainerFile, Content, False)\r
if DistHeader.ReadOnly:\r
os.chmod(ContainerFile, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH)\r
# TAB_INF_DEFINES_VERSION_STRING\r
if ModuleObject.UNIFlag:\r
Statement = (u'%s ' % DT.TAB_INF_DEFINES_MODULE_UNI_FILE).ljust(LeftOffset) + \\r
- u'= %s' % ModuleObject.GetBaseName() + '.uni'\r
+ u'= %s' % ModuleObject.GetModuleUniFile()\r
SpecialStatementList.append(Statement)\r
\r
# TAB_INF_DEFINES_MODULE_TYPE\r
if UserExtension.GetIdentifier() == 'Depex':\r
continue\r
Statement = UserExtension.GetStatement()\r
- if not Statement:\r
- continue\r
+# Comment the code to support user extension without any statement just the section header in []\r
+# if not Statement:\r
+# continue\r
ArchList = UserExtension.GetSupArchList()\r
for Index in xrange(0, len(ArchList)):\r
ArchList[Index] = ConvertArchForInstall(ArchList[Index])\r
# format of SourceFile|Family|TagName|ToolCode|FeatureFlag\r
#\r
Statement += SourceFile\r
- if TagName == None:\r
+ if TagName is None:\r
TagName = ''\r
- if ToolCode == None:\r
+ if ToolCode is None:\r
ToolCode = ''\r
- if HelpStr == None:\r
+ if HelpStr is None:\r
HelpStr = ''\r
if FeatureFlag:\r
Statement += '|' + Family + '|' + TagName + '|' + ToolCode + '|' + FeatureFlag\r
## GenSpecialSections\r
# generate special sections for Event/BootMode/Hob\r
#\r
-def GenSpecialSections(ObjectList, SectionName):\r
+def GenSpecialSections(ObjectList, SectionName, UserExtensionsContent=''):\r
#\r
# generate section\r
#\r
else:\r
assert(SectionName)\r
Usage = Obj.GetUsage()\r
+\r
+ # If the content already in UserExtensionsContent then ignore\r
+ if '[%s]' % SectionName in UserExtensionsContent and Type in UserExtensionsContent:\r
+ return ''\r
+\r
Statement = ' ' + Type + ' ## ' + Usage\r
if CommentStr in ['#\n', '#\n#\n']:\r
CommentStr = '#\n#\n#\n'\r