# Path: kiwixbuild/utils.py
# COLORS = {
#     'OK': '\033[92m',
#     'WARNING': '\033[93m',
#     'NEEDED': '\033[93m',
#     'SKIP': '\033[34m',
#     'ERROR': '\033[91m',
#     '': '\033[0m',
# }
# REMOTE_PREFIX = 'http://mirror.download.kiwix.org/dev/'
# def which(name):
# def xrun_find(name):
#     def __getattr__(self, name):
# def DefaultEnv():
# def remove_duplicates(iterable, key_function=None):
# def get_sha256(path):
# def colorize(text, color=None):
# def print_progress(progress):
# def add_execution_right(file_path):
# def copy_tree(src, dst, post_copy_function=None):
# def download_remote(what, where):
#     def __init__(self, msg=""):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __new__(cls, name, sha256, url=None):
#     def __init__(self, command_name, log_file, force_native_build):
#     def try_skip(self, path, extra_name=""):
#     def _finalise(self):
# def extract_archive(archive_path, dest_dir, topdir=None, name=None):
# def run_command(command, cwd, context, *, env=None, input=None):
# class Defaultdict(defaultdict):
# class BaseCommandResult(Exception):
# class SkipCommand(BaseCommandResult):
# class WarningMessage(BaseCommandResult):
# class StopBuild(BaseCommandResult):
# class Remotefile(namedtuple('Remotefile', ('name', 'sha256', 'url'))):
# class Context:
# 
# Path: kiwixbuild/versions.py

# 
# Path: kiwixbuild/_global.py
# def neutralEnv(what):
#     return getattr(_neutralEnv, what)
# 
# def option(what):
#     return getattr(_options, what)
# 
# def get_target_step(key, default_context=None):
#     if isinstance(key, tuple):
#         context, target = key
#     else:
#         context, target = default_context, key
#     return _target_steps[(context, target)]


import subprocess
import os
import shutil
import time
from kiwixbuild.utils import pj, Context, SkipCommand, WarningMessage, extract_archive, Defaultdict, StopBuild, run_command, colorize
from kiwixbuild.versions import main_project_versions, base_deps_versions
from kiwixbuild._global import neutralEnv, option, get_target_step


SCRIPT_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))


class _MetaDependency(type):
    def __new__(cls, name, bases, dct):
        _class = type.__new__(cls, name, bases, dct)
        if name != 'Dependency':
            dep_name = dct['name']
            Dependency.all_deps[dep_name] = _class
        return _class


class Dependency(metaclass=_MetaDependency):
    all_deps = {}
    force_build = False
    force_native_build = False
    dont_skip = False

    @classmethod
    def version(cls):
        if cls.name in base_deps_versions:
            return base_deps_versions[cls.name]

# Path: kiwixbuild/utils.py
# COLORS = {
#     'OK': '\033[92m',
#     'WARNING': '\033[93m',
#     'NEEDED': '\033[93m',
#     'SKIP': '\033[34m',
#     'ERROR': '\033[91m',
#     '': '\033[0m',
# }
# REMOTE_PREFIX = 'http://mirror.download.kiwix.org/dev/'
# def which(name):
# def xrun_find(name):
#     def __getattr__(self, name):
# def DefaultEnv():
# def remove_duplicates(iterable, key_function=None):
# def get_sha256(path):
# def colorize(text, color=None):
# def print_progress(progress):
# def add_execution_right(file_path):
# def copy_tree(src, dst, post_copy_function=None):
# def download_remote(what, where):
#     def __init__(self, msg=""):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __new__(cls, name, sha256, url=None):
#     def __init__(self, command_name, log_file, force_native_build):
#     def try_skip(self, path, extra_name=""):
#     def _finalise(self):
# def extract_archive(archive_path, dest_dir, topdir=None, name=None):
# def run_command(command, cwd, context, *, env=None, input=None):
# class Defaultdict(defaultdict):
# class BaseCommandResult(Exception):
# class SkipCommand(BaseCommandResult):
# class WarningMessage(BaseCommandResult):
# class StopBuild(BaseCommandResult):
# class Remotefile(namedtuple('Remotefile', ('name', 'sha256', 'url'))):
# class Context:
# 
# Path: kiwixbuild/versions.py

# 
# Path: kiwixbuild/_global.py
# def neutralEnv(what):
#     return getattr(_neutralEnv, what)
# 
# def option(what):
#     return getattr(_options, what)
# 
# def get_target_step(key, default_context=None):
#     if isinstance(key, tuple):
#         context, target = key
#     else:
#         context, target = default_context, key
#     return _target_steps[(context, target)]


# Path: kiwixbuild/dependencies/base.py
import subprocess
import os
import shutil
import time
from kiwixbuild.utils import pj, Context, SkipCommand, WarningMessage, extract_archive, Defaultdict, StopBuild, run_command, colorize
from kiwixbuild.versions import main_project_versions, base_deps_versions
from kiwixbuild._global import neutralEnv, option, get_target_step



SCRIPT_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))


class _MetaDependency(type):
    def __new__(cls, name, bases, dct):
        _class = type.__new__(cls, name, bases, dct)
        if name != 'Dependency':
            dep_name = dct['name']
            Dependency.all_deps[dep_name] = _class
        return _class


class Dependency(metaclass=_MetaDependency):
    all_deps = {}
    force_build = False
    force_native_build = False
    dont_skip = False

    @classmethod
    def version(cls):
        if cls.name in base_deps_versions:
            return base_deps_versions[cls.name]

        elif option('make_release'):