BaseTools: Fix string concatenation

Using Python 3.7.2 on win32, when printing a FileBuildRule
instance, the following error occurs:
File "edk2\BaseTools\Source\Python\AutoGen\BuildEngine.py",
line 177, in __str__
  DestString = ", ".join(self.DestFileList)
  TypeError: sequence item 0: expected str instance, PathClass found

This patch converts each PathClass element of the list to a string
instance before concatenating them.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>

Reviewed-by: Bob Feng <bob.c.feng@intel.com>
This commit is contained in:
Pierre Gondois 2020-07-01 22:06:04 +08:00 committed by mergify[bot]
parent 0a4aa20e8d
commit 0622a7b1b2
1 changed files with 1 additions and 1 deletions

View File

@ -172,7 +172,7 @@ class FileBuildRule:
def __str__(self): def __str__(self):
SourceString = "" SourceString = ""
SourceString += " %s %s %s" % (self.SourceFileType, " ".join(self.SourceFileExtList), self.ExtraSourceFileList) SourceString += " %s %s %s" % (self.SourceFileType, " ".join(self.SourceFileExtList), self.ExtraSourceFileList)
DestString = ", ".join(self.DestFileList) DestString = ", ".join([str(i) for i in self.DestFileList])
CommandString = "\n\t".join(self.CommandList) CommandString = "\n\t".join(self.CommandList)
return "%s : %s\n\t%s" % (DestString, SourceString, CommandString) return "%s : %s\n\t%s" % (DestString, SourceString, CommandString)