61 |
61 |
62 'content': report_util.ReportShortcut( |
62 'content': report_util.ReportShortcut( |
63 os.path.join(ROOT_PATH, 'info_content_report_template.html'), |
63 os.path.join(ROOT_PATH, 'info_content_report_template.html'), |
64 'content_report.html', |
64 'content_report.html', |
65 'Create a report of the content files in the configuration.'), |
65 'Create a report of the content files in the configuration.'), |
|
66 'ctr_csv': report_util.ReportShortcut( |
|
67 os.path.join(ROOT_PATH, 'info_ctr_report_template.csv'), |
|
68 'ctr_report.csv', |
|
69 'Create a report of CTR configurations (CSV format).'), |
|
70 'ctr': report_util.ReportShortcut( |
|
71 os.path.join(ROOT_PATH, 'info_ctr_report_template.html'), |
|
72 'ctr_report.html', |
|
73 'Create a report of CTR configurations.'), |
66 } |
74 } |
67 |
75 |
68 def main(): |
76 def main(): |
69 """ Get information about project / configurations. """ |
77 """ Get information about project / configurations. """ |
70 shortcut_container = report_util.ReportShortcutContainer(REPORT_SHORTCUTS, |
78 shortcut_container = report_util.ReportShortcutContainer(REPORT_SHORTCUTS, |
222 options.report, |
230 options.report, |
223 report_name) |
231 report_name) |
224 data_providers = {'impl_data' : ImplDataProvider(configs[0], options.impl_filter), |
232 data_providers = {'impl_data' : ImplDataProvider(configs[0], options.impl_filter), |
225 'api_data' : ApiDataProvider(configs[0]), |
233 'api_data' : ApiDataProvider(configs[0]), |
226 'content_data': ContentDataProvider(configs[0]), |
234 'content_data': ContentDataProvider(configs[0]), |
227 'value_data' : ValueDataProvider(configs, view)} |
235 'value_data' : ValueDataProvider(configs, view), |
|
236 'ctr_data' : CtrDataProvider(configs)} |
228 report_util.generate_report(template, report, {'data': ReportDataProxy(data_providers)}, [ROOT_PATH]) |
237 report_util.generate_report(template, report, {'data': ReportDataProxy(data_providers)}, [ROOT_PATH]) |
229 else: |
238 else: |
230 # Printing configuration info |
239 # Printing configuration info |
231 config_name = config_list[0] |
240 config_name = config_list[0] |
232 config = current.get_configuration(config_name) |
241 config = current.get_configuration(config_name) |
366 entry.file = ref |
375 entry.file = ref |
367 entry.actual_files = layered_content.get_values(ref) |
376 entry.actual_files = layered_content.get_values(ref) |
368 data.append(entry) |
377 data.append(entry) |
369 return data |
378 return data |
370 |
379 |
|
380 class CtrDataProvider(ReportDataProviderBase): |
|
381 def __init__(self, configs): |
|
382 self._configs = configs |
|
383 |
|
384 def generate_data(self): |
|
385 lines = [] |
|
386 for config in self._configs: |
|
387 lines.extend(self._get_config_data(config)) |
|
388 return lines |
|
389 |
|
390 def _get_config_data(self, config): |
|
391 ctrs = [] |
|
392 config_name = config.get_name() |
|
393 ctrs_in_meta_index = config.meta.find_by_attribute('name','based_on_ctr') |
|
394 ctrs = config.meta[ctrs_in_meta_index].attrs['value'].split(',') |
|
395 lines = [] |
|
396 ppbit = language = country = uda = '' |
|
397 for c in config.list_configurations(): |
|
398 m = re.search(r'/ppbit/ppbit_(.*)/', c) |
|
399 if m: ppbit = m.group(1) |
|
400 m = re.search(r'/language/(.*)/', c) |
|
401 if m: language = m.group(1) |
|
402 m = re.search(r'/country/(.*)/', c) |
|
403 if m: country = m.group(1) |
|
404 m = re.search(r'/uda/(.*)/', c) |
|
405 if m: uda = m.group(1) |
|
406 for ctr in ctrs: |
|
407 data = {'ctr_code': ctr, |
|
408 'config_name': config_name, |
|
409 'ppbit': ppbit, |
|
410 'language': language, |
|
411 'country': country, |
|
412 'uda': uda |
|
413 } |
|
414 lines.append(data) |
|
415 return lines |
|
416 |
371 |
417 |
372 class ValueDataProvider(ReportDataProviderBase): |
418 class ValueDataProvider(ReportDataProviderBase): |
373 |
419 |
374 class FeatureGroup(object): |
420 class FeatureGroup(object): |
375 def __init__(self, name, features): |
421 def __init__(self, name, features): |