# Path: kiwixbuild/platforms/base.py
# class PlatformInfo(metaclass=_MetaPlatform):
#     all_platforms = {}
#     all_running_platforms = {}
#     toolchain_names = []
#     configure_option = ""
# 
#     @classmethod
#     def get_platform(cls, name, targets=None):
#         if name not in cls.all_running_platforms:
#             if targets is None:
#                 print("Should not got there.")
#                 print(cls.all_running_platforms)
#                 raise KeyError(name)
#             cls.all_running_platforms[name] = cls.all_platforms[name](targets)
#         return cls.all_running_platforms[name]
# 
#     def __init__(self, targets):
#         self.all_running_platforms[self.name] = self
#         self.buildEnv = BuildEnv(self)
#         self.setup_toolchains(targets)
# 
#     def __str__(self):
#         return "{}_{}".format(self.build, 'static' if self.static else 'dyn')
# 
#     def setup_toolchains(self, targets):
#         for tlc_name in self.toolchain_names:
#             ToolchainClass = Dependency.all_deps[tlc_name]
#             targets[('source', tlc_name)] = ToolchainClass.Source
#             plt_name = 'neutral' if ToolchainClass.neutral else self.name
#             targets[(plt_name, tlc_name)] = ToolchainClass.Builder
# 
#     def add_targets(self, targetName, targets):
#         if (self.name, targetName) in targets:
#             return []
#         targetClass = Dependency.all_deps[targetName]
#         targets[('source', targetName)] = targetClass.Source
#         targets[(self.name, targetName)] = targetClass.Builder
#         for dep in targetClass.Builder.get_dependencies(self, False):
#             if isinstance(dep, tuple):
#                 depPlatformName, depName = dep
#             else:
#                 depPlatformName, depName = self.name, dep
#             depPlatform = self.get_platform(depPlatformName, targets)
#             depPlatform.add_targets(depName, targets)
#         return [(self.name, targetName)]
# 
#     def get_fully_qualified_dep(self, dep):
#          if isinstance(dep, tuple):
#             return dep
#          else:
#             return self.name, dep
# 
# 
#     def get_cross_config(self):
#         return {}
# 
# 
#     def get_env(self):
#         return DefaultEnv()
# 
# 
#     def get_bin_dir(self):
#         return []
# 
# 
#     def set_compiler(self, env):
#         pass
# 
# 
#     def set_comp_flags(self, env):
#         if self.static:
#             env['CFLAGS'] = env['CFLAGS'] + ' -fPIC'
#             env['CXXFLAGS'] = env['CXXFLAGS'] + ' -fPIC'
# 
# 
#     def _gen_crossfile(self, name, outname=None):
#         if outname is None:
#             outname = name
#         crossfile = pj(self.buildEnv.build_dir, outname)
#         template_file = pj(TEMPLATES_DIR, name)
#         with open(template_file, 'r') as f:
#             template = f.read()
#         content = template.format(
#             **self.get_cross_config()
#         )
#         with open(crossfile, 'w') as outfile:
#             outfile.write(content)
#         return crossfile
# 
#     def finalize_setup(self):
#         self.buildEnv.cross_config = self.get_cross_config()
#         self.buildEnv.meson_crossfile = None
#         self.buildEnv.cmake_crossfile = None
# 
#     def clean_intermediate_directories(self):
#         self.buildEnv.clean_intermediate_directories()
# 
# 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/_global.py
# def option(what):
#     return getattr(_options, what)
# 
# def neutralEnv(what):
#     return getattr(_neutralEnv, what)


from .base import PlatformInfo
from kiwixbuild.utils import pj
from kiwixbuild._global import option, neutralEnv



class NativePlatformInfo(PlatformInfo):
    build = 'native'

    def get_env(self):
        env = super().get_env()

# Path: kiwixbuild/platforms/base.py
# class PlatformInfo(metaclass=_MetaPlatform):
#     all_platforms = {}
#     all_running_platforms = {}
#     toolchain_names = []
#     configure_option = ""
# 
#     @classmethod
#     def get_platform(cls, name, targets=None):
#         if name not in cls.all_running_platforms:
#             if targets is None:
#                 print("Should not got there.")
#                 print(cls.all_running_platforms)
#                 raise KeyError(name)
#             cls.all_running_platforms[name] = cls.all_platforms[name](targets)
#         return cls.all_running_platforms[name]
# 
#     def __init__(self, targets):
#         self.all_running_platforms[self.name] = self
#         self.buildEnv = BuildEnv(self)
#         self.setup_toolchains(targets)
# 
#     def __str__(self):
#         return "{}_{}".format(self.build, 'static' if self.static else 'dyn')
# 
#     def setup_toolchains(self, targets):
#         for tlc_name in self.toolchain_names:
#             ToolchainClass = Dependency.all_deps[tlc_name]
#             targets[('source', tlc_name)] = ToolchainClass.Source
#             plt_name = 'neutral' if ToolchainClass.neutral else self.name
#             targets[(plt_name, tlc_name)] = ToolchainClass.Builder
# 
#     def add_targets(self, targetName, targets):
#         if (self.name, targetName) in targets:
#             return []
#         targetClass = Dependency.all_deps[targetName]
#         targets[('source', targetName)] = targetClass.Source
#         targets[(self.name, targetName)] = targetClass.Builder
#         for dep in targetClass.Builder.get_dependencies(self, False):
#             if isinstance(dep, tuple):
#                 depPlatformName, depName = dep
#             else:
#                 depPlatformName, depName = self.name, dep
#             depPlatform = self.get_platform(depPlatformName, targets)
#             depPlatform.add_targets(depName, targets)
#         return [(self.name, targetName)]
# 
#     def get_fully_qualified_dep(self, dep):
#          if isinstance(dep, tuple):
#             return dep
#          else:
#             return self.name, dep
# 
# 
#     def get_cross_config(self):
#         return {}
# 
# 
#     def get_env(self):
#         return DefaultEnv()
# 
# 
#     def get_bin_dir(self):
#         return []
# 
# 
#     def set_compiler(self, env):
#         pass
# 
# 
#     def set_comp_flags(self, env):
#         if self.static:
#             env['CFLAGS'] = env['CFLAGS'] + ' -fPIC'
#             env['CXXFLAGS'] = env['CXXFLAGS'] + ' -fPIC'
# 
# 
#     def _gen_crossfile(self, name, outname=None):
#         if outname is None:
#             outname = name
#         crossfile = pj(self.buildEnv.build_dir, outname)
#         template_file = pj(TEMPLATES_DIR, name)
#         with open(template_file, 'r') as f:
#             template = f.read()
#         content = template.format(
#             **self.get_cross_config()
#         )
#         with open(crossfile, 'w') as outfile:
#             outfile.write(content)
#         return crossfile
# 
#     def finalize_setup(self):
#         self.buildEnv.cross_config = self.get_cross_config()
#         self.buildEnv.meson_crossfile = None
#         self.buildEnv.cmake_crossfile = None
# 
#     def clean_intermediate_directories(self):
#         self.buildEnv.clean_intermediate_directories()
# 
# 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/_global.py
# def option(what):
#     return getattr(_options, what)
# 
# def neutralEnv(what):
#     return getattr(_neutralEnv, what)


# Path: kiwixbuild/platforms/native.py
from .base import PlatformInfo
from kiwixbuild.utils import pj
from kiwixbuild._global import option, neutralEnv




class NativePlatformInfo(PlatformInfo):
    build = 'native'

    def get_env(self):
        env = super().get_env()

        if neutralEnv('distname') == 'fedora':