diff options
author | yan11.meng <yan11.meng@samsung.com> | 2019-10-23 16:16:27 +0800 |
---|---|---|
committer | yan11.meng <yan11.meng@samsung.com> | 2019-11-19 10:51:19 +0800 |
commit | db01815422842fa81a1320c4c070d2ad6e834ec0 (patch) | |
tree | 5dcec288be15b52ef659d23552c4531e3d28a1e1 | |
parent | 467c8d7b6463f6fb86300851a40eb51e6f523452 (diff) | |
download | qemu-arm-static-submit/trunk/20200519.164610.tar.gz qemu-arm-static-submit/trunk/20200519.164610.tar.bz2 qemu-arm-static-submit/trunk/20200519.164610.zip |
fix pylint errors for qemu-arm-staticsubmit/trunk/20200519.184310submit/trunk/20200519.164610submit/trunk/20200519.161030submit/trunk/20200513.162810submit/trunk/20200423.122334submit/trunk/20200423.115423submit/trunk/20200423.102810submit/trunk/20200422.165210submit/trunk/20200422.142510submit/trunk/20200422.115210submit/trunk/20200414.191000submit/trunk/20200414.173500submit/trunk/20200414.141500submit/trunk/20200413.151000submit/trunk/20200413.150500submit/trunk/20200413.150000submit/trunk/20200413.132320submit/trunk/20200410.160020submit/trunk/20200410.143020submit/trunk/20200409.202020submit/trunk/20200409.200220submit/trunk/20200409.194520submit/trunk/20200219.120523submit/trunk/20200115.110101submit/trunk/20200114.110000submit/trunk/20200114.100000submit/trunk/20200110.111659submit/trunk/20200109.154402submit/trunk/20200109.151502submit/trunk/20200109.124502submit/trunk/20200109.112402submit/trunk/20200109.105802submit/trunk/20200108.172702submit/trunk/20200105.092010submit/trunk/20200104.134833submit/trunk/20200104.111033accepted/tizen/devbase/tools/20200520.012821accepted/tizen/devbase/tools/20200514.023624accepted/tizen/devbase/tools/20200423.100601accepted/tizen/devbase/tools/20200415.093508accepted/tizen/devbase/tools/20200219.094600accepted/tizen/devbase/tools/20200115.231456accepted/tizen/devbase/tools/20200114.115832accepted/tizen/devbase/tools/20200114.020209accepted/tizen/devbase/tools/20200110.011832accepted/tizen/devbase/tools/20200109.052820accepted/tizen/devbase/tools/20200106.014333accepted/tizen/devbase/tools/20200104.060201
Change-Id: Ie98991d4e8f6d9310cc919cf7caddf9caded30b8
Signed-off-by: yan11.meng <yan11.meng@samsung.com>
-rwxr-xr-x | roms/seabios/tools/acpi_extract.py | 52 | ||||
-rwxr-xr-x | roms/seabios/tools/acpi_extract_preprocess.py | 10 | ||||
-rwxr-xr-x | roms/seabios/tools/checkrom.py | 18 | ||||
-rwxr-xr-x | roms/seabios/tools/checksum.py | 2 | ||||
-rwxr-xr-x | roms/seabios/tools/layoutrom.py | 16 | ||||
-rw-r--r-- | roms/seabios/tools/vgafixup.py | 2 | ||||
-rwxr-xr-x | scripts/analyse-9p-simpletrace.py | 88 | ||||
-rw-r--r-- | scripts/qapi-commands.py | 4 | ||||
-rw-r--r-- | scripts/qapi-types.py | 4 | ||||
-rw-r--r-- | scripts/qapi-visit.py | 4 | ||||
-rw-r--r-- | scripts/qapi.py | 10 | ||||
-rw-r--r-- | scripts/qemu-gdb.py | 2 | ||||
-rwxr-xr-x | scripts/simpletrace.py | 2 | ||||
-rwxr-xr-x | scripts/tracetool.py | 18 | ||||
-rw-r--r-- | tests/qemu-iotests/iotests.py | 6 | ||||
-rwxr-xr-x | tests/qemu-iotests/qcow2.py | 37 | ||||
-rwxr-xr-x | tests/qemu-iotests/qed.py | 17 |
17 files changed, 143 insertions, 149 deletions
diff --git a/roms/seabios/tools/acpi_extract.py b/roms/seabios/tools/acpi_extract.py index dd3ccfdd9..0621746e4 100755 --- a/roms/seabios/tools/acpi_extract.py +++ b/roms/seabios/tools/acpi_extract.py @@ -32,12 +32,12 @@ # ACPI_EXTRACT_PKG_START - start of Package block # # ACPI_EXTRACT_ALL_CODE - create an array storing the generated AML bytecode -# +# # ACPI_EXTRACT is not allowed anywhere else in code, except in comments. -import re; -import sys; -import fileinput; +import re +import sys +import fileinput aml = [] asl = [] @@ -64,7 +64,7 @@ def add_asl(lineno, line): #Store an AML byte sequence #Verify that offset output by iasl matches # of bytes so far def add_aml(offset, line): - o = int(offset, 16); + o = int(offset, 16) # Sanity check: offset must match size of code so far if (o != len(aml)): die("Offset 0x%x != 0x%x" % (o, len(aml))) @@ -79,13 +79,13 @@ def add_aml(offset, line): for c in code: # Require a legal hex number, two digits if (not(re.search(r'^[0-9A-Fa-f][0-9A-Fa-f]$', c))): - die("Unexpected octet %s" % c); - aml.append(int(c, 16)); + die("Unexpected octet %s" % c) + aml.append(int(c, 16)) # Process aml bytecode array, decoding AML def aml_pkglen_bytes(offset): # PkgLength can be multibyte. Bits 8-7 give the # of extra bytes. - pkglenbytes = aml[offset] >> 6; + pkglenbytes = aml[offset] >> 6 return pkglenbytes + 1 def aml_pkglen(offset): @@ -110,47 +110,47 @@ def aml_method_string(offset): #0x14 MethodOp PkgLength NameString MethodFlags TermList if (aml[offset] != 0x14): die( "Method offset 0x%x: expected 0x14 actual 0x%x" % - (offset, aml[offset])); - offset += 1; + (offset, aml[offset])) + offset += 1 pkglenbytes = aml_pkglen_bytes(offset) - offset += pkglenbytes; - return offset; + offset += pkglenbytes + return offset # Given name offset, find its NameString offset def aml_name_string(offset): #0x08 NameOp NameString DataRef if (aml[offset] != 0x08): die( "Name offset 0x%x: expected 0x08 actual 0x%x" % - (offset, aml[offset])); + (offset, aml[offset])) offset += 1 # Block Name Modifier. Skip it. if (aml[offset] == 0x5c or aml[offset] == 0x5e): offset += 1 - return offset; + return offset # Given data offset, find dword const offset def aml_data_dword_const(offset): #0x08 NameOp NameString DataRef if (aml[offset] != 0x0C): die( "Name offset 0x%x: expected 0x0C actual 0x%x" % - (offset, aml[offset])); - return offset + 1; + (offset, aml[offset])) + return offset + 1 # Given data offset, find word const offset def aml_data_word_const(offset): #0x08 NameOp NameString DataRef if (aml[offset] != 0x0B): die( "Name offset 0x%x: expected 0x0B actual 0x%x" % - (offset, aml[offset])); - return offset + 1; + (offset, aml[offset])) + return offset + 1 # Given data offset, find byte const offset def aml_data_byte_const(offset): #0x08 NameOp NameString DataRef if (aml[offset] != 0x0A): die( "Name offset 0x%x: expected 0x0A actual 0x%x" % - (offset, aml[offset])); - return offset + 1; + (offset, aml[offset])) + return offset + 1 # Given name offset, find dword const offset def aml_name_dword_const(offset): @@ -168,7 +168,7 @@ def aml_device_start(offset): #0x5B 0x82 DeviceOp PkgLength NameString if ((aml[offset] != 0x5B) or (aml[offset + 1] != 0x82)): die( "Name offset 0x%x: expected 0x5B 0x82 actual 0x%x 0x%x" % - (offset, aml[offset], aml[offset + 1])); + (offset, aml[offset], aml[offset + 1])) return offset def aml_device_string(offset): @@ -190,7 +190,7 @@ def aml_processor_start(offset): #0x5B 0x83 ProcessorOp PkgLength NameString ProcID if ((aml[offset] != 0x5B) or (aml[offset + 1] != 0x83)): die( "Name offset 0x%x: expected 0x5B 0x83 actual 0x%x 0x%x" % - (offset, aml[offset], aml[offset + 1])); + (offset, aml[offset], aml[offset + 1])) return offset def aml_processor_string(offset): @@ -213,14 +213,14 @@ def aml_package_start(offset): # 0x12 PkgLength NumElements PackageElementList if (aml[offset] != 0x12): die( "Name offset 0x%x: expected 0x12 actual 0x%x" % - (offset, aml[offset])); + (offset, aml[offset])) offset += 1 return offset + aml_pkglen_bytes(offset) + 1 lineno = 0 for line in fileinput.input(): # Strip trailing newline - line = line.rstrip(); + line = line.rstrip() # line number and debug string to output in case of errors lineno = lineno + 1 debug = "input line %d: %s" % (lineno, line) @@ -228,7 +228,7 @@ for line in fileinput.input(): pasl = re.compile('^\s+([0-9]+)(:\s\s|\.\.\.\.)\s*') m = pasl.search(line) if (m): - add_asl(lineno, pasl.sub("", line)); + add_asl(lineno, pasl.sub("", line)) # AML listing: offset in hex, then ...., then code paml = re.compile('^([0-9A-Fa-f]+)(:\s\s|\.\.\.\.)\s*') m = paml.search(line) @@ -333,4 +333,4 @@ for array in output.keys(): odata.append("0x%x" % value) sys.stdout.write("static unsigned %s %s[] = {\n" % (otype, array)) sys.stdout.write(",\n".join(odata)) - sys.stdout.write('\n};\n'); + sys.stdout.write('\n};\n') diff --git a/roms/seabios/tools/acpi_extract_preprocess.py b/roms/seabios/tools/acpi_extract_preprocess.py index 4ae364ef8..6ef7df0f9 100755 --- a/roms/seabios/tools/acpi_extract_preprocess.py +++ b/roms/seabios/tools/acpi_extract_preprocess.py @@ -8,9 +8,9 @@ # We also put each directive on a new line, the machinery # in tools/acpi_extract.py requires this. -import re; -import sys; -import fileinput; +import re +import sys +import fileinput def die(diag): sys.stderr.write("Error: %s\n" % (diag)) @@ -22,7 +22,7 @@ psplit = re.compile(r''' ( ACPI_EXTRACT_\w+ # directive \s+ # some whitespace \w+ # array name - )''', re.VERBOSE); + )''', re.VERBOSE) lineno = 0 for line in fileinput.input(): @@ -30,7 +30,7 @@ for line in fileinput.input(): lineno = lineno + 1 debug = "input line %d: %s" % (lineno, line.rstrip()) - s = psplit.split(line); + s = psplit.split(line) # The way split works, each odd item is the matching ACPI_EXTRACT directive. # Put each in a comment, and on a line by itself. for i in range(len(s)): diff --git a/roms/seabios/tools/checkrom.py b/roms/seabios/tools/checkrom.py index 69d65e8d9..636150f33 100755 --- a/roms/seabios/tools/checkrom.py +++ b/roms/seabios/tools/checkrom.py @@ -10,7 +10,7 @@ import layoutrom def main(): # Get args - objinfo, rawfile, outfile = sys.argv[1:] + objinfo, rawfile, outfile = sys.argv[1:] #pylint: disable=unbalanced-tuple-unpacking # Read in symbols objinfofile = open(objinfo, 'rb') @@ -32,27 +32,27 @@ def main(): end = symbols['code32flat_end'].offset expend = layoutrom.BUILD_BIOS_ADDR + layoutrom.BUILD_BIOS_SIZE if end != expend: - print "Error! Code does not end at 0x%x (got 0x%x)" % ( - expend, end) + print( "Error! Code does not end at 0x%x (got 0x%x)" % ( + expend, end)) sys.exit(1) if datasize > finalsize: - print "Error! Code is too big (0x%x vs 0x%x)" % ( - datasize, finalsize) + print ("Error! Code is too big (0x%x vs 0x%x)" % ( + datasize, finalsize)) sys.exit(1) expdatasize = end - start if datasize != expdatasize: - print "Error! Unknown extra data (0x%x vs 0x%x)" % ( - datasize, expdatasize) + print ("Error! Unknown extra data (0x%x vs 0x%x)" % ( + datasize, expdatasize)) sys.exit(1) # Print statistics runtimesize = datasize if '_reloc_abs_start' in symbols: runtimesize = end - symbols['code32init_end'].offset - print "Total size: %d Fixed: %d Free: %d (used %.1f%% of %dKiB rom)" % ( + print( "Total size: %d Fixed: %d Free: %d (used %.1f%% of %dKiB rom)" % ( datasize, runtimesize, finalsize - datasize , (datasize / float(finalsize)) * 100.0 - , finalsize / 1024) + , finalsize / 1024)) # Write final file f = open(outfile, 'wb') diff --git a/roms/seabios/tools/checksum.py b/roms/seabios/tools/checksum.py index 8c7665d25..7fb02c510 100755 --- a/roms/seabios/tools/checksum.py +++ b/roms/seabios/tools/checksum.py @@ -10,7 +10,7 @@ import sys def main(): data = sys.stdin.read() ords = map(ord, data) - print "sum=%x\n" % sum(ords) + print( "sum=%x\n" % sum(ords)) if __name__ == '__main__': main() diff --git a/roms/seabios/tools/layoutrom.py b/roms/seabios/tools/layoutrom.py index 816ff9b0c..734cd9a5f 100755 --- a/roms/seabios/tools/layoutrom.py +++ b/roms/seabios/tools/layoutrom.py @@ -73,8 +73,8 @@ def fitSections(sections, fillsections): section.finalsegloc = addr fixedsections.append((addr, section)) if section.align != 1: - print "Error: Fixed section %s has non-zero alignment (%d)" % ( - section.name, section.align) + print ("Error: Fixed section %s has non-zero alignment (%d)" % ( + section.name, section.align)) sys.exit(1) fixedsections.sort() firstfixed = fixedsections[0][0] @@ -235,11 +235,11 @@ def doLayout(sections, genreloc): size32flat = li.sec32seg_start - li.sec32flat_start size32init = li.sec32flat_start - li.sec32init_start sizelow = sec32low_top - li.sec32low_start - print "16bit size: %d" % size16 - print "32bit segmented size: %d" % size32seg - print "32bit flat size: %d" % size32flat - print "32bit flat init size: %d" % size32init - print "Lowmem size: %d" % sizelow + print ("16bit size: %d" % size16) + print ("32bit segmented size: %d" % size32seg) + print ("32bit flat size: %d" % size32flat) + print ("32bit flat init size: %d" % size32init) + print ("Lowmem size: %d" % sizelow) return li @@ -596,7 +596,7 @@ def parseObjDump(file, fileid): def main(): # Get output name - in16, in32seg, in32flat, out16, out32seg, out32flat = sys.argv[1:] + in16, in32seg, in32flat, out16, out32seg, out32flat = sys.argv[1:] #pylint: disable=unbalanced-tuple-unpacking # Read in the objdump information infile16 = open(in16, 'rb') diff --git a/roms/seabios/tools/vgafixup.py b/roms/seabios/tools/vgafixup.py index 52fb93430..3d8c8196a 100644 --- a/roms/seabios/tools/vgafixup.py +++ b/roms/seabios/tools/vgafixup.py @@ -19,7 +19,7 @@ import sys def main(): - infilename, outfilename = sys.argv[1:] + infilename, outfilename = sys.argv[1:] #pylint: disable=unbalanced-tuple-unpacking infile = open(infilename, 'rb') out = [] for line in infile: diff --git a/scripts/analyse-9p-simpletrace.py b/scripts/analyse-9p-simpletrace.py index 3c3dee433..c1b753793 100755 --- a/scripts/analyse-9p-simpletrace.py +++ b/scripts/analyse-9p-simpletrace.py @@ -79,135 +79,135 @@ symbol_9p = { class VirtFSRequestTracker(simpletrace.Analyzer): def begin(self): - print "Pretty printing 9p simpletrace log ..." + print ("Pretty printing 9p simpletrace log ...") def v9fs_rerror(self, tag, id, err): - print "RERROR (tag =", tag, ", id =", symbol_9p[id], ", err = \"", os.strerror(err), "\")" + print( "RERROR (tag =", tag, ", id =", symbol_9p[id], ", err = \"", os.strerror(err), "\")") def v9fs_version(self, tag, id, msize, version): - print "TVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")" + print ("TVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")") def v9fs_version_return(self, tag, id, msize, version): - print "RVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")" + print ("RVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")") def v9fs_attach(self, tag, id, fid, afid, uname, aname): - print "TATTACH (tag =", tag, ", fid =", fid, ", afid =", afid, ", uname =", uname, ", aname =", aname, ")" + print( "TATTACH (tag =", tag, ", fid =", fid, ", afid =", afid, ", uname =", uname, ", aname =", aname, ")") def v9fs_attach_return(self, tag, id, type, version, path): - print "RATTACH (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})" + print ("RATTACH (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})") def v9fs_stat(self, tag, id, fid): - print "TSTAT (tag =", tag, ", fid =", fid, ")" + print ("TSTAT (tag =", tag, ", fid =", fid, ")") def v9fs_stat_return(self, tag, id, mode, atime, mtime, length): - print "RSTAT (tag =", tag, ", mode =", mode, ", atime =", atime, ", mtime =", mtime, ", length =", length, ")" + print( "RSTAT (tag =", tag, ", mode =", mode, ", atime =", atime, ", mtime =", mtime, ", length =", length, ")") def v9fs_getattr(self, tag, id, fid, request_mask): - print "TGETATTR (tag =", tag, ", fid =", fid, ", request_mask =", hex(request_mask), ")" + print ("TGETATTR (tag =", tag, ", fid =", fid, ", request_mask =", hex(request_mask), ")") def v9fs_getattr_return(self, tag, id, result_mask, mode, uid, gid): - print "RGETATTR (tag =", tag, ", result_mask =", hex(result_mask), ", mode =", oct(mode), ", uid =", uid, ", gid =", gid, ")" + print ("RGETATTR (tag =", tag, ", result_mask =", hex(result_mask), ", mode =", oct(mode), ", uid =", uid, ", gid =", gid, ")") def v9fs_walk(self, tag, id, fid, newfid, nwnames): - print "TWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", nwnames =", nwnames, ")" + print ("TWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", nwnames =", nwnames, ")") def v9fs_walk_return(self, tag, id, nwnames, qids): - print "RWALK (tag =", tag, ", nwnames =", nwnames, ", qids =", hex(qids), ")" + print ("RWALK (tag =", tag, ", nwnames =", nwnames, ", qids =", hex(qids), ")") def v9fs_open(self, tag, id, fid, mode): - print "TOPEN (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ")" + print ("TOPEN (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ")") def v9fs_open_return(self, tag, id, type, version, path, iounit): - print "ROPEN (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")" + print ("ROPEN (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")") def v9fs_lcreate(self, tag, id, dfid, flags, mode, gid): - print "TLCREATE (tag =", tag, ", dfid =", dfid, ", flags =", oct(flags), ", mode =", oct(mode), ", gid =", gid, ")" + print ("TLCREATE (tag =", tag, ", dfid =", dfid, ", flags =", oct(flags), ", mode =", oct(mode), ", gid =", gid, ")") def v9fs_lcreate_return(self, tag, id, type, version, path, iounit): - print "RLCREATE (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")" + print ("RLCREATE (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")") def v9fs_fsync(self, tag, id, fid, datasync): - print "TFSYNC (tag =", tag, ", fid =", fid, ", datasync =", datasync, ")" + print ("TFSYNC (tag =", tag, ", fid =", fid, ", datasync =", datasync, ")") def v9fs_clunk(self, tag, id, fid): - print "TCLUNK (tag =", tag, ", fid =", fid, ")" + print( "TCLUNK (tag =", tag, ", fid =", fid, ")") def v9fs_read(self, tag, id, fid, off, max_count): - print "TREAD (tag =", tag, ", fid =", fid, ", off =", off, ", max_count =", max_count, ")" + print ("TREAD (tag =", tag, ", fid =", fid, ", off =", off, ", max_count =", max_count, ")") def v9fs_read_return(self, tag, id, count, err): - print "RREAD (tag =", tag, ", count =", count, ", err =", err, ")" + print ("RREAD (tag =", tag, ", count =", count, ", err =", err, ")") def v9fs_readdir(self, tag, id, fid, offset, max_count): - print "TREADDIR (tag =", tag, ", fid =", fid, ", offset =", offset, ", max_count =", max_count, ")" + print ("TREADDIR (tag =", tag, ", fid =", fid, ", offset =", offset, ", max_count =", max_count, ")") def v9fs_readdir_return(self, tag, id, count, retval): - print "RREADDIR (tag =", tag, ", count =", count, ", retval =", retval, ")" + print( "RREADDIR (tag =", tag, ", count =", count, ", retval =", retval, ")") def v9fs_write(self, tag, id, fid, off, count, cnt): - print "TWRITE (tag =", tag, ", fid =", fid, ", off =", off, ", count =", count, ", cnt =", cnt, ")" + print( "TWRITE (tag =", tag, ", fid =", fid, ", off =", off, ", count =", count, ", cnt =", cnt, ")") def v9fs_write_return(self, tag, id, total, err): - print "RWRITE (tag =", tag, ", total =", total, ", err =", err, ")" + print ("RWRITE (tag =", tag, ", total =", total, ", err =", err, ")") def v9fs_create(self, tag, id, fid, name, perm, mode): - print "TCREATE (tag =", tag, ", fid =", fid, ", perm =", oct(perm), ", name =", name, ", mode =", oct(mode), ")" + print( "TCREATE (tag =", tag, ", fid =", fid, ", perm =", oct(perm), ", name =", name, ", mode =", oct(mode), ")") def v9fs_create_return(self, tag, id, type, version, path, iounit): - print "RCREATE (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")" + print ("RCREATE (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")") def v9fs_symlink(self, tag, id, fid, name, symname, gid): - print "TSYMLINK (tag =", tag, ", fid =", fid, ", name =", name, ", symname =", symname, ", gid =", gid, ")" + print ("TSYMLINK (tag =", tag, ", fid =", fid, ", name =", name, ", symname =", symname, ", gid =", gid, ")") def v9fs_symlink_return(self, tag, id, type, version, path): - print "RSYMLINK (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})" + print ("RSYMLINK (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})") def v9fs_flush(self, tag, id, flush_tag): - print "TFLUSH (tag =", tag, ", flush_tag =", flush_tag, ")" + print ("TFLUSH (tag =", tag, ", flush_tag =", flush_tag, ")") def v9fs_link(self, tag, id, dfid, oldfid, name): - print "TLINK (tag =", tag, ", dfid =", dfid, ", oldfid =", oldfid, ", name =", name, ")" + print ("TLINK (tag =", tag, ", dfid =", dfid, ", oldfid =", oldfid, ", name =", name, ")") def v9fs_remove(self, tag, id, fid): - print "TREMOVE (tag =", tag, ", fid =", fid, ")" + print( "TREMOVE (tag =", tag, ", fid =", fid, ")") def v9fs_wstat(self, tag, id, fid, mode, atime, mtime): - print "TWSTAT (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", atime =", atime, "mtime =", mtime, ")" + print ("TWSTAT (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", atime =", atime, "mtime =", mtime, ")") def v9fs_mknod(self, tag, id, fid, mode, major, minor): - print "TMKNOD (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", major =", major, ", minor =", minor, ")" + print ("TMKNOD (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", major =", major, ", minor =", minor, ")") def v9fs_lock(self, tag, id, fid, type, start, length): - print "TLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")" + print ("TLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")") def v9fs_lock_return(self, tag, id, status): - print "RLOCK (tag =", tag, ", status =", status, ")" + print ("RLOCK (tag =", tag, ", status =", status, ")") def v9fs_getlock(self, tag, id, fid, type, start, length): - print "TGETLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")" + print ("TGETLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")") def v9fs_getlock_return(self, tag, id, type, start, length, proc_id): - print "RGETLOCK (tag =", tag, "type =", type, ", start =", start, ", length =", length, ", proc_id =", proc_id, ")" + print ("RGETLOCK (tag =", tag, "type =", type, ", start =", start, ", length =", length, ", proc_id =", proc_id, ")") def v9fs_mkdir(self, tag, id, fid, name, mode, gid): - print "TMKDIR (tag =", tag, ", fid =", fid, ", name =", name, ", mode =", mode, ", gid =", gid, ")" + print ("TMKDIR (tag =", tag, ", fid =", fid, ", name =", name, ", mode =", mode, ", gid =", gid, ")") def v9fs_mkdir_return(self, tag, id, type, version, path, err): - print "RMKDIR (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, err =", err, ")" + print ("RMKDIR (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, err =", err, ")") def v9fs_xattrwalk(self, tag, id, fid, newfid, name): - print "TXATTRWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", xattr name =", name, ")" + print ("TXATTRWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", xattr name =", name, ")") def v9fs_xattrwalk_return(self, tag, id, size): - print "RXATTRWALK (tag =", tag, ", xattrsize =", size, ")" + print ("RXATTRWALK (tag =", tag, ", xattrsize =", size, ")") def v9fs_xattrcreate(self, tag, id, fid, name, size, flags): - print "TXATTRCREATE (tag =", tag, ", fid =", fid, ", name =", name, ", xattrsize =", size, ", flags =", flags, ")" + print ("TXATTRCREATE (tag =", tag, ", fid =", fid, ", name =", name, ", xattrsize =", size, ", flags =", flags, ")") def v9fs_readlink(self, tag, id, fid): - print "TREADLINK (tag =", tag, ", fid =", fid, ")" + print ("TREADLINK (tag =", tag, ", fid =", fid, ")") def v9fs_readlink_return(self, tag, id, target): - print "RREADLINK (tag =", tag, ", target =", target, ")" + print ("RREADLINK (tag =", tag, ", target =", target, ")") simpletrace.run(VirtFSRequestTracker()) diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py index b12b6964e..8a104f203 100644 --- a/scripts/qapi-commands.py +++ b/scripts/qapi-commands.py @@ -393,7 +393,7 @@ try: ["source", "header", "prefix=", "output-dir=", "type=", "middle"]) except getopt.GetoptError, err: - print str(err) + print( str(err)) sys.exit(1) output_dir = "" @@ -471,7 +471,7 @@ if dispatch_type == "sync": ret = gen_marshal_input(cmd['command'], arglist, ret_type, middle_mode) + "\n" fdef.write(ret) - fdecl.write("\n#endif\n"); + fdecl.write("\n#endif\n") if not middle_mode: ret = gen_registry(commands) diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py index 5ee46ea1b..1186d3256 100644 --- a/scripts/qapi-types.py +++ b/scripts/qapi-types.py @@ -217,7 +217,7 @@ struct %(name)s if discriminator: base_fields = base_fields.copy() del base_fields[discriminator] - ret += generate_struct_fields(base_fields) + #ret += generate_struct_fields(base_fields) else: assert not discriminator @@ -267,7 +267,7 @@ try: ["source", "header", "builtins", "prefix=", "output-dir="]) except getopt.GetoptError, err: - print str(err) + print( str(err)) sys.exit(1) output_dir = "" diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py index 597cca4b6..e86cb4890 100644 --- a/scripts/qapi-visit.py +++ b/scripts/qapi-visit.py @@ -312,7 +312,7 @@ void visit_type_%(name)s(Visitor *m, %(name)s ** obj, const char *name, Error ** } ''') - pop_indent(); + pop_indent() ret += mcgen(''' } ''') @@ -358,7 +358,7 @@ try: ["source", "header", "builtins", "prefix=", "output-dir="]) except getopt.GetoptError, err: - print str(err) + print( str(err)) sys.exit(1) output_dir = "" diff --git a/scripts/qapi.py b/scripts/qapi.py index 0ebea945b..de4d6fd85 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -258,33 +258,31 @@ struct_types = [] union_types = [] def add_struct(definition): - global struct_types + struct_types.append(definition) def find_struct(name): - global struct_types for struct in struct_types: if struct['type'] == name: return struct return None def add_union(definition): - global union_types + union_types.append(definition) def find_union(name): - global union_types for union in union_types: if union['union'] == name: return union return None def add_enum(name): - global enum_types + enum_types.append(name) def is_enum(name): - global enum_types + #global enum_types return (name in enum_types) def c_type(name): diff --git a/scripts/qemu-gdb.py b/scripts/qemu-gdb.py index 8a0f30534..19c161ace 100644 --- a/scripts/qemu-gdb.py +++ b/scripts/qemu-gdb.py @@ -14,7 +14,7 @@ # GNU GPL, version 2 or (at your option) any later version. -import gdb +import gdb #pylint: disable=import-error def isnull(ptr): return ptr == gdb.Value(0).cast(ptr.type) diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py index 8bbcb42cc..bfb31dc09 100755 --- a/scripts/simpletrace.py +++ b/scripts/simpletrace.py @@ -180,6 +180,6 @@ if __name__ == '__main__': else: fields.append('%s=0x%x' % (name, rec[i + 1])) i += 1 - print ' '.join(fields) + print (' '.join(fields)) run(Formatter()) diff --git a/scripts/tracetool.py b/scripts/tracetool.py index 5f4890f3a..21451d29c 100755 --- a/scripts/tracetool.py +++ b/scripts/tracetool.py @@ -16,9 +16,9 @@ __email__ = "stefanha@linux.vnet.ibm.com" import sys import getopt -from tracetool import error_write, out -import tracetool.backend -import tracetool.format +from tracetool import error_write, out,generate,TracetoolError +from tracetool import backend +from tracetool import format _SCRIPT = "" @@ -28,9 +28,9 @@ def error_opt(msg = None): error_write("Error: " + msg + "\n") backend_descr = "\n".join([ " %-15s %s" % (n, d) - for n,d in tracetool.backend.get_list() ]) + for n,d in backend.get_list() ]) format_descr = "\n".join([ " %-15s %s" % (n, d) - for n,d in tracetool.format.get_list() ]) + for n,d in format.get_list() ]) error_write("""\ Usage: %(script)s --format=<format> --backend=<backend> [<options>] @@ -90,7 +90,7 @@ def main(args): arg_format = arg elif opt == "--list-backends": - public_backends = tracetool.backend.get_list(only_public = True) + public_backends = backend.get_list(only_public = True) out(", ".join([ b for b,_ in public_backends ])) sys.exit(0) elif opt == "--check-backend": @@ -112,7 +112,7 @@ def main(args): error_opt("backend not set") if check_backend: - if tracetool.backend.exists(arg_backend): + if backend.exists(arg_backend): sys.exit(0) else: sys.exit(1) @@ -129,9 +129,9 @@ def main(args): probe_prefix = ".".join([ "qemu", target_type, target_name ]) try: - tracetool.generate(sys.stdin, arg_format, arg_backend, + generate(sys.stdin, arg_format, arg_backend, binary = binary, probe_prefix = probe_prefix) - except tracetool.TracetoolError, e: + except TracetoolError, e: error_opt(str(e)) if __name__ == "__main__": diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 33ad0ecb9..73733fc99 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -22,10 +22,10 @@ import subprocess import string import unittest import sys; sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'QMP')) -import qmp +import qmp #pylint: disable=import-error import struct -__all__ = ['imgfmt', 'imgproto', 'test_dir' 'qemu_img', 'qemu_io', +__all__ = ['imgfmt', 'imgproto', 'test_dir', 'qemu_img', 'qemu_io', 'VM', 'QMPTestCase', 'notrun', 'main'] # This will not work if arguments or path contain spaces but is necessary if we @@ -234,7 +234,7 @@ def notrun(reason): seq = os.path.basename(sys.argv[0]) open('%s.notrun' % seq, 'wb').write(reason + '\n') - print '%s not run: %s' % (seq, reason) + print( '%s not run: %s' % (seq, reason)) sys.exit(0) def main(supported_fmts=[]): diff --git a/tests/qemu-iotests/qcow2.py b/tests/qemu-iotests/qcow2.py index 44a2b4564..a5c3982ee 100755 --- a/tests/qemu-iotests/qcow2.py +++ b/tests/qemu-iotests/qcow2.py @@ -42,7 +42,7 @@ class QcowHeader: [ uint64_t, '%#x', 'autoclear_features' ], [ uint32_t, '%d', 'refcount_order' ], [ uint32_t, '%d', 'header_length' ], - ]; + ] fmt = '>' + ''.join(field[0] for field in fields) @@ -125,8 +125,7 @@ class QcowHeader: def dump(self): for f in QcowHeader.fields: - print "%-25s" % f[2], f[1] % self.__dict__[f[2]] - print "" + print( "%-25s" % f[2], f[1] % self.__dict__[f[2]]) def dump_extensions(self): for ex in self.extensions: @@ -137,11 +136,10 @@ class QcowHeader: else: data = "<binary>" - print "Header extension:" - print "%-25s %#x" % ("magic", ex.magic) - print "%-25s %d" % ("length", ex.length) - print "%-25s %s" % ("data", data) - print "" + print( "Header extension:") + print("%-25s %#x" % ("magic", ex.magic)) + print( "%-25s %d" % ("length", ex.length)) + print( "%-25s %s" % ("data", data)) def cmd_dump_header(fd): @@ -153,12 +151,12 @@ def cmd_set_header(fd, name, value): try: value = int(value, 0) except: - print "'%s' is not a valid number" % value + print( "'%s' is not a valid number" % value) sys.exit(1) fields = (field[2] for field in QcowHeader.fields) if not name in fields: - print "'%s' is not a known header field" % name + print( "'%s' is not a known header field" % name) sys.exit(1) h = QcowHeader(fd) @@ -169,7 +167,7 @@ def cmd_add_header_ext(fd, magic, data): try: magic = int(magic, 0) except: - print "'%s' is not a valid magic number" % magic + print( "'%s' is not a valid magic number" % magic) sys.exit(1) h = QcowHeader(fd) @@ -180,7 +178,7 @@ def cmd_del_header_ext(fd, magic): try: magic = int(magic, 0) except: - print "'%s' is not a valid magic number" % magic + print( "'%s' is not a valid magic number" % magic) sys.exit(1) h = QcowHeader(fd) @@ -192,7 +190,7 @@ def cmd_del_header_ext(fd, magic): h.extensions.remove(ex) if not found: - print "No such header extension" + print( "No such header extension") return h.update(fd) @@ -203,7 +201,7 @@ def cmd_set_feature_bit(fd, group, bit): if bit < 0 or bit >= 64: raise ValueError except: - print "'%s' is not a valid bit number in range [0, 64)" % bit + print( "'%s' is not a valid bit number in range [0, 64)" % bit) sys.exit(1) h = QcowHeader(fd) @@ -214,7 +212,7 @@ def cmd_set_feature_bit(fd, group, bit): elif group == 'autoclear': h.autoclear_features |= 1 << bit else: - print "'%s' is not a valid group, try 'incompatible', 'compatible', or 'autoclear'" % group + print( "'%s' is not a valid group, try 'incompatible', 'compatible', or 'autoclear'" % group) sys.exit(1) h.update(fd) @@ -239,16 +237,15 @@ def main(filename, cmd, args): else: handler(fd, *args) return - print "Unknown command '%s'" % cmd + print( "Unknown command '%s'" % cmd) finally: fd.close() def usage(): - print "Usage: %s <file> <cmd> [<arg>, ...]" % sys.argv[0] - print "" - print "Supported commands:" + print( "Usage: %s <file> <cmd> [<arg>, ...]" % sys.argv[0]) + print( "Supported commands:") for name, handler, num_args, desc in cmds: - print " %-20s - %s" % (name, desc) + print( " %-20s - %s" % (name, desc)) if __name__ == '__main__': if len(sys.argv) < 3: diff --git a/tests/qemu-iotests/qed.py b/tests/qemu-iotests/qed.py index 52ff84559..2077228a8 100755 --- a/tests/qemu-iotests/qed.py +++ b/tests/qemu-iotests/qed.py @@ -108,12 +108,12 @@ def corrupt_table_invalidate(qed, table): def cmd_show(qed, *args): '''show [header|l1|l2 <offset>]- Show header or l1/l2 tables''' if not args or args[0] == 'header': - print qed.header + print( qed.header) elif args[0] == 'l1': - print qed.l1_table + print( qed.l1_table) elif len(args) == 2 and args[0] == 'l2': offset = int(args[1]) - print qed.read_table(offset) + print (qed.read_table(offset)) else: err('unrecognized sub-command') @@ -146,7 +146,7 @@ def cmd_invalidate(qed, table_level): def cmd_need_check(qed, *args): '''need-check [on|off] - Test, set, or clear the QED_F_NEED_CHECK header bit''' if not args: - print bool(qed.header['features'] & QED_F_NEED_CHECK) + print (bool(qed.header['features'] & QED_F_NEED_CHECK)) return if args[0] == 'on': @@ -208,17 +208,16 @@ def cmd_copy_metadata(qed, outfile): out.close() def usage(): - print 'Usage: %s <file> <cmd> [<arg>, ...]' % sys.argv[0] - print - print 'Supported commands:' + print ('Usage: %s <file> <cmd> [<arg>, ...]' % sys.argv[0]) + print ('Supported commands:') for cmd in sorted(x for x in globals() if x.startswith('cmd_')): - print globals()[cmd].__doc__ + print (globals()[cmd].__doc__) sys.exit(1) def main(): if len(sys.argv) < 3: usage() - filename, cmd = sys.argv[1:3] + filename, cmd = sys.argv[1:3] #pylint: disable=unbalanced-tuple-unpacking cmd = 'cmd_' + cmd.replace('-', '_') if cmd not in globals(): |