mirror of
https://github.com/kiwix/kiwix-build.git
synced 2025-04-24 06:37:07 -04:00
This commit add a first version code to build a flatpak of kiwix-desktop. It is mainly based on the PR #254 of @birros (hence he is the author of this commit) However there is some differences : - I (@mgautier) create a new builder to run the flatpak build instead of using a new dependency. - Use the flatpak platform to install org.kde.Platform and org.kde.Sdk This code version doesn't correctly work but I wanted to commit the birros' code without too many modification (even if there is a lot).
52 lines
1.2 KiB
Python
52 lines
1.2 KiB
Python
from collections import OrderedDict as _OrderedDict
|
|
import platform
|
|
|
|
_neutralEnv = None
|
|
_options = None
|
|
_target_steps = _OrderedDict()
|
|
|
|
def set_neutralEnv(env):
|
|
global _neutralEnv
|
|
_neutralEnv = env
|
|
|
|
def neutralEnv(what):
|
|
return getattr(_neutralEnv, what)
|
|
|
|
def set_options(options):
|
|
global _options
|
|
_options = options
|
|
|
|
def option(what):
|
|
return getattr(_options, what)
|
|
|
|
def add_target_step(key, what):
|
|
_target_steps[key] = 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)]
|
|
|
|
def target_steps():
|
|
return _target_steps
|
|
|
|
|
|
def backend():
|
|
global _backend
|
|
if _backend is not None:
|
|
return _backend
|
|
|
|
_platform = platform.system()
|
|
if _platform == 'Windows':
|
|
print('ERROR: kiwix-build is not intented to run on Windows platform.\n'
|
|
'There is no backend for Windows, so we can\'t launch any commands.')
|
|
sys.exit(0)
|
|
if _platform == 'Linux':
|
|
_platform, _, _ = platform.linux_distribution()
|
|
_platform = _platform.lower()
|
|
_backend = backends.Linux()
|
|
|
|
return _backend
|
|
|