Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gui: build one directory executable (bug 1855808) #1478

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions gui/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import subprocess
import sys
import tarfile
from pathlib import Path

IS_WIN = os.name == "nt"
IS_MAC = sys.platform == "darwin"
Expand Down Expand Up @@ -92,7 +91,6 @@ def do_bundle(options):
makensis_path = os.path.join(options.nsis_path, "makensis.exe")
call(makensis_path, "wininst.nsi", cwd="wininst")
elif IS_MAC:
Path("dist/mozregression GUI").unlink()
with tarfile.open("mozregression-gui-app-bundle.tar.gz", "w:gz") as tar:
tar.add(r"dist", arcname="mozregression-gui-app-bundle")
else:
Expand Down
52 changes: 32 additions & 20 deletions gui/gui.spec
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
# -*- mode: python -*-
import sys
from PyInstaller.utils.hooks import collect_all, collect_submodules
from mozregression.pyinstaller import BUNDLE_WITH_TK

IS_MAC = sys.platform == "darwin"

block_cipher = None

datas, binaries, hiddenimports = [], [], []
for pkgname in ["glean", "glean_parser", "mozregression", "yamllint", "bs4"]:
for pkgname in [
"glean",
"glean_parser",
"mozregression",
"yamllint",
"bs4",
"redo",
"taskcluster",
"mozinstall",
"mozversion",
"mozdevice",
"mozrunner",
]:
pkg_datas, pkg_binaries, pkg_hiddenimports = collect_all(pkgname)
datas.extend(pkg_datas)
binaries.extend(pkg_binaries)
Expand All @@ -18,31 +29,28 @@ for pkgname in ["glean", "glean_parser", "mozregression", "yamllint", "bs4"]:
# https://github.com/pypa/setuptools/issues/1963
hiddenimports.extend(collect_submodules("pkg_resources"))

analysis_kwargs = {
"binaries": binaries,
"datas": datas,
"hiddenimports": hiddenimports,
"hookspath": [],
"excludes": [],
"win_no_prefer_redirects": False,
"win_private_assemblies": False,
"cipher": block_cipher,
"noarchive": False,
}
if IS_MAC:
analysis_kwargs["runtime_hooks"] = ["splash_hook.py"]
a = Analysis(
["mozregression-gui.py"],
binaries=binaries,
datas=datas,
hiddenimports=hiddenimports,
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)

a = Analysis(["mozregression-gui.py"], **analysis_kwargs)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

if IS_MAC:
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
exclude_binaries=True,
name="mozregression GUI",
debug=False,
bootloader_ignore_signals=False,
Expand All @@ -51,7 +59,11 @@ if IS_MAC:
console=False,
target_arch="universal2",
)
app = BUNDLE_WITH_TK(
app = BUNDLE(
exe,
a.binaries,
a.zipfiles,
a.datas,
exe,
strip=False,
upx=True,
Expand Down
64 changes: 0 additions & 64 deletions gui/splash_hook.py

This file was deleted.