From: Gary Lin <glin@suse.com>
To: edk2-devel@lists.01.org
Cc: Yonghong Zhu <yonghong.zhu@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: [PATCH v4 04/13] BaseTools: Remove the old python "not-equal"
Date: Mon, 25 Jun 2018 18:31:27 +0800 [thread overview]
Message-ID: <20180625103136.12531-5-glin@suse.com> (raw)
In-Reply-To: <20180625103136.12531-1-glin@suse.com>
Replace "<>" with "!=" to be compatible with python3.
Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
---
BaseTools/Source/Python/AutoGen/AutoGen.py | 2 +-
BaseTools/Source/Python/AutoGen/BuildEngine.py | 4 ++--
BaseTools/Source/Python/AutoGen/GenMake.py | 2 +-
BaseTools/Source/Python/Common/Misc.py | 2 +-
BaseTools/Source/Python/Ecc/Check.py | 14 +++++++-------
BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py | 6 +++---
BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py | 8 ++++----
BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py | 12 ++++++------
BaseTools/Source/Python/Workspace/DscBuildData.py | 2 +-
9 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index e268c4c0a1cf..d7485909414d 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -4233,7 +4233,7 @@ class ModuleAutoGen(AutoGen):
Dpx = GenDepex.DependencyExpression(self.DepexList[ModuleType], ModuleType, True)
DpxFile = gAutoGenDepexFileName % {"module_name" : self.Name}
- if len(Dpx.PostfixNotation) <> 0:
+ if len(Dpx.PostfixNotation) != 0:
self.DepexGenerated = True
if Dpx.Generate(path.join(self.OutputDir, DpxFile)):
diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Source/Python/AutoGen/BuildEngine.py
index d4daa3093761..cab4c993dc44 100644
--- a/BaseTools/Source/Python/AutoGen/BuildEngine.py
+++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py
@@ -362,8 +362,8 @@ class BuildRule:
self.RuleContent[Index] = Line
# find the build_rule_version
- if Line and Line[0] == "#" and Line.find(TAB_BUILD_RULE_VERSION) <> -1:
- if Line.find("=") <> -1 and Line.find("=") < (len(Line) - 1) and (Line[(Line.find("=") + 1):]).split():
+ if Line and Line[0] == "#" and Line.find(TAB_BUILD_RULE_VERSION) != -1:
+ if Line.find("=") != -1 and Line.find("=") < (len(Line) - 1) and (Line[(Line.find("=") + 1):]).split():
self._FileVersion = (Line[(Line.find("=") + 1):]).split()[0]
# skip empty or comment line
if Line == "" or Line[0] == "#":
diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py
index 48b66c570e0a..ea73de5fa55f 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -561,7 +561,7 @@ cleanlib:
# convert source files and binary files to build targets
self.ResultFileList = [str(T.Target) for T in self._AutoGenObject.CodaTargetList]
- if len(self.ResultFileList) == 0 and len(self._AutoGenObject.SourceFileList) <> 0:
+ if len(self.ResultFileList) == 0 and len(self._AutoGenObject.SourceFileList) != 0:
EdkLogger.error("build", AUTOGEN_ERROR, "Nothing to build",
ExtraData="[%s]" % str(self._AutoGenObject))
diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py
index 5197818d3f27..01171adb9b9e 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -1293,7 +1293,7 @@ def ParseDevPathValue (Value):
def ParseFieldValue (Value):
if type(Value) == type(0):
return Value, (Value.bit_length() + 7) / 8
- if type(Value) <> type(''):
+ if type(Value) != type(''):
raise BadExpression('Type %s is %s' %(Value, type(Value)))
Value = Value.strip()
if Value.startswith(TAB_UINT8) and Value.endswith(')'):
diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py
index dde7d7841082..ea739043e0bc 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -816,8 +816,8 @@ class Check(object):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_NO_USE, OtherMsg="The Library Class [%s] is not used in any platform" % (Record[1]), BelongsToTable='Inf', BelongsToItem=Record[0])
SqlCommand = """
select A.ID, A.Value1, A.BelongsToFile, A.StartLine, B.StartLine from Dsc as A left join Dsc as B
- where A.Model = %s and B.Model = %s and A.Scope1 = B.Scope1 and A.Scope2 = B.Scope2 and A.ID <> B.ID
- and A.Value1 = B.Value1 and A.Value2 <> B.Value2 and A.BelongsToItem = -1 and B.BelongsToItem = -1 and A.StartLine <> B.StartLine and B.BelongsToFile = A.BelongsToFile""" \
+ where A.Model = %s and B.Model = %s and A.Scope1 = B.Scope1 and A.Scope2 = B.Scope2 and A.ID != B.ID
+ and A.Value1 = B.Value1 and A.Value2 != B.Value2 and A.BelongsToItem = -1 and B.BelongsToItem = -1 and A.StartLine != B.StartLine and B.BelongsToFile = A.BelongsToFile""" \
% (MODEL_EFI_LIBRARY_CLASS, MODEL_EFI_LIBRARY_CLASS)
RecordSet = EccGlobalData.gDb.TblDsc.Exec(SqlCommand)
for Record in RecordSet:
@@ -903,7 +903,7 @@ class Check(object):
and A.Value1 = B.Value1
and A.Value2 = B.Value2
and A.Scope1 = B.Scope1
- and A.ID <> B.ID
+ and A.ID != B.ID
and A.Model = B.Model
and A.Enabled > -1
and B.Enabled > -1
@@ -1055,7 +1055,7 @@ class Check(object):
SqlCommand = """
select A.ID, A.Value3, A.BelongsToFile, B.BelongsToFile from %s as A, %s as B
where A.Value2 = 'FILE_GUID' and B.Value2 = 'FILE_GUID' and
- A.Value3 = B.Value3 and A.ID <> B.ID group by A.ID
+ A.Value3 = B.Value3 and A.ID != B.ID group by A.ID
""" % (Table.Table, Table.Table)
RecordSet = Table.Exec(SqlCommand)
for Record in RecordSet:
@@ -1215,7 +1215,7 @@ class Check(object):
SqlCommand = """
select A.ID, A.Value1 from %s as A, %s as B
where A.Model = %s and B.Model = %s
- and A.Value1 like B.Value1 and A.ID <> B.ID
+ and A.Value1 like B.Value1 and A.ID != B.ID
and A.Scope1 = B.Scope1
and A.Enabled > -1
and B.Enabled > -1
@@ -1239,8 +1239,8 @@ class Check(object):
SqlCommand = """
select A.ID, A.Value1, A.Value2 from %s as A, %s as B
where A.Model = %s and B.Model = %s
- and A.Value2 like B.Value2 and A.ID <> B.ID
- and A.Scope1 = B.Scope1 and A.Value1 <> B.Value1
+ and A.Value2 like B.Value2 and A.ID != B.ID
+ and A.Scope1 = B.Scope1 and A.Value1 != B.Value1
group by A.ID
""" % (Table.Table, Table.Table, Model, Model)
RecordSet = Table.Exec(SqlCommand)
diff --git a/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py b/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py
index 4f79d0f82967..11d11700ed99 100644
--- a/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py
+++ b/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py
@@ -118,7 +118,7 @@ if __name__ == '__main__':
sys.exit(1)
Version = Process.communicate()
- if Process.returncode <> 0:
+ if Process.returncode != 0:
print('ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH')
sys.exit(Process.returncode)
print(Version[0])
@@ -208,7 +208,7 @@ if __name__ == '__main__':
#
Process = subprocess.Popen('%s smime -sign -binary -signer "%s" -outform DER -md sha256 -certfile "%s"' % (OpenSslCommand, args.SignerPrivateCertFileName, args.OtherPublicCertFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
Signature = Process.communicate(input=FullInputFileBuffer)[0]
- if Process.returncode <> 0:
+ if Process.returncode != 0:
sys.exit(Process.returncode)
#
@@ -277,7 +277,7 @@ if __name__ == '__main__':
#
Process = subprocess.Popen('%s smime -verify -inform DER -content %s -CAfile %s' % (OpenSslCommand, args.OutputFileName, args.TrustedPublicCertFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
Process.communicate(input=args.SignatureBuffer)[0]
- if Process.returncode <> 0:
+ if Process.returncode != 0:
print('ERROR: Verification failed')
os.remove (args.OutputFileName)
sys.exit(Process.returncode)
diff --git a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
index 41bcaa0437c5..ca4f64864790 100644
--- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
+++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
@@ -80,7 +80,7 @@ if __name__ == '__main__':
sys.exit(1)
Version = Process.communicate()
- if Process.returncode <> 0:
+ if Process.returncode != 0:
print('ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH')
sys.exit(Process.returncode)
print(Version[0])
@@ -103,7 +103,7 @@ if __name__ == '__main__':
#
Process = subprocess.Popen('%s genrsa -out %s 2048' % (OpenSslCommand, Item.name), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
Process.communicate()
- if Process.returncode <> 0:
+ if Process.returncode != 0:
print('ERROR: RSA 2048 key generation failed')
sys.exit(Process.returncode)
@@ -125,7 +125,7 @@ if __name__ == '__main__':
#
Process = subprocess.Popen('%s rsa -in %s -modulus -noout' % (OpenSslCommand, Item), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
PublicKeyHexString = Process.communicate()[0].split('=')[1].strip()
- if Process.returncode <> 0:
+ if Process.returncode != 0:
print('ERROR: Unable to extract public key from private key')
sys.exit(Process.returncode)
PublicKey = ''
@@ -138,7 +138,7 @@ if __name__ == '__main__':
Process = subprocess.Popen('%s dgst -sha256 -binary' % (OpenSslCommand), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
Process.stdin.write (PublicKey)
PublicKeyHash = PublicKeyHash + Process.communicate()[0]
- if Process.returncode <> 0:
+ if Process.returncode != 0:
print('ERROR: Unable to extract SHA 256 hash of public key')
sys.exit(Process.returncode)
diff --git a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
index 2944b634fb7a..2e164c4a2da6 100644
--- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
+++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
@@ -101,7 +101,7 @@ if __name__ == '__main__':
sys.exit(1)
Version = Process.communicate()
- if Process.returncode <> 0:
+ if Process.returncode != 0:
print('ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH')
sys.exit(Process.returncode)
print(Version[0])
@@ -157,7 +157,7 @@ if __name__ == '__main__':
while len(PublicKeyHexString) > 0:
PublicKey = PublicKey + chr(int(PublicKeyHexString[0:2],16))
PublicKeyHexString=PublicKeyHexString[2:]
- if Process.returncode <> 0:
+ if Process.returncode != 0:
sys.exit(Process.returncode)
if args.MonotonicCountStr:
@@ -179,7 +179,7 @@ if __name__ == '__main__':
#
Process = subprocess.Popen('%s dgst -sha256 -sign "%s"' % (OpenSslCommand, args.PrivateKeyFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
Signature = Process.communicate(input=FullInputFileBuffer)[0]
- if Process.returncode <> 0:
+ if Process.returncode != 0:
sys.exit(Process.returncode)
#
@@ -202,14 +202,14 @@ if __name__ == '__main__':
#
# Verify that the Hash Type matches the expected SHA256 type
#
- if uuid.UUID(bytes_le = Header.HashType) <> EFI_HASH_ALGORITHM_SHA256_GUID:
+ if uuid.UUID(bytes_le = Header.HashType) != EFI_HASH_ALGORITHM_SHA256_GUID:
print('ERROR: unsupport hash GUID')
sys.exit(1)
#
# Verify the public key
#
- if Header.PublicKey <> PublicKey:
+ if Header.PublicKey != PublicKey:
print('ERROR: Public key in input file does not match public key from private key file')
sys.exit(1)
@@ -228,7 +228,7 @@ if __name__ == '__main__':
#
Process = subprocess.Popen('%s dgst -sha256 -prverify "%s" -signature %s' % (OpenSslCommand, args.PrivateKeyFileName, args.OutputFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
Process.communicate(input=FullInputFileBuffer)
- if Process.returncode <> 0:
+ if Process.returncode != 0:
print('ERROR: Verification failed')
os.remove (args.OutputFileName)
sys.exit(Process.returncode)
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 7f289c103fb9..a80c07bc1e55 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -2153,7 +2153,7 @@ class DscBuildData(PlatformBuildClassObject):
if DscBuildData.NeedUpdateOutput(OutputValueFile, PcdValueInitExe ,InputValueFile):
Command = PcdValueInitExe + ' -i %s -o %s' % (InputValueFile, OutputValueFile)
returncode, StdOut, StdErr = DscBuildData.ExecuteCommand (Command)
- if returncode <> 0:
+ if returncode != 0:
EdkLogger.warn('Build', COMMAND_FAILURE, 'Can not collect output from command: %s' % Command)
File = open (OutputValueFile, 'r')
--
2.17.1
next prev parent reply other threads:[~2018-06-25 10:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-25 10:31 [PATCH v4 00/20] BaseTools: One step toward python3 Gary Lin
2018-06-25 10:31 ` [PATCH v4 01/13] BaseTools: Fix a typo in ini.py Gary Lin
2018-06-25 10:31 ` [PATCH v4 02/13] BaseTools: Refactor python except statements Gary Lin
2018-06-25 10:31 ` [PATCH v4 03/13] BaseTools: Refactor python print statements Gary Lin
2018-06-25 10:31 ` Gary Lin [this message]
2018-06-25 10:31 ` [PATCH v4 05/13] BaseTools: Remove tuple parameter in python scripts Gary Lin
2018-06-25 10:31 ` [PATCH v4 06/13] BaseTools: Remove the deprecated hash_key() Gary Lin
2018-06-25 10:31 ` [PATCH v4 07/13] BaseTools: Replace StandardError with Expression Gary Lin
2018-06-25 10:31 ` [PATCH v4 08/13] BaseTools: Remove types.TypeType Gary Lin
2018-06-25 10:31 ` [PATCH v4 09/13] BaseTools: Refactor python raise statement Gary Lin
2018-06-25 10:31 ` [PATCH v4 10/13] BaseTools: Adjust the spaces around commas and colons Gary Lin
2018-06-25 10:31 ` [PATCH v4 11/13] BaseTools: Migrate to the new octal literal Gary Lin
2018-06-25 10:31 ` [PATCH v4 12/13] BaseTools: Fix old python2 idioms Gary Lin
2018-06-25 10:31 ` [PATCH v4 13/13] BaseTools: Replace StringIO.StringIO with io.BytesIO Gary Lin
2018-06-26 3:40 ` [PATCH v4 00/20] BaseTools: One step toward python3 Gary Lin
2018-06-26 4:48 ` Zhu, Yonghong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180625103136.12531-5-glin@suse.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox