]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Remove the old python "not-equal"
authorGary Lin <glin@suse.com>
Mon, 25 Jun 2018 10:31:27 +0000 (18:31 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Wed, 27 Jun 2018 08:33:22 +0000 (16:33 +0800)
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>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
BaseTools/Source/Python/AutoGen/AutoGen.py
BaseTools/Source/Python/AutoGen/BuildEngine.py
BaseTools/Source/Python/AutoGen/GenMake.py
BaseTools/Source/Python/Common/Misc.py
BaseTools/Source/Python/Ecc/Check.py
BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py
BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
BaseTools/Source/Python/Workspace/DscBuildData.py

index e268c4c0a1cfa41bb298196cec4aa2a308960f92..d7485909414de25e22f44fba64bd117b32431a81 100644 (file)
@@ -4233,7 +4233,7 @@ class ModuleAutoGen(AutoGen):
             Dpx = GenDepex.DependencyExpression(self.DepexList[ModuleType], ModuleType, True)\r
             DpxFile = gAutoGenDepexFileName % {"module_name" : self.Name}\r
 \r
-            if len(Dpx.PostfixNotation) <> 0:\r
+            if len(Dpx.PostfixNotation) != 0:\r
                 self.DepexGenerated = True\r
 \r
             if Dpx.Generate(path.join(self.OutputDir, DpxFile)):\r
index d4daa309376173e405d75bf5e012522d2b1f461e..cab4c993dc4485e61bb4555dcd2cb3eeb168e725 100644 (file)
@@ -362,8 +362,8 @@ class BuildRule:
             self.RuleContent[Index] = Line\r
             \r
             # find the build_rule_version\r
-            if Line and Line[0] == "#" and Line.find(TAB_BUILD_RULE_VERSION) <> -1:\r
-                if Line.find("=") <> -1 and Line.find("=") < (len(Line) - 1) and (Line[(Line.find("=") + 1):]).split():\r
+            if Line and Line[0] == "#" and Line.find(TAB_BUILD_RULE_VERSION) != -1:\r
+                if Line.find("=") != -1 and Line.find("=") < (len(Line) - 1) and (Line[(Line.find("=") + 1):]).split():\r
                     self._FileVersion = (Line[(Line.find("=") + 1):]).split()[0]\r
             # skip empty or comment line\r
             if Line == "" or Line[0] == "#":\r
index 48b66c570e0a86d6ae0612f799e97aca7792639e..ea73de5fa55fb68ee402099e8b95c8cb09b6f8b8 100644 (file)
@@ -561,7 +561,7 @@ cleanlib:
 \r
         # convert source files and binary files to build targets\r
         self.ResultFileList = [str(T.Target) for T in self._AutoGenObject.CodaTargetList]\r
-        if len(self.ResultFileList) == 0 and len(self._AutoGenObject.SourceFileList) <> 0:\r
+        if len(self.ResultFileList) == 0 and len(self._AutoGenObject.SourceFileList) != 0:\r
             EdkLogger.error("build", AUTOGEN_ERROR, "Nothing to build",\r
                             ExtraData="[%s]" % str(self._AutoGenObject))\r
 \r
index 5197818d3f27e80995bc7c9234ad08486974b943..01171adb9b9e49754f0163873ae4d8feefe997c1 100644 (file)
@@ -1293,7 +1293,7 @@ def ParseDevPathValue (Value):
 def ParseFieldValue (Value):\r
     if type(Value) == type(0):\r
         return Value, (Value.bit_length() + 7) / 8\r
-    if type(Value) <> type(''):\r
+    if type(Value) != type(''):\r
         raise BadExpression('Type %s is %s' %(Value, type(Value)))\r
     Value = Value.strip()\r
     if Value.startswith(TAB_UINT8) and Value.endswith(')'):\r
index dde7d784108280988f6c99fd3fcb817a0e6c7ddf..ea739043e0bca88c58b52d2e5025941e938e15d5 100644 (file)
@@ -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])\r
             SqlCommand = """\r
                          select A.ID, A.Value1, A.BelongsToFile, A.StartLine, B.StartLine from Dsc as A left join Dsc as B\r
-                         where A.Model = %s and B.Model = %s and A.Scope1 = B.Scope1 and A.Scope2 = B.Scope2 and A.ID <> B.ID\r
-                         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""" \\r
+                         where A.Model = %s and B.Model = %s and A.Scope1 = B.Scope1 and A.Scope2 = B.Scope2 and A.ID != B.ID\r
+                         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""" \\r
                             % (MODEL_EFI_LIBRARY_CLASS, MODEL_EFI_LIBRARY_CLASS)\r
             RecordSet = EccGlobalData.gDb.TblDsc.Exec(SqlCommand)\r
             for Record in RecordSet:\r
@@ -903,7 +903,7 @@ class Check(object):
                          and A.Value1 = B.Value1\r
                          and A.Value2 = B.Value2\r
                          and A.Scope1 = B.Scope1\r
-                         and A.ID <> B.ID\r
+                         and A.ID != B.ID\r
                          and A.Model = B.Model\r
                          and A.Enabled > -1\r
                          and B.Enabled > -1\r
@@ -1055,7 +1055,7 @@ class Check(object):
             SqlCommand = """\r
                          select A.ID, A.Value3, A.BelongsToFile, B.BelongsToFile from %s as A, %s as B\r
                          where A.Value2 = 'FILE_GUID' and B.Value2 = 'FILE_GUID' and\r
-                         A.Value3 = B.Value3 and A.ID <> B.ID group by A.ID\r
+                         A.Value3 = B.Value3 and A.ID != B.ID group by A.ID\r
                          """ % (Table.Table, Table.Table)\r
             RecordSet = Table.Exec(SqlCommand)\r
             for Record in RecordSet:\r
@@ -1215,7 +1215,7 @@ class Check(object):
         SqlCommand = """\r
                      select A.ID, A.Value1 from %s as A, %s as B\r
                      where A.Model = %s and B.Model = %s\r
-                     and A.Value1 like B.Value1 and A.ID <> B.ID\r
+                     and A.Value1 like B.Value1 and A.ID != B.ID\r
                      and A.Scope1 = B.Scope1\r
                      and A.Enabled > -1\r
                      and B.Enabled > -1\r
@@ -1239,8 +1239,8 @@ class Check(object):
         SqlCommand = """\r
                      select A.ID, A.Value1, A.Value2 from %s as A, %s as B\r
                      where A.Model = %s and B.Model = %s\r
-                     and A.Value2 like B.Value2 and A.ID <> B.ID\r
-                     and A.Scope1 = B.Scope1 and A.Value1 <> B.Value1\r
+                     and A.Value2 like B.Value2 and A.ID != B.ID\r
+                     and A.Scope1 = B.Scope1 and A.Value1 != B.Value1\r
                      group by A.ID\r
                      """ % (Table.Table, Table.Table, Model, Model)\r
         RecordSet = Table.Exec(SqlCommand)\r
index 4f79d0f82967019f87f2fa656e96dd050a86a8d2..11d11700ed9902316a76d2b25df60bd8c4241989 100644 (file)
@@ -118,7 +118,7 @@ if __name__ == '__main__':
     sys.exit(1)\r
 \r
   Version = Process.communicate()\r
-  if Process.returncode <> 0:\r
+  if Process.returncode != 0:\r
     print('ERROR: Open SSL command not available.  Please verify PATH or set OPENSSL_PATH')\r
     sys.exit(Process.returncode)\r
   print(Version[0])\r
@@ -208,7 +208,7 @@ if __name__ == '__main__':
     #\r
     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)\r
     Signature = Process.communicate(input=FullInputFileBuffer)[0]\r
-    if Process.returncode <> 0:\r
+    if Process.returncode != 0:\r
       sys.exit(Process.returncode)\r
 \r
     #\r
@@ -277,7 +277,7 @@ if __name__ == '__main__':
     #\r
     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)\r
     Process.communicate(input=args.SignatureBuffer)[0]\r
-    if Process.returncode <> 0:\r
+    if Process.returncode != 0:\r
       print('ERROR: Verification failed')\r
       os.remove (args.OutputFileName)\r
       sys.exit(Process.returncode)\r
index 41bcaa0437c516826fa852ce3278f1dd7aaccb4f..ca4f64864790cdc0d50ae88ffbc4dc971beabf6e 100644 (file)
@@ -80,7 +80,7 @@ if __name__ == '__main__':
     sys.exit(1)\r
     \r
   Version = Process.communicate()\r
-  if Process.returncode <> 0:\r
+  if Process.returncode != 0:\r
     print('ERROR: Open SSL command not available.  Please verify PATH or set OPENSSL_PATH')\r
     sys.exit(Process.returncode)\r
   print(Version[0])\r
@@ -103,7 +103,7 @@ if __name__ == '__main__':
       #\r
       Process = subprocess.Popen('%s genrsa -out %s 2048' % (OpenSslCommand, Item.name), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)\r
       Process.communicate()\r
-      if Process.returncode <> 0:\r
+      if Process.returncode != 0:\r
         print('ERROR: RSA 2048 key generation failed')\r
         sys.exit(Process.returncode)\r
       \r
@@ -125,7 +125,7 @@ if __name__ == '__main__':
     #\r
     Process = subprocess.Popen('%s rsa -in %s -modulus -noout' % (OpenSslCommand, Item), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)\r
     PublicKeyHexString = Process.communicate()[0].split('=')[1].strip()\r
-    if Process.returncode <> 0:\r
+    if Process.returncode != 0:\r
       print('ERROR: Unable to extract public key from private key')\r
       sys.exit(Process.returncode)\r
     PublicKey = ''\r
@@ -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)\r
     Process.stdin.write (PublicKey)\r
     PublicKeyHash = PublicKeyHash + Process.communicate()[0]\r
-    if Process.returncode <> 0:\r
+    if Process.returncode != 0:\r
       print('ERROR: Unable to extract SHA 256 hash of public key')\r
       sys.exit(Process.returncode)\r
 \r
index 2944b634fb7a27298bccf09f5cac14f3d9150048..2e164c4a2da6c319753a2396dc4962668f568f4f 100644 (file)
@@ -101,7 +101,7 @@ if __name__ == '__main__':
     sys.exit(1)\r
     \r
   Version = Process.communicate()\r
-  if Process.returncode <> 0:\r
+  if Process.returncode != 0:\r
     print('ERROR: Open SSL command not available.  Please verify PATH or set OPENSSL_PATH')\r
     sys.exit(Process.returncode)\r
   print(Version[0])\r
@@ -157,7 +157,7 @@ if __name__ == '__main__':
   while len(PublicKeyHexString) > 0:\r
     PublicKey = PublicKey + chr(int(PublicKeyHexString[0:2],16))\r
     PublicKeyHexString=PublicKeyHexString[2:]\r
-  if Process.returncode <> 0:\r
+  if Process.returncode != 0:\r
     sys.exit(Process.returncode)\r
 \r
   if args.MonotonicCountStr:\r
@@ -179,7 +179,7 @@ if __name__ == '__main__':
     #\r
     Process = subprocess.Popen('%s dgst -sha256 -sign "%s"' % (OpenSslCommand, args.PrivateKeyFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)\r
     Signature = Process.communicate(input=FullInputFileBuffer)[0]\r
-    if Process.returncode <> 0:\r
+    if Process.returncode != 0:\r
       sys.exit(Process.returncode)\r
       \r
     #\r
@@ -202,14 +202,14 @@ if __name__ == '__main__':
     #\r
     # Verify that the Hash Type matches the expected SHA256 type\r
     #\r
-    if uuid.UUID(bytes_le = Header.HashType) <> EFI_HASH_ALGORITHM_SHA256_GUID:\r
+    if uuid.UUID(bytes_le = Header.HashType) != EFI_HASH_ALGORITHM_SHA256_GUID:\r
       print('ERROR: unsupport hash GUID')\r
       sys.exit(1)\r
 \r
     #\r
     # Verify the public key\r
     #\r
-    if Header.PublicKey <> PublicKey:\r
+    if Header.PublicKey != PublicKey:\r
       print('ERROR: Public key in input file does not match public key from private key file')\r
       sys.exit(1)\r
 \r
@@ -228,7 +228,7 @@ if __name__ == '__main__':
     #    \r
     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)\r
     Process.communicate(input=FullInputFileBuffer)\r
-    if Process.returncode <> 0:\r
+    if Process.returncode != 0:\r
       print('ERROR: Verification failed')\r
       os.remove (args.OutputFileName)\r
       sys.exit(Process.returncode)\r
index 7f289c103fb9c0a726cbf679ecb7e2276465d57f..a80c07bc1e55b56930371d326d0ae4b083a964c2 100644 (file)
@@ -2153,7 +2153,7 @@ class DscBuildData(PlatformBuildClassObject):
         if DscBuildData.NeedUpdateOutput(OutputValueFile, PcdValueInitExe ,InputValueFile):\r
             Command = PcdValueInitExe + ' -i %s -o %s' % (InputValueFile, OutputValueFile)\r
             returncode, StdOut, StdErr = DscBuildData.ExecuteCommand (Command)\r
-            if returncode <> 0:\r
+            if returncode != 0:\r
                 EdkLogger.warn('Build', COMMAND_FAILURE, 'Can not collect output from command: %s' % Command)\r
 \r
         File = open (OutputValueFile, 'r')\r