From nobody Tue Feb 10 02:28:01 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1522194178980208.33334756828958; Tue, 27 Mar 2018 16:42:58 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2AA7821F85E6C; Tue, 27 Mar 2018 16:36:18 -0700 (PDT) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 97CC121E256AC for ; Tue, 27 Mar 2018 16:36:16 -0700 (PDT) Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2018 16:42:52 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga008.jf.intel.com with ESMTP; 27 Mar 2018 16:42:52 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.100; helo=mga07.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,368,1517904000"; d="scan'208";a="28995252" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Tue, 27 Mar 2018 16:42:44 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 1/4] BaseTools: remove irrelevant code X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Since PcdValue is a string, no need to test it's type() for string Also remove the block used if it's a list (which is never is) Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/Common/Expression.py | 55 ++------------------ 1 file changed, 5 insertions(+), 50 deletions(-) diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Sourc= e/Python/Common/Expression.py index 4f0f377f3788..b70f7da1233e 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -815,57 +815,12 @@ class ValueExpressionEx(ValueExpression): except BadExpression, Value: if self.PcdType in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BO= OLEAN']: PcdValue =3D PcdValue.strip() - if type(PcdValue) =3D=3D type('') and PcdValue.startswith(= '{') and PcdValue.endswith('}'): + if PcdValue.startswith('{') and PcdValue.endswith('}'): PcdValue =3D SplitPcdValueString(PcdValue[1:-1]) - if type(PcdValue) =3D=3D type([]): - TmpValue =3D 0 - Size =3D 0 - ValueType =3D '' - for Item in PcdValue: - Item =3D Item.strip() - if Item.startswith('UINT8'): - ItemSize =3D 1 - ValueType =3D 'UINT8' - elif Item.startswith('UINT16'): - ItemSize =3D 2 - ValueType =3D 'UINT16' - elif Item.startswith('UINT32'): - ItemSize =3D 4 - ValueType =3D 'UINT32' - elif Item.startswith('UINT64'): - ItemSize =3D 8 - ValueType =3D 'UINT64' - elif Item.startswith('"') or Item.startswith("'") = or Item.startswith('L'): - ItemSize =3D 0 - ValueType =3D 'VOID*' - else: - ItemSize =3D 0 - ValueType =3D 'UINT8' - Item =3D ValueExpressionEx(Item, ValueType, self._= Symb)(True) - - if ItemSize =3D=3D 0: - try: - tmpValue =3D int(Item, 16) if Item.upper()= .startswith('0X') else int(Item, 0) - if tmpValue > 255: - raise BadExpression("Byte array numbe= r %s should less than 0xFF." % Item) - except BadExpression, Value: - raise BadExpression(Value) - except ValueError: - pass - ItemValue, ItemSize =3D ParseFieldValue(Item) - else: - ItemValue =3D ParseFieldValue(Item)[0] - - if type(ItemValue) =3D=3D type(''): - ItemValue =3D int(ItemValue, 16) if ItemValue.= startswith('0x') else int(ItemValue) - - TmpValue =3D (ItemValue << (Size * 8)) | TmpValue - Size =3D Size + ItemSize - else: - try: - TmpValue, Size =3D ParseFieldValue(PcdValue) - except BadExpression, Value: - raise BadExpression("Type: %s, Value: %s, %s" % (s= elf.PcdType, PcdValue, Value)) + try: + TmpValue, Size =3D ParseFieldValue(PcdValue) + except BadExpression, Value: + raise BadExpression("Type: %s, Value: %s, %s" % (self.= PcdType, PcdValue, Value)) if type(TmpValue) =3D=3D type(''): try: TmpValue =3D int(TmpValue) --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel