summaryrefslogtreecommitdiffstats
path: root/Tools/scripts/import_diagnostics.py
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/scripts/import_diagnostics.py')
-rwxr-xr-xTools/scripts/import_diagnostics.py22
1 files changed, 10 insertions, 12 deletions
diff --git a/Tools/scripts/import_diagnostics.py b/Tools/scripts/import_diagnostics.py
index 1aa12b3..c907221 100755
--- a/Tools/scripts/import_diagnostics.py
+++ b/Tools/scripts/import_diagnostics.py
@@ -7,27 +7,25 @@ from pprint import pprint
def _dump_state(args):
print(sys.version)
- print("sys.path:")
- pprint(sys.path)
- print("sys.meta_path")
- pprint(sys.meta_path)
- print("sys.path_hooks")
- pprint(sys.path_hooks)
- print("sys.path_importer_cache")
- pprint(sys.path_importer_cache)
- print("sys.modules:")
- pprint(sys.modules)
+ for name in args.attributes:
+ print("sys.{}:".format(name))
+ pprint(getattr(sys, name))
+
+def _add_dump_args(cmd):
+ cmd.add_argument("attributes", metavar="ATTR", nargs="+",
+ help="sys module attribute to display")
COMMANDS = (
- ("dump", "Dump import state", _dump_state),
+ ("dump", "Dump import state", _dump_state, _add_dump_args),
)
def _make_parser():
parser = argparse.ArgumentParser()
sub = parser.add_subparsers(title="Commands")
- for name, description, implementation in COMMANDS:
+ for name, description, implementation, add_args in COMMANDS:
cmd = sub.add_parser(name, help=description)
cmd.set_defaults(command=implementation)
+ add_args(cmd)
return parser
def main(args):