2020-11-22 14:49:48 +03:00
|
|
|
#!/usr/bin/env python
|
2020-12-04 05:26:56 +03:00
|
|
|
import csv
|
2020-11-22 14:49:48 +03:00
|
|
|
import json
|
2020-11-22 14:54:59 +03:00
|
|
|
import os.path as path
|
2020-11-22 14:49:48 +03:00
|
|
|
import re
|
2020-12-04 05:26:56 +03:00
|
|
|
import sys
|
2020-11-22 14:49:48 +03:00
|
|
|
|
2020-11-22 14:54:59 +03:00
|
|
|
HERE = path.realpath(path.abspath(path.join(path.dirname(__file__), '..')))
|
|
|
|
|
|
|
|
with open(path.join(HERE, 'elm.json'), 'r') as fh:
|
2020-11-22 14:49:48 +03:00
|
|
|
modules = json.load(fh)["exposed-modules"]
|
|
|
|
|
|
|
|
widgets = {}
|
|
|
|
|
|
|
|
for module in modules:
|
|
|
|
match = re.match(r'^(.+)\.V(\d+)$', module)
|
|
|
|
if match is None:
|
|
|
|
continue
|
|
|
|
|
|
|
|
widget, current_version = match.groups()
|
|
|
|
current_version = int(current_version)
|
|
|
|
|
|
|
|
if widget in widgets:
|
|
|
|
highest_version, rest = widgets[widget]
|
|
|
|
if current_version > highest_version:
|
|
|
|
rest.append(highest_version)
|
|
|
|
widgets[widget] = (current_version, rest)
|
|
|
|
else:
|
|
|
|
rest.append(current_version)
|
|
|
|
else:
|
|
|
|
widgets[widget] = (current_version, [])
|
|
|
|
|
2020-12-04 05:26:56 +03:00
|
|
|
writer = csv.writer(sys.stdout)
|
|
|
|
|
2020-11-22 14:49:48 +03:00
|
|
|
for (widget, (latest, deprecated)) in widgets.items():
|
|
|
|
for version in deprecated:
|
2020-12-04 05:26:56 +03:00
|
|
|
writer.writerow((
|
2020-11-22 14:49:48 +03:00
|
|
|
'{}.V{}'.format(widget, version),
|
2020-12-04 05:26:56 +03:00
|
|
|
'upgrade to V{}'.format(latest),
|
|
|
|
))
|
|
|
|
|
|
|
|
sys.stdout.close()
|