ldcheck.py

changeset 122
116a81996832
parent 116
60cac583b5df
child 145
fde18c4d6784
equal deleted inserted replaced
121:35b95d1806c9 122:116a81996832
27 if 'libraries' not in config: 27 if 'libraries' not in config:
28 config['libraries'] = ['/path/to/ldraw'] 28 config['libraries'] = ['/path/to/ldraw']
29 if config != read_config: 29 if config != read_config:
30 config.write() 30 config.write()
31 check_library_paths(config) 31 check_library_paths(config)
32 load_ldconfig_ldr(config)
32 return config 33 return config
33 34
34 def library_paths(config): 35 def library_paths(config):
35 for library_path_string in config['libraries']: 36 for library_path_string in config['libraries']:
36 yield Path(library_path_string).expanduser() 37 yield Path(library_path_string).expanduser()
84 severity = warning_type.severity, 85 severity = warning_type.severity,
85 message = warning_type.placeholder_message(), 86 message = warning_type.placeholder_message(),
86 )) 87 ))
87 exit(0) 88 exit(0)
88 89
90 def load_ldconfig_ldr(config):
91 for ldconfig_ldr_path in find_ldconfig_ldr_paths(config):
92 with ldconfig_ldr_path.open() as ldconfig_ldr:
93 load_colours(ldconfig_ldr)
94
89 def format_report(report, model, test_suite, *, use_colors = True): 95 def format_report(report, model, test_suite, *, use_colors = True):
90 from testsuite import problem_text 96 from testsuite import problem_text
91 messages = [] 97 messages = []
92 for problem in report['problems']: 98 for problem in report['problems']:
93 text_colour = '' 99 text_colour = ''
143 version = version_string, 149 version = version_string,
144 ), 150 ),
145 ) 151 )
146 args = parser.parse_args() 152 args = parser.parse_args()
147 config = load_config() 153 config = load_config()
148 for ldconfig_ldr_path in find_ldconfig_ldr_paths(config):
149 with ldconfig_ldr_path.open() as ldconfig_ldr:
150 load_colours(ldconfig_ldr)
151 if args.color: 154 if args.color:
152 try: 155 try:
153 import colorama 156 import colorama
154 colorama.init() 157 colorama.init()
155 except ImportError: 158 except ImportError:

mercurial