Previous 199869 Revisions Next

r36255 Thursday 5th March, 2015 at 15:24:05 UTC by Oliver Stöneberg
some Python script cleanups based on PyCharm inspection (nw)
[src/build]makelist.py verinfo.py
[src/regtests/jedutil]jedtest.py

trunk/src/build/makelist.py
r244766r244767
2626                    srcptr+=1
2727                continue
2828            if c==' ':
29                continue;
29                continue
3030            if in_comment==1 and c=='*' and line[srcptr]=='/' :
3131                srcptr+=1
32                in_comment = 0;
32                in_comment = 0
3333                continue
34            if (in_comment):
34            if in_comment:
3535                continue
3636            if c=='/' and line[srcptr]=='*' :
3737                srcptr+=1
38                in_comment = 1;
38                in_comment = 1
3939                continue
4040            if c=='/' and line[srcptr]=='/' :
4141                break
4242            drivname += c
4343        drivname = drivname.strip()
44        if (len(drivname)>0):
44        if len(drivname)>0:
4545            if drivname[0]=='#':
4646               sys.stderr.write("Importing drivers from '%s'\n" % drivname[1:])
4747               parse_file(drivname[1:])
r244766r244767
5454    return 0
5555
5656
57if (len(sys.argv) < 2) :
57if len(sys.argv) < 2:
5858    print('Usage:')
5959    print('  makelist <source.lst>')
6060    sys.exit(0)
6161
62if (parse_file(sys.argv[1])) :
62if parse_file(sys.argv[1]) :
6363    sys.exit(1)
6464
6565# output a count
66if (len(drivlist)==0) :
66if len(drivlist)==0 :
6767    sys.stderr.write("No drivers found\n")
6868    sys.exit(1)
6969
r244766r244767
7373drivlist.append("___empty")
7474
7575# start with a header
76print('#include "emu.h"\n');
77print('#include "drivenum.h"\n');
76print('#include "emu.h"\n')
77print('#include "drivenum.h"\n')
7878
7979#output the list of externs first
8080for drv in sorted(drivlist):
81   print("GAME_EXTERN(%s);" % drv)
81    print("GAME_EXTERN(%s);" % drv)
8282print("")
8383
8484# then output the array
8585print("const game_driver * const driver_list::s_drivers_sorted[%d] =" % len(drivlist))
8686print("{")
8787for drv in sorted(drivlist):
88   print("\t&GAME_NAME(%s)," % drv)
89print("};");
90print("");
88    print("\t&GAME_NAME(%s)," % drv)
89print("};")
90print("")
9191
9292# also output a global count
9393print("int driver_list::s_driver_count = %d;\n" % len(drivlist))
trunk/src/build/verinfo.py
r244766r244767
2323        elif flags and (sys.argv[i] == '-p'):
2424            format = 'plist'
2525        elif flags and (sys.argv[i] == '-b'):
26            i += 1;
26            i += 1
2727            if (i >= len(sys.argv)) or (sys.argv[i] not in ('mame', 'mess', 'ume')):
2828                usage()
2929            else:
3030                target = sys.argv[i]
3131        elif flags and (sys.argv[i] == '-o'):
32            i += 1;
32            i += 1
3333            if (i >= len(sys.argv)) or (output is not None):
3434                usage()
3535            else:
trunk/src/regtests/jedutil/jedtest.py
r244766r244767
5858    for test in tests:
5959        command = [jedUtilApp, "-view", test.jedFile, test.name]
6060        if VERBOSE:
61            print "Viewing the JED file: %s" % (test.jedFile)
62            print "Command: %s" % ((" ").join(command))
61            print "Viewing the JED file: %s" % test.jedFile
62            print "Command: %s" % " ".join(command)
6363
6464        process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
6565        (stdout,stderr) = process.communicate()
r244766r244767
8484    else:     
8585        jedUtilApp = os.path.normpath(os.path.join(currentDirectory, "..", "..", "..", "jedutil"))
8686
87    if (VERBOSE):
87    if VERBOSE:
8888        print "JED Path:      %s" % jedsPath
8989        print "Baseline Path: %s" % baselinePath
9090        print "Output Path:   %s" % outputPath
r244766r244767
109109
110110
111111    # Setup the output paths
112    if (VERBOSE):
112    if VERBOSE:
113113        print "Cleaning the output directory"
114114        print
115115    if os.path.exists(outputPath):


Previous 199869 Revisions Next


© 1997-2024 The MAME Team