From: Magnus Jacobsson Date: Sun, 7 Jun 2020 14:05:58 +0000 (+0200) Subject: Add ci/generate-configuration-table.py X-Git-Tag: 2.44.1~11^2^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a6199cb026c30a615cad7870a971153e3f07a2d5;p=graphviz Add ci/generate-configuration-table.py --- diff --git a/ci/generate-configuration-table.py b/ci/generate-configuration-table.py new file mode 100755 index 000000000..6afcf0d03 --- /dev/null +++ b/ci/generate-configuration-table.py @@ -0,0 +1,50 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- + +from optparse import OptionParser +import os + +def main(): + parser = OptionParser(usage='usage: %prog [options] files...') + parser.description = 'Generate a table of the Graphviz compile ' \ + 'configuration for different platforms from files generated by the ' \ + './configure command.' + parser.add_option('-v', '--verbose', action='store_true', + dest='verbose', default=False, + help='Log info about what is going on') + + (opts, args) = parser.parse_args() + + table = {} + table_sections = [] + component_names = {} + platforms = [] + + for filename in args: + os_path = os.path.dirname(filename) + os_version_id = os.path.basename(os_path) + os_id = os.path.basename(os.path.dirname(os_path)) + platform = os_id.capitalize() + ' ' + os_version_id + if platform not in platforms: + platforms.append(platform) + fp = open(filename, 'r') + lines = fp.readlines() + for line in lines: + item = [item.strip() for item in line.split(':')] + if len(item) == 2: + if item[1] == '': + section_name = item[0] + if section_name not in table: + table[section_name] = {}; + table_sections.append(section_name) + component_names[section_name] = [] + else: + component_name, component_value = item; + if component_name not in table[section_name]: + table[section_name][component_name] = {}; + component_names[section_name].append(component_name) + table[section_name][component_name][platform] = component_value + +# Python trick to get a main routine +if __name__ == "__main__": + main()