ldcheck.py

changeset 77
d98502ae1f33
parent 63
8949af6a4279
child 81
e65d82501a38
equal deleted inserted replaced
76:c73432653fd9 77:d98502ae1f33
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 = ListTestSuiteAction,
89 help = 'Lists all possible checks and exit', 89 help = 'Lists all possible checks and exit',
90 ) 90 )
91 parser.add_argument('--dump-structure', action = 'store_true') 91 parser.add_argument('--dump', action = 'store_true')
92 parser.add_argument('--rebuild', action = 'store_true') 92 parser.add_argument('--rebuild', action = 'store_true')
93 parser.add_argument('--flatness', action = 'store_true') 93 parser.add_argument('--flatness', action = 'store_true')
94 args = parser.parse_args() 94 args = parser.parse_args()
95 config = load_config('ldcheck.cfg') 95 config = load_config('ldcheck.cfg')
96 for ldconfig_ldr_path in find_ldconfig_ldr_paths(config): 96 for ldconfig_ldr_path in find_ldconfig_ldr_paths(config):
117 from os.path import basename 117 from os.path import basename
118 model = parse.read_ldraw( 118 model = parse.read_ldraw(
119 file, 119 file,
120 name = basename(args.filename), 120 name = basename(args.filename),
121 ldraw_directories = config['libraries']) 121 ldraw_directories = config['libraries'])
122 if args.dump_structure: 122 if args.dump:
123 print('header: ' + type(model.header).__name__) 123 print('header: ' + type(model.header).__name__)
124 for key in sorted(dir(model.header)): 124 for key in sorted(dir(model.header)):
125 if not key.startswith('__'): 125 if not key.startswith('__'):
126 print('\t' + key + ': ' + repr(getattr(model.header, key))) 126 print('\t' + key + ': ' + repr(getattr(model.header, key)))
127 for entry in model.body: 127 for i, entry in enumerate(model.body):
128 if model.header.valid and i == model.header_size:
129 print('--------- End of header')
128 print(entry) 130 print(entry)
129 elif args.rebuild: 131 elif args.rebuild:
130 for entry in model.body: 132 for entry in model.body:
131 print(entry.textual_representation(), end = '\r\n') 133 print(entry.textual_representation(), end = '\r\n')
132 else: 134 else:

mercurial