from bugzilla import Bugzilla
import logging
import argparse
+from pathlib import Path
from budget_sync.util import all_bugs
from budget_sync.config import Config, ConfigParseError
from budget_sync.budget_graph import BudgetGraph, BudgetGraphBaseError
-
-
-BUGZILLA_URL = "https://bugs.libre-soc.org"
+from budget_sync.write_budget_markdown import write_budget_markdown
def main():
description="Check for errors in "
"Libre-SOC's style of budget tracking in Bugzilla.")
parser.add_argument(
- "-c, --config", type=argparse.FileType('r'),
+ "-c", "--config", type=argparse.FileType('r'),
required=True, help="The path to the configuration TOML file",
dest="config", metavar="<path/to/budget-sync-config.toml>")
+ parser.add_argument(
+ "-o", "--output-dir", type=Path, default=None,
+ help="The path to the output directory, will be created if it "
+ "doesn't exist",
+ dest="output_dir", metavar="<path/to/output/dir>")
args = parser.parse_args()
try:
with args.config as config_file:
budget_graph = BudgetGraph(all_bugs(bz), config)
for error in budget_graph.get_errors():
logging.error("%s", error)
+ if args.output_dir is not None:
+ write_budget_markdown(budget_graph, args.output_dir)
+ # quick hack to display total payment amounts per-milestone
+ for milestone, payments in budget_graph.milestone_payments.items():
+ print (milestone)
+ print ()
+ total = 0
+ for payment in payments:
+ print("\t", payment)
+ total += payment.amount
+ print ("\t", total)
if __name__ == "__main__":
main()