Repository navigation
Expand file tree
/
Copy pathreport.py
More file actions
37 lines (31 loc) · 1.65 KB
/
Copy pathreport.py
File metadata and controls
37 lines (31 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import argparse
import logging
import time
from pathlib import Path
from src.common import endoflife
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Create report on product automation.')
parser.add_argument('-p', '--product-dir', required=True, help='path to the product directory')
args = parser.parse_args()
scripts_dir = Path(__file__).resolve().parent / 'src'
unused_method_candidates = {script.stem for script in scripts_dir.glob('*.py') if not script.stem.startswith('_')}
products_dir = Path(args.product_dir)
products = endoflife.list_products(products_dir)
count_auto = sum(1 for product in products if product.auto_configs())
print(f"As of {time.strftime('%Y-%m-%d')}, {count_auto} of the {len(products)} products"
f" tracked by endoflife.date have automatically tracked releases:")
print()
print('| Product | Permalink | Auto | Method(s) |')
print('|---------|-----------|------|-----------|')
for product in products:
title = product.get_title()
permalink = product.get_permalink()
auto = '✔️' if product.has_auto_configs() else '❌'
configs = product.auto_configs()
methods = ', '.join(sorted({config.method for config in configs}))
unused_method_candidates.difference_update(config.method for config in configs)
print(f"| {title} | [`{permalink}`](https://endoflife.date{permalink}) | {auto} | {methods} |")
print()
print('This table has been generated by [report.py](/report.py).\n')
if unused_method_candidates:
logging.warning('Unused auto methods: %s', ', '.join(sorted(unused_method_candidates)))