from budget_sync.write_budget_markdown import (write_budget_markdown,
markdown_for_person)
+def spc(s):
+ return s.replace(" ", " ")
+
def main():
parser = argparse.ArgumentParser(
help="Log in with this Bugzilla password")
parser.add_argument('--comments', action='store_true',
help="Put JSON into comments")
+ parser.add_argument('--detail', action='store_true',
+ help="Add detail to report (links description people)")
args = parser.parse_args()
try:
with args.config as config_file:
reportdir = "/".join(reportdir.split("/")[:-1]) # strip /mdwn
reportname = reportdir + "/report.mdwn"
with open(reportname, "w") as f:
- print("```", file=f) # for using the output as markdown
+ print("<tt>", file=f) # for using the output as markdown
bz = Bugzilla(config.bugzilla_url)
if args.username:
logging.debug("logging in...")
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(f, budget_graph)
- print("```", file=f) # for using the output as markdown
+ summarize_milestones(f, budget_graph, detail=args.detail)
+ print("</tt>", file=f) # for using the output as markdown
# now create the JSON milestone files for putting into NLnet RFP system
json_milestones(budget_graph, args.comments, args.output_dir)
print(markdown_for_person(budget_graph, person, nodes_subset), file=f)
-def print_budget_then_children(f, indent, nodes, bug_id):
+def print_budget_then_children(f, indent, nodes, bug_id, detail=False):
"""recursive indented printout of budgets
"""
excl_desc = " "
if b_incl != b_excl:
excl_desc = "excltasks %6s" % b_excl
- print("bug #%5d %s budget %6s %s %s" %
- (bug.bug.id, ' | ' * indent,
- b_incl,
- excl_desc,
- descr
- ), file=f)
+ print(spc("bug #%5d %s budget %6s %s %s<br>" %
+ (bug.bug.id, ' | ' * indent,
+ b_incl,
+ excl_desc,
+ descr
+ )), file=f)
+ if detail:
+ print(spc(" %s | (%s)<br>" %
+ (' | ' * indent,
+ bug.bug.summary[:40]
+ )), file=f)
# 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(f, indent+1, nodes, child.bug.id)
+ print_budget_then_children(f, indent+1, nodes, child.bug.id, detail)
-def summarize_milestones(f, budget_graph):
+def summarize_milestones(f, budget_graph, detail=False):
for milestone, payments in budget_graph.milestone_payments.items():
summary = PaymentSummary(payments)
- print(f"{milestone.identifier}", file=f)
+ print(f"{milestone.identifier}<br>", file=f)
print(f"\t{summary.total} submitted: "
- f"{summary.total_submitted} paid: {summary.total_paid}", file=f)
+ f"{summary.total_submitted} paid: {summary.total_paid}<br>",
+ file=f)
not_submitted = summary.get_not_submitted()
if not_submitted:
- print("not submitted", not_submitted, file=f)
+ print("not submitted<br>", not_submitted, file=f)
# and one to display people
for person in budget_graph.milestone_people[milestone]:
- print("\t%-30s - %s" % (person.identifier, person.full_name),
+ print(spc("\t%-30s - %s<br>" % (person.identifier,
+ person.full_name)),
file=f)
- print(file=f)
+ print("<br>", file=f)
# now do trees
for milestone, payments in budget_graph.milestone_payments.items():
- print("%s %d" % (milestone.identifier, milestone.canonical_bug_id),
+ print("%s %d<br>" % (milestone.identifier, milestone.canonical_bug_id),
file=f)
print_budget_then_children(f, 0, budget_graph.nodes,
- milestone.canonical_bug_id)
- print(file=f)
+ milestone.canonical_bug_id, detail)
+ print("<br>", file=f)
def json_milestones(budget_graph: BudgetGraph, add_comments: bool,