mirror of
https://github.com/holub/mame
synced 2025-04-25 09:50:04 +03:00
some Python script cleanups based on PyCharm inspection (nw)
This commit is contained in:
parent
20cfa98b20
commit
ad02fe3b8b
@ -26,22 +26,22 @@ def parse_file(srcfile):
|
||||
srcptr+=1
|
||||
continue
|
||||
if c==' ':
|
||||
continue;
|
||||
continue
|
||||
if in_comment==1 and c=='*' and line[srcptr]=='/' :
|
||||
srcptr+=1
|
||||
in_comment = 0;
|
||||
in_comment = 0
|
||||
continue
|
||||
if (in_comment):
|
||||
if in_comment:
|
||||
continue
|
||||
if c=='/' and line[srcptr]=='*' :
|
||||
srcptr+=1
|
||||
in_comment = 1;
|
||||
in_comment = 1
|
||||
continue
|
||||
if c=='/' and line[srcptr]=='/' :
|
||||
break
|
||||
drivname += c
|
||||
drivname = drivname.strip()
|
||||
if (len(drivname)>0):
|
||||
if len(drivname)>0:
|
||||
if drivname[0]=='#':
|
||||
sys.stderr.write("Importing drivers from '%s'\n" % drivname[1:])
|
||||
parse_file(drivname[1:])
|
||||
@ -54,16 +54,16 @@ def parse_file(srcfile):
|
||||
return 0
|
||||
|
||||
|
||||
if (len(sys.argv) < 2) :
|
||||
if len(sys.argv) < 2:
|
||||
print('Usage:')
|
||||
print(' makelist <source.lst>')
|
||||
sys.exit(0)
|
||||
|
||||
if (parse_file(sys.argv[1])) :
|
||||
if parse_file(sys.argv[1]) :
|
||||
sys.exit(1)
|
||||
|
||||
# output a count
|
||||
if (len(drivlist)==0) :
|
||||
if len(drivlist)==0 :
|
||||
sys.stderr.write("No drivers found\n")
|
||||
sys.exit(1)
|
||||
|
||||
@ -73,21 +73,21 @@ sys.stderr.write("%d drivers found\n" % len(drivlist))
|
||||
drivlist.append("___empty")
|
||||
|
||||
# start with a header
|
||||
print('#include "emu.h"\n');
|
||||
print('#include "drivenum.h"\n');
|
||||
print('#include "emu.h"\n')
|
||||
print('#include "drivenum.h"\n')
|
||||
|
||||
#output the list of externs first
|
||||
for drv in sorted(drivlist):
|
||||
print("GAME_EXTERN(%s);" % drv)
|
||||
print("GAME_EXTERN(%s);" % drv)
|
||||
print("")
|
||||
|
||||
# then output the array
|
||||
print("const game_driver * const driver_list::s_drivers_sorted[%d] =" % len(drivlist))
|
||||
print("{")
|
||||
for drv in sorted(drivlist):
|
||||
print("\t&GAME_NAME(%s)," % drv)
|
||||
print("};");
|
||||
print("");
|
||||
print("\t&GAME_NAME(%s)," % drv)
|
||||
print("};")
|
||||
print("")
|
||||
|
||||
# also output a global count
|
||||
print("int driver_list::s_driver_count = %d;\n" % len(drivlist))
|
||||
|
@ -23,13 +23,13 @@ def parse_args():
|
||||
elif flags and (sys.argv[i] == '-p'):
|
||||
format = 'plist'
|
||||
elif flags and (sys.argv[i] == '-b'):
|
||||
i += 1;
|
||||
i += 1
|
||||
if (i >= len(sys.argv)) or (sys.argv[i] not in ('mame', 'mess', 'ume')):
|
||||
usage()
|
||||
else:
|
||||
target = sys.argv[i]
|
||||
elif flags and (sys.argv[i] == '-o'):
|
||||
i += 1;
|
||||
i += 1
|
||||
if (i >= len(sys.argv)) or (output is not None):
|
||||
usage()
|
||||
else:
|
||||
|
@ -58,8 +58,8 @@ def runViewJedTests(tests, jedUtilApp):
|
||||
for test in tests:
|
||||
command = [jedUtilApp, "-view", test.jedFile, test.name]
|
||||
if VERBOSE:
|
||||
print "Viewing the JED file: %s" % (test.jedFile)
|
||||
print "Command: %s" % ((" ").join(command))
|
||||
print "Viewing the JED file: %s" % test.jedFile
|
||||
print "Command: %s" % " ".join(command)
|
||||
|
||||
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
(stdout,stderr) = process.communicate()
|
||||
@ -84,7 +84,7 @@ def main():
|
||||
else:
|
||||
jedUtilApp = os.path.normpath(os.path.join(currentDirectory, "..", "..", "..", "jedutil"))
|
||||
|
||||
if (VERBOSE):
|
||||
if VERBOSE:
|
||||
print "JED Path: %s" % jedsPath
|
||||
print "Baseline Path: %s" % baselinePath
|
||||
print "Output Path: %s" % outputPath
|
||||
@ -109,7 +109,7 @@ def main():
|
||||
|
||||
|
||||
# Setup the output paths
|
||||
if (VERBOSE):
|
||||
if VERBOSE:
|
||||
print "Cleaning the output directory"
|
||||
print
|
||||
if os.path.exists(outputPath):
|
||||
|
Loading…
Reference in New Issue
Block a user