Commit 093e2342 authored by José Henrique's avatar José Henrique
Browse files

Set flag as deprecated automatically

parent cb7c759e
......@@ -97,6 +97,15 @@ def is_device_deprecated(device_codename, version, devices):
if supported_version["version_code"] == version:
return "deprecated" in supported_version and supported_version["deprecated"]
return False
def is_device_version_deprecated_by_maintainer(device_codename, version, lead, core, maintainers):
for roles in [maintainers, [lead]]:
for member in roles:
for member_device in member["devices"]:
if member_device["codename"] == device_codename and version in member_device["versions"]:
return False
return True
def format_json():
......@@ -135,6 +144,11 @@ def format_json():
for device in devices_to_remove:
# Set deprecated flag
for device in devices:
for supported_version in device["supported_versions"]:
supported_version["deprecated"] = is_device_version_deprecated_by_maintainer(device["codename"], supported_version["version_code"], lead, core, maintainers)
# Sort JSON alphabetically with selected keys
devices = sorted(devices, key=operator.itemgetter('codename', 'brand'))
core = sorted(core, key=operator.itemgetter('name', 'country'))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment