# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/.
import glob import json import logging import os import shlex import shutil import subprocess import tempfile import zipfile from pathlib import Path from string import Template
from mozbuild.repackaging.utils import (
application_ini_data_from_directory,
get_build_variables,
)
# When updating this, please make sure to keep in sync the script for symbol # scraping at # https://github.com/mozilla/symbol-scrapers/blob/master/firefox-flatpak/script.sh
FREEDESKTOP_VERSION = "25.08" # The base app is shared by firefox and thunderbird
FIREFOX_BASEAPP = "org.mozilla.firefox.BaseApp"
FIREFOX_BASEAPP_CHANNEL = FREEDESKTOP_VERSION
def _langpack_manifest(xpi): with zipfile.ZipFile(xpi) as f: return json.load(f.open("manifest.json"))
def _render_template(source, dest, variables): if source.endswith(".in"): with open(source) as f:
template = Template(f.read())
dest_templated = dest[:-3] with open(dest_templated, "w") as f:
f.write(template.substitute(variables))
shutil.copymode(source, dest_templated) else:
shutil.copy(source, dest)
def _render_flatpak_templates(template_dir, build_dir, variables): for root, dirs, files in os.walk(template_dir):
relative = os.path.relpath(root, template_dir) for d in dirs:
os.makedirs(build_dir / relative / d, exist_ok=True) for f in files:
_render_template(
os.path.join(root, f), os.path.join(build_dir, relative, f), variables
)
flatpak_basename = flatpak_name.split(".")[-1]
variables.update({ "FREEDESKTOP_VERSION": FREEDESKTOP_VERSION, "FIREFOX_BASEAPP_CHANNEL": FIREFOX_BASEAPP_CHANNEL, "FLATPAK_BRANCH": flatpak_branch, "FLATPAK_BASENAME": flatpak_basename, "FLATPAK_NAME": flatpak_name, "DATE": variables["TIMESTAMP"].strftime("%Y-%m-%d"), # Override PKG_NAME since we use branches for beta vs release "PKG_NAME": product, "DBusActivatable": "false", # Override Icon to match the flatpak's name "Icon": flatpak_name,
})
_render_flatpak_templates(template_dir, build_dir, variables)
from fluent.runtime.fallback import FluentLocalization, FluentResourceLoader
from mozbuild.repackaging.desktop_file import generate_browser_desktop_entry
desktop = generate_browser_desktop_entry(
log,
variables,
product,
release_type,
FluentLocalization,
FluentResourceLoader,
)
desktop_dir = app_dir / "share" / "applications"
desktop_dir.mkdir(parents=True, exist_ok=True)
desktop_file_name = desktop_dir / f"{flatpak_name}.desktop" with desktop_file_name.open("w") as f: for line in desktop:
print(line, file=f)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.