Fix build error with scons-4.4.0 version which is based on python3
[platform/upstream/iotivity.git] / tools / scons / UnpackAll.py
index 1b0557a..0941e43 100644 (file)
@@ -156,7 +156,7 @@ def __fileextractor_win_7zip( env, count, no, i ) :
 def __getExtractor( source, env ) :
     # we check each unpacker and get the correc  list command first, run the command and
     # replace the target filelist with the list values, we sorte the extractors by their priority
-    for unpackername, extractor in sorted(env["UNPACK"]["EXTRACTOR"].iteritems(), key = lambda (k,v) : (v["PRIORITY"],k)):
+    for unpackername, extractor in sorted(iter(env["UNPACK"]["EXTRACTOR"].items()), key = lambda k_v : (k_v[1]["PRIORITY"],k_v[0])):
 
         # if the run command not set, we continue the extractor search, otherwise we check the extractor parameters
         if not SCons.Util.is_String(extractor["RUN"]) :
@@ -193,7 +193,7 @@ def __getExtractor( source, env ) :
 # @param source source name
 # @param env environment object
 def __message( s, target, source, env ) :
-    print "extract [%s] ..." % (source[0])
+    print("extract [%s] ..." % (source[0]))
 
 
 # action function for extracting of the data
@@ -225,7 +225,7 @@ def __action( target, source, env ) :
         devnull = open(os.devnull, "wb")
         handle  = subprocess.Popen( cmd, shell=True, stdout=devnull, cwd=cwd)
 
-    if handle.wait() <> 0 :
+    if handle.wait() != 0 :
         raise SCons.Errors.BuildError( "error running extractor [%s] on the source [%s]" % (cmd, source[0])  )
 
     fhandle = open(target_path, 'a')
@@ -336,7 +336,7 @@ def generate( env ) :
     }
 
     # read tools for Windows system
-    if env["PLATFORM"] <> "darwin" and "win" in env["PLATFORM"] :
+    if env["PLATFORM"] != "darwin" and "win" in env["PLATFORM"] :
 
         if env.WhereIs("7z"):
             toolset["EXTRACTOR"]["TARGZ"]["RUN"]           = "7z"