#!/usr/bin/env python3 """ Installs a provided symbol file into the symbols repository at the correct subdirectory for `minidump_stackwalk` to automatically find. """ if __name__ == '__main__': import argparse import os import shutil import sys def main(): default_dst = os.path.join( os.path.dirname( os.path.realpath(__file__) ), "symbols" ) parser = argparse.ArgumentParser() parser.add_argument('--dst', dest='dst', type=str, required=False, default=default_dst) parser.add_argument('src', type=str) args = parser.parse_args() with open(args.src) as f: header = f.readline() field, system, arch, id, name = header.strip().split(' ') print(f"Installing {name}: {id}", file=sys.stderr) dst_dir = os.path.join(args.dst, name, id) os.makedirs(dst_dir, exist_ok=True) dst_path = os.path.join(dst_dir, f"{name}.sym") shutil.copyfile(args.src, dst_path) main()