зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1901703 - Introduce mach repackage desktop-file command r=jlorenzo
Differential Revision: https://phabricator.services.mozilla.com/D216386
This commit is contained in:
Родитель
80180993cf
Коммит
1068005df1
|
@ -3157,6 +3157,84 @@ def repackage_snap_install(command_context, snap_file, snap_name, sudo=None):
|
|||
return 0
|
||||
|
||||
|
||||
@SubCommand(
|
||||
"repackage",
|
||||
"desktop-file",
|
||||
description="Prepare a firefox.desktop file",
|
||||
virtualenv_name="repackage-desktop-file",
|
||||
)
|
||||
@CommandArgument("--output", type=str, required=True, help="Output desktop file")
|
||||
@CommandArgument(
|
||||
"--flavor",
|
||||
type=str,
|
||||
required=True,
|
||||
choices=["snap", "flatpak"],
|
||||
help="Desktop file flavor to generate.",
|
||||
)
|
||||
@CommandArgument(
|
||||
"--release-product",
|
||||
type=str,
|
||||
required=True,
|
||||
help="The product being shipped. Used to disambiguate beta/devedition etc.",
|
||||
)
|
||||
@CommandArgument(
|
||||
"--release-type",
|
||||
type=str,
|
||||
required=True,
|
||||
help="The release being shipped. Used to disambiguate nightly/try etc.",
|
||||
)
|
||||
def repackage_desktop_file(
|
||||
command_context,
|
||||
output,
|
||||
flavor,
|
||||
release_product,
|
||||
release_type,
|
||||
):
|
||||
desktop = None
|
||||
if flavor == "flatpak":
|
||||
from fluent.runtime.fallback import FluentLocalization, FluentResourceLoader
|
||||
|
||||
from mozbuild.repackaging.desktop_file import generate_browser_desktop_entry
|
||||
|
||||
# This relies in existing build variables usage inherited from the
|
||||
# debian repackage code that serves the same purpose on Flatpak, so
|
||||
# it is just directly re-used here.
|
||||
build_variables = {
|
||||
"DEB_PKG_NAME": release_product,
|
||||
"DBusActivatable": "false",
|
||||
"Icon": "org.mozilla.firefox",
|
||||
"StartupWMClass": release_product,
|
||||
}
|
||||
|
||||
desktop = "\n".join(
|
||||
generate_browser_desktop_entry(
|
||||
command_context.log,
|
||||
build_variables,
|
||||
release_product,
|
||||
release_type,
|
||||
FluentLocalization,
|
||||
FluentResourceLoader,
|
||||
)
|
||||
)
|
||||
|
||||
if flavor == "snap":
|
||||
from mozbuild.repackaging.snapcraft_transform import (
|
||||
SnapDesktopFile,
|
||||
)
|
||||
|
||||
desktop = SnapDesktopFile(
|
||||
command_context.log, appname=release_product, branchname=release_type
|
||||
).repack()
|
||||
|
||||
if desktop is None:
|
||||
raise NotImplementedError(
|
||||
f"Couldn't generate a desktop file. Unknown flavor: {flavor}"
|
||||
)
|
||||
|
||||
with open(output, "w") as desktop_file:
|
||||
desktop_file.write(desktop)
|
||||
|
||||
|
||||
@Command(
|
||||
"package-multi-locale",
|
||||
category="post-build",
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
pypi:fluent.runtime==0.4.0
|
||||
vendored:third_party/python/redo
|
Загрузка…
Ссылка в новой задаче