From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: ching.jenx.cheng@intel.com) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by groups.io with SMTP; Thu, 01 Aug 2019 03:06:36 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Aug 2019 03:06:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,333,1559545200"; d="scan'208";a="371976422" Received: from unknown (HELO chingjex-MOBL.gar.corp.intel.com) ([10.5.244.32]) by fmsmga005.fm.intel.com with ESMTP; 01 Aug 2019 03:06:33 -0700 From: "Cheng, Ching JenX" To: devel@edk2.groups.io Cc: Amy Chan , Chasel Chiu , Nate DeSimone , Star Zeng Subject: [PATCH v2] * IntelFsp2Pkg: Improve FSP Python scripts to support 3.x. Date: Thu, 1 Aug 2019 18:07:01 +0800 Message-Id: <20190801100702.11484-1-ching.jenx.cheng@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=2041 [PATCH v2] Update commit message for more detail description When running with Python 3.x and relying on GenCfgOpt.py to automatically assign UPD offsets, the script crashed because some float type variable not compatible with the operations. Convert those float variable to int to fix these issues. Cc: Amy Chan Cc: Chasel Chiu Cc: Nate DeSimone Cc: Star Zeng Signed-off-by: Ching JenX Cheng --- IntelFsp2Pkg/Tools/GenCfgOpt.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/IntelFsp2Pkg/Tools/GenCfgOpt.py b/IntelFsp2Pkg/Tools/GenCfgOpt.py index a42717caae..2fa7582d85 100644 --- a/IntelFsp2Pkg/Tools/GenCfgOpt.py +++ b/IntelFsp2Pkg/Tools/GenCfgOpt.py @@ -715,7 +715,7 @@ EndList if (ConfigDict['embed'].find(':END') != -1): Remainder = Offset % (MaxAlign/8) # MaxAlign is either 32 or 64 if Remainder: - Diff = (MaxAlign/8) - Remainder + Diff = int((MaxAlign/8) - Remainder) Offset = Offset + Diff ItemOffset = ItemOffset + Diff MaxAlign = 32 # Reset to default 32 align when struct end @@ -727,7 +727,7 @@ EndList Remainder = Offset % max(ItemLength/8, 4, SizeAlign) Offset = Offset + ItemLength if Remainder: - Diff = max(ItemLength/8, 4, SizeAlign) - Remainder + Diff = int(max(ItemLength/8, 4, SizeAlign) - Remainder) ItemOffset = ItemOffset + Diff ConfigDict['offset'] = ItemOffset @@ -1416,7 +1416,7 @@ EndList if BitsRemain: BsfFd.write(" Skip %d bits\n" % BitsRemain) BitsGap -= BitsRemain - BytesRemain = BitsGap / 8 + BytesRemain = int(BitsGap / 8) if BytesRemain: BsfFd.write(" Skip %d bytes\n" % BytesRemain) NextOffset = Item['offset'] + Item['length'] -- 2.21.0.windows.1