diff options
Diffstat (limited to 'scripts/minimaws/minimaws.py')
-rwxr-xr-x | scripts/minimaws/minimaws.py | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/scripts/minimaws/minimaws.py b/scripts/minimaws/minimaws.py index 656956a0275..72e1803ed8e 100755 --- a/scripts/minimaws/minimaws.py +++ b/scripts/minimaws/minimaws.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 ## ## license:BSD-3-Clause ## copyright-holders:Vas Crabb @@ -26,11 +26,17 @@ ## $ python minimaws.py listclones "unkch*" ## $ python minimaws.py listbrothers superx ## +## The romident command does not support 7zip archives, but it's far +## faster than using MAME as it has optimised indexes, and results are +## grouped by machine rather than by file: +## +## $ python minimaws.py romident 27c64.bin dump-dir +## ## One more sophisticated query command is provided that MAME has no ## equivalent for. The listaffected command shows all runnable machines ## that reference devices defined in specified source files: ## -## $ python minimaws.py listaffected "src/devices/cpu/m6805/*" src/devices/cpu/mcs40/mcs40.cpp +## $ python minimaws.py listaffected "devices/cpu/m6805/*" devices/cpu/mcs40/mcs40.cpp ## ## This script can also run a local web server allowing you to explore ## systems, devices and source files: @@ -71,16 +77,15 @@ ## On any of these, and many other systems, you can select slot options ## and see dependent slots update. Required command-line arguments to ## produce the selected configuration are also displayed. - -import lib.auxverbs -import lib.lxparse -import lib.wsgiserve - -import argparse -import sys - +## +## Media files can be identified using a web browser interface +## +## Checksums and digests are calculated locally - no files are uploaded +## to the server. if __name__ == '__main__': + import argparse + parser = argparse.ArgumentParser() parser.add_argument('--database', metavar='<dbfile>', default='minimaws.sqlite3', help='SQLite 3 info database file (defaults to minimaws.sqlite3)') subparsers = parser.add_subparsers(title='commands', dest='command', metavar='<command>') @@ -100,6 +105,9 @@ if __name__ == '__main__': subparser = subparsers.add_parser('listaffected', help='show drivers affected by source change(s)') subparser.add_argument('pattern', nargs='+', metavar='<pat>', help='source file glob pattern') + subparser = subparsers.add_parser('romident', help='identify ROM dump(s)') + subparser.add_argument('path', nargs='+', metavar='<path>', help='ROM dump file/directory path') + subparser = subparsers.add_parser('serve', help='serve over HTTP') subparser.add_argument('--port', metavar='<port>', default=8080, type=int, help='server TCP port') subparser.add_argument('--host', metavar='<host>', default='', help='server TCP hostname') @@ -108,8 +116,11 @@ if __name__ == '__main__': group = subparser.add_mutually_exclusive_group(required=True) group.add_argument('--executable', metavar='<exe>', help='emulator executable') group.add_argument('--file', metavar='<xmlfile>', help='XML machine information file') + subparser.add_argument('--softwarepath', required=True, action='append', metavar='<path>', help='Software list directory path') options = parser.parse_args() + + import lib.auxverbs if options.command == 'listfull': lib.auxverbs.do_listfull(options) elif options.command == 'listsource': @@ -120,7 +131,17 @@ if __name__ == '__main__': lib.auxverbs.do_listbrothers(options) elif options.command == 'listaffected': lib.auxverbs.do_listaffected(options) + elif options.command == 'romident': + lib.auxverbs.do_romident(options) elif options.command == 'serve': - lib.wsgiserve.run_server(options) + import wsgiref.simple_server + import lib.wsgiserve + application = lib.wsgiserve.MiniMawsApp(options.database) + server = wsgiref.simple_server.make_server(options.host, options.port, application) + try: + server.serve_forever() + except KeyboardInterrupt: + pass elif options.command == 'load': + import lib.lxparse lib.lxparse.load_info(options) |