You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xeplist-to-csv.py 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/python3
  2. import csv
  3. import sys
  4. import xml.etree.ElementTree as etree
  5. from xeplib import load_xepinfos
  6. def main():
  7. import argparse
  8. parser = argparse.ArgumentParser()
  9. parser.add_argument(
  10. "-l", "--xeplist",
  11. type=argparse.FileType("rb"),
  12. default=None,
  13. help="XEP list to use (defaults to ./build/xeplist.xml)"
  14. )
  15. parser.add_argument(
  16. "-d", "--dialect",
  17. default="unix",
  18. )
  19. parser.add_argument(
  20. "outfile",
  21. )
  22. args = parser.parse_args()
  23. if args.xeplist is None:
  24. args.xeplist = open("./build/xeplist.xml", "rb")
  25. with args.xeplist as f:
  26. tree = etree.parse(f)
  27. accepted, _ = load_xepinfos(tree)
  28. with open(args.outfile, "w") as f:
  29. writer = csv.writer(f, args.dialect)
  30. for number, info in sorted(accepted.items()):
  31. writer.writerow([
  32. number,
  33. info["title"],
  34. info["status"].value,
  35. info["last_revision"]["date"].date(),
  36. info["last_revision"]["version"],
  37. ])
  38. if __name__ == "__main__":
  39. main()