From c2f64c75b75adbb306c0429d66f57e4a9c74ed4f Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Sat, 30 Dec 2023 11:47:39 -0500 Subject: [PATCH] build: obtain xbmc addon versions dynamically (#29) --- addon.yaml | 1 - scripts/addon_yaml_to_xml.py | 9 ++++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/addon.yaml b/addon.yaml index 7084188..a3ae38d 100644 --- a/addon.yaml +++ b/addon.yaml @@ -31,7 +31,6 @@ addon: requires: import: - addon: "xbmc.python" - version: "3.0.1" - addon: "script.module.kodi-six" # this is a dependency of youtube-dl, but we need to put it here for CI tests - addon: "script.module.requests" - addon: "script.module.youtube.dl" diff --git a/scripts/addon_yaml_to_xml.py b/scripts/addon_yaml_to_xml.py index ecc752d..7735b87 100644 --- a/scripts/addon_yaml_to_xml.py +++ b/scripts/addon_yaml_to_xml.py @@ -3,12 +3,10 @@ import os # lib imports +from kodi_addon_checker.check_dependencies import VERSION_ATTRB as xbmc_versions from lxml import etree import yaml -# constants -xbmc_python_version = '3.0.1' # todo: obtain this dynamically - def handle_asset_elements( parent: etree.ElementBase, @@ -37,8 +35,9 @@ def yaml_to_xml_lxml(yaml_file: str) -> str: # if the version is specified in yaml, don't look it up # this allows pinning a requirement to a specific version continue - if requirement['addon'] == 'xbmc.python': - requirement['version'] = xbmc_python_version + if requirement['addon'].startswith('xbmc.'): + requirement['version'] = xbmc_versions[requirement['addon']][os.getenv( + 'KODI_BRANCH', 'Nexus').lower()]['advised'] elif requirement['addon'].startswith('script.module.'): requirement_xml = os.path.join( os.getcwd(), 'third-party', 'repo-scripts', requirement['addon'], 'addon.xml')