Skip to content

Commit

Permalink
Added: Reject add-ons targeting Python 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
basrieter committed Apr 25, 2024
1 parent 7b59cea commit d3637f0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kodi_addon_checker/check_addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ def start(addon_path, args, all_repo_addons, config=None):
addon_xml = check_files.check_addon_xml(addon_report, addon_path, parsed_xml, args.allow_folder_id_mismatch)

if addon_xml is not None:
check_addon_branches.check_for_existing_addon(addon_report, Addon(parsed_xml), all_repo_addons, args)
addon = Addon(parsed_xml)
check_dependencies.check_python_dependency(addon_report, addon)
check_addon_branches.check_for_existing_addon(addon_report, addon, all_repo_addons, args)

if not addon_xml.findall("*//broken") and \
not (addon_xml.findall("*//lifecyclestate") and \
Expand Down
13 changes: 13 additions & 0 deletions kodi_addon_checker/check_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,19 @@
LOGGER = logging.getLogger(__name__)


def check_python_dependency(report: Report, addon: Addon):
""" Checks if the Python dependency targets version 3 or highter.
:report: the report object
:addon: the Addon object (contains id and version)
"""

for dependency in addon.dependencies:
if dependency.id == 'xbmc.python' and dependency.version < AddonVersion("3.0.0"):
report.add(Record(PROBLEM, "Add-ons should target Python 3 and up."))
return


def check_addon_dependencies(report: Report, repo_addons: dict, parsed_xml, args):
"""Check for any new dependencies in addon.xml file and reports them
:parsed_xml: parsed addon.xml file
Expand Down

0 comments on commit d3637f0

Please sign in to comment.