| 62 if (library_path / path).is_file() |
62 if (library_path / path).is_file() |
| 63 ] |
63 ] |
| 64 |
64 |
| 65 import argparse |
65 import argparse |
| 66 |
66 |
| 67 class ListTestSuiteAction(argparse.Action): |
67 class ListProblemsAction(argparse.Action): |
| 68 def __init__(self, option_strings, dest, nargs = None, **kwargs): |
68 def __init__(self, option_strings, dest, nargs = None, **kwargs): |
| 69 super().__init__(option_strings, dest, nargs = 0, **kwargs) |
69 super().__init__(option_strings, dest, nargs = 0, **kwargs) |
| 70 def __call__(self, *args, **kwargs): |
70 def __call__(self, *args, **kwargs): |
| 71 import testsuite |
71 import testsuite |
| 72 from sys import exit |
72 from sys import exit |
| 83 if __name__ == '__main__': |
83 if __name__ == '__main__': |
| 84 from sys import argv |
84 from sys import argv |
| 85 parser = argparse.ArgumentParser() |
85 parser = argparse.ArgumentParser() |
| 86 parser.add_argument('filename') |
86 parser.add_argument('filename') |
| 87 parser.add_argument('--list', |
87 parser.add_argument('--list', |
| 88 action = ListTestSuiteAction, |
88 action = ListProblemsAction, |
| 89 help = 'Lists all possible checks and exit', |
89 help = 'lists all possible problem types and exit', |
| 90 ) |
90 ) |
| 91 parser.add_argument('--dump', action = 'store_true') |
91 parser.add_argument('--dump', |
| 92 parser.add_argument('--rebuild', action = 'store_true') |
92 action = 'store_true', |
| 93 parser.add_argument('--flatness', action = 'store_true') |
93 help = 'dumps the internal parsed structure of the part file', |
| |
94 ) |
| |
95 parser.add_argument('--rebuild', |
| |
96 action = 'store_true', |
| |
97 help = 'parses the part file and prints it back out, used for ' |
| |
98 'testing whether the program interprets part files correctly', |
| |
99 ) |
| |
100 parser.add_argument('--flatness', |
| |
101 action = 'store_true', |
| |
102 help = 'finds a primitive by name and prints out in which ' |
| |
103 'dimensions it is flat in', |
| |
104 ) |
| 94 args = parser.parse_args() |
105 args = parser.parse_args() |
| 95 config = load_config('ldcheck.cfg') |
106 config = load_config('ldcheck.cfg') |
| 96 for ldconfig_ldr_path in find_ldconfig_ldr_paths(config): |
107 for ldconfig_ldr_path in find_ldconfig_ldr_paths(config): |
| 97 with ldconfig_ldr_path.open() as ldconfig_ldr: |
108 with ldconfig_ldr_path.open() as ldconfig_ldr: |
| 98 load_colours(ldconfig_ldr) |
109 load_colours(ldconfig_ldr) |