Skip to content

Commit

Permalink
Basically allow running reports from a saved graph file.
Browse files Browse the repository at this point in the history
This still has some issues with recreating the MacrogenesisInfo structure
  • Loading branch information
thvitt committed Mar 20, 2019
1 parent db6ce1b commit 705b72a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
5 changes: 3 additions & 2 deletions src/macrogen/config.py
Expand Up @@ -271,8 +271,9 @@ def _apply_override(self, override=None):
override = self.config_override
for key, value in override.items():
if value is not None:
logger.info('Overriding %s=%s with %s', key, self.config[key], value)
self.config[key] = value
if key in self.config:
logger.info('Overriding %s=%s with %s', key, self.config[key], value)
self.config[key] = value

def __getattr__(self, item):
if item == 'config' and not self.config_loaded:
Expand Down
34 changes: 21 additions & 13 deletions src/macrogen/main.py
Expand Up @@ -2,6 +2,7 @@

import sys
from argparse import ArgumentParser
from pathlib import Path

from macrogen.config import config
from . import graph
Expand All @@ -10,26 +11,33 @@
from .config import config

def main(argv=sys.argv):
parser = ArgumentParser(argv[0])
parser = ArgumentParser()
parser.add_argument('-i', '--input', metavar='ZIP', help='Loads graph from zip file and runs the reporting', type=Path)
parser.add_argument('-o', '--output', metavar='ZIP', help='Saves graph to given zip file', type=Path)
parser.add_argument('--skip-reports', action='store_true', help='Do not write reports (use with -o)')
group = parser.add_argument_group("Configuration options")
config.prepare_options(group)
options = parser.parse_args(argv[1:])
config.config_override = vars(options)

graphs = graph.macrogenesis_graphs()
graphs = graph.MacrogenesisInfo(options.input)

report.write_order_xml(graphs)
if options.output:
graphs.save(options.output)

if not options.skip_reports:
report.write_order_xml(graphs)
report.report_help()
report.report_refs(graphs)
report.report_scenes(graphs)
report.report_missing(graphs)
report.report_components(graphs)
report.report_conflicts(graphs)
report.report_sources(graphs)
report.report_index(graphs)
report.report_downloads(graphs)
render_all()

report.report_help()
report.report_refs(graphs)
report.report_scenes(graphs)
report.report_missing(graphs)
report.report_components(graphs)
report.report_conflicts(graphs)
report.report_sources(graphs)
report.report_index(graphs)
report.report_downloads(graphs)
render_all()


if __name__ == '__main__':
Expand Down

0 comments on commit 705b72a

Please sign in to comment.