Skip to content

Commit

Permalink
define valid Kodi versions at a single place
Browse files Browse the repository at this point in the history
  • Loading branch information
Rechi committed May 13, 2019
1 parent d5846c0 commit a8a438a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
9 changes: 9 additions & 0 deletions kodi_addon_checker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,12 @@
"""

__version__ = "0.0.14"

ValidKodiVersions = [
"gotham",
"helix",
"isengard",
"jarvis",
"krypton",
"leia",
]
5 changes: 2 additions & 3 deletions kodi_addon_checker/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import os
import sys

from kodi_addon_checker import __version__, check_addon
from kodi_addon_checker import __version__, check_addon, ValidKodiVersions
from kodi_addon_checker.check_repo import check_repo
from kodi_addon_checker.common import load_plugins
from kodi_addon_checker.config import Config, ConfigManager
Expand Down Expand Up @@ -60,7 +60,6 @@ def check_artifact(artifact_path, args, all_repo_addons):
def main():
"""The entry point to kodi-addon-checker
"""
choice = ['gotham', 'helix', 'isengard', 'jarvis', 'krypton', 'leia']
load_plugins()
parser = argparse.ArgumentParser(prog="kodi-addon-checker",
description="Checks Kodi repo for best practices and creates \
Expand All @@ -71,7 +70,7 @@ def main():
parser.add_argument("--version", action="version",
version="%(prog)s {version}".format(version=__version__))
parser.add_argument("dir", type=dir_type, nargs="*", help="optional add-on or repo directories")
parser.add_argument("--branch", choices=choice, required=True,
parser.add_argument("--branch", choices=ValidKodiVersions, required=True,
help="Target branch name where the checker will resolve dependencies")
parser.add_argument("--PR", help="Tell if tool is to run on a pull requests or not", action='store_true')
parser.add_argument("--allow-folder-id-mismatch", help="Allow the addon's folder name and id to mismatch",
Expand Down
5 changes: 2 additions & 3 deletions kodi_addon_checker/check_addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from . import (check_artwork, check_dependencies, check_entrypoint,
check_files, check_old_addon, check_py3_compatibility,
check_string, check_url, common, handle_files,
schema_validation)
schema_validation, ValidKodiVersions)
from .addons.Repository import Repository
from .record import INFORMATION, Record
from .report import Report
Expand Down Expand Up @@ -112,10 +112,9 @@ def get_all_repo_addons():
{'gotham':{'name_of_addon':'version_of_addon'}}
"""

branches = ['gotham', 'helix', 'isengard', 'jarvis', 'krypton', 'leia']
repo_addons = {}

for branch in branches:
for branch in ValidKodiVersions:
branch_url = ROOT_URL.format(branch=branch)
repo_addons[branch] = Repository(branch, branch_url)

Expand Down
3 changes: 2 additions & 1 deletion kodi_addon_checker/schema_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import xmlschema

from . import ValidKodiVersions
from .record import INFORMATION, PROBLEM, Record
from .report import Report

Expand Down Expand Up @@ -115,7 +116,7 @@ def _validate(xml, schemapath):


def check_version(branch_name, schema_file):
all_branches = ['leia', 'krypton', 'jarvis', 'isengard', 'helix', 'gotham']
all_branches = ValidKodiVersions[::-1]
branches = all_branches[all_branches.index(branch_name)::1]
for branch in branches:
file = branch + '_' + schema_file
Expand Down

0 comments on commit a8a438a

Please sign in to comment.