https://bugs.libre-soc.org/show_bug.cgi?id=1171
all output going temporarily to a report.mdwn, TODO to make it an
option on the commandline, this is so that report.mdwn (summary)
can be joined by a *second* more detailed report (or an option
to create one)
logging.error("Failed to parse config file: %s", e)
return
logging.info("Using Bugzilla instance at %s", config.bugzilla_url)
logging.error("Failed to parse config file: %s", e)
return
logging.info("Using Bugzilla instance at %s", config.bugzilla_url)
- print("```") # for using the output as markdown
+ f = open("/tmp/report.mdwn", "w")
+ print("```", file=f) # for using the output as markdown
bz = Bugzilla(config.bugzilla_url)
if args.username:
logging.debug("logging in...")
bz = Bugzilla(config.bugzilla_url)
if args.username:
logging.debug("logging in...")
if not args.person:
logging.fatal("must use --subset-person with --subset option")
sys.exit(1)
if not args.person:
logging.fatal("must use --subset-person with --subset option")
sys.exit(1)
- print_markdown_for_person(budget_graph, config,
+ print_markdown_for_person(f, budget_graph, config,
args.person, args.subset)
return
if args.output_dir is not None:
write_budget_markdown(budget_graph, args.output_dir)
write_budget_csv(budget_graph, args.output_dir)
args.person, args.subset)
return
if args.output_dir is not None:
write_budget_markdown(budget_graph, args.output_dir)
write_budget_csv(budget_graph, args.output_dir)
- summarize_milestones(budget_graph)
- print("```") # for using the output as markdown
+ summarize_milestones(f, budget_graph)
+ print("```", file=f) # for using the output as markdown
json_milestones(budget_graph, args.comments, args.output_dir)
json_milestones(budget_graph, args.comments, args.output_dir)
-def print_markdown_for_person(budget_graph: BudgetGraph, config: Config,
- person_str: str, subset_str: Optional[str]):
+def print_markdown_for_person(f, budget_graph, config, person_str, subset_str):
person = config.all_names.get(person_str)
if person is None:
logging.fatal("--subset-person: unknown person: %s", person_str)
person = config.all_names.get(person_str)
if person is None:
logging.fatal("--subset-person: unknown person: %s", person_str)
logging.fatal("--subset: unknown bug: %s", bug_id)
sys.exit(1)
nodes_subset.add(node)
logging.fatal("--subset: unknown bug: %s", bug_id)
sys.exit(1)
nodes_subset.add(node)
- print(markdown_for_person(budget_graph, person, nodes_subset))
+ print(markdown_for_person(budget_graph, person, nodes_subset), file=f)
-def print_budget_then_children(indent, nodes, bug_id):
+def print_budget_then_children(f, indent, nodes, bug_id):
"""recursive indented printout of budgets
"""
"""recursive indented printout of budgets
"""
# print(repr(bug))
for child in bug.immediate_children:
if (str(child.budget_including_subtasks) == "0" and
str(child.budget_excluding_subtasks) == "0"):
continue
# print(repr(bug))
for child in bug.immediate_children:
if (str(child.budget_including_subtasks) == "0" and
str(child.budget_excluding_subtasks) == "0"):
continue
- print_budget_then_children(indent+1, nodes, child.bug.id)
+ print_budget_then_children(f, indent+1, nodes, child.bug.id)
-def summarize_milestones(budget_graph: BudgetGraph):
+def summarize_milestones(f, budget_graph):
for milestone, payments in budget_graph.milestone_payments.items():
summary = PaymentSummary(payments)
for milestone, payments in budget_graph.milestone_payments.items():
summary = PaymentSummary(payments)
- print(f"{milestone.identifier}")
+ print(f"{milestone.identifier}", file=f)
print(f"\t{summary.total} submitted: "
print(f"\t{summary.total} submitted: "
- f"{summary.total_submitted} paid: {summary.total_paid}")
+ f"{summary.total_submitted} paid: {summary.total_paid}", file=f)
not_submitted = summary.get_not_submitted()
if not_submitted:
not_submitted = summary.get_not_submitted()
if not_submitted:
- print("not submitted", not_submitted)
+ print("not submitted", not_submitted, file=f)
# and one to display people
for person in budget_graph.milestone_people[milestone]:
# and one to display people
for person in budget_graph.milestone_people[milestone]:
- print(f"\t%-30s - %s" % (person.identifier, person.full_name))
- print()
+ print("\t%-30s - %s" % (person.identifier, person.full_name),
+ file=f)
+ print(file=f)
# now do trees
for milestone, payments in budget_graph.milestone_payments.items():
# now do trees
for milestone, payments in budget_graph.milestone_payments.items():
- print("%s %d" % (milestone.identifier, milestone.canonical_bug_id))
- print_budget_then_children(0, budget_graph.nodes,
+ print("%s %d" % (milestone.identifier, milestone.canonical_bug_id),
+ file=f)
+ print_budget_then_children(f, 0, budget_graph.nodes,
milestone.canonical_bug_id)
milestone.canonical_bug_id)
def json_milestones(budget_graph: BudgetGraph, add_comments: bool,
def json_milestones(budget_graph: BudgetGraph, add_comments: bool,