1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-02 16:49:47 +02:00

Add universal binary check

This commit is contained in:
Elias Steurer 2023-11-29 11:33:14 +01:00
parent 4849905a4a
commit 17c6bd891c
2 changed files with 40 additions and 2 deletions

View File

@ -14,7 +14,7 @@ from typing import Tuple
from pathlib import Path
import macos_sign
import build_godot
from util import sha256, cd_repo_root_path, repo_root_path, zipdir, run, get_vs_env_dict, get_latest_git_tag, parse_semver, semver_to_string
from util import sha256, cd_repo_root_path, repo_root_path, zipdir, run, get_vs_env_dict, get_latest_git_tag, parse_semver, semver_to_string, check_universal_binary
from sys import stdout
stdout.reconfigure(encoding='utf-8')
@ -218,6 +218,8 @@ def package(build_config: BuildConfig):
build_bin_dir=build_bin_dir, app="ScreenPlayWallpaper"), cwd=cwd)
run(cmd=cmd_raw.format(qt_bin_path=qt_bin_path, repo_root_path=source_path,
build_bin_dir=build_bin_dir, app="ScreenPlayWidget"), cwd=cwd)
check_universal_binary()
if platform.system() == "Windows":
print("Executing deploy commands...")
@ -301,6 +303,7 @@ def package(build_config: BuildConfig):
if file.is_file():
print("Remove: %s" % file.resolve())
file.unlink()
def build_installer(build_config: BuildConfig, build_result: BuildResult):

View File

@ -177,4 +177,39 @@ def unzip(zip_path: str, destination_path: str, specific_file: str = None):
if specific_file:
zip_ref.extract(specific_file, path=destination_path)
else:
zip_ref.extractall(path=destination_path)
zip_ref.extractall(path=destination_path)
def listfiles(path):
files = []
extensions = ('.dylib', '.so','')
ignored = ('qmldir')
print(f"WALK: {path}")
for dirName, subdirList, fileList in os.walk(path):
dir = dirName.replace(path, '')
for fname in fileList:
if Path(fname).suffix in extensions and not fname in ignored:
file = path + os.path.join(dir, fname)
if(os.path.isfile(file)):
files.append(file)
if os.path.islink(file):
print(f"Warning: file {file} is a symlink!")
print("Symlink target: ", os.readlink(file))
return files
def check_universal_binary():
dir = 'build-64-osx-universal-release/bin/ScreenPlay.app/Contents'
path = Path.joinpath(repo_root_path(), dir).absolute()
print(f"Checking files at: {path}")
files = listfiles(str(path))
none_fat_found = False
for file in files:
out = run_and_capture_output(f"lipo -info {file}")
if out.startswith('Non-fat'):
print(out)
none_fat_found = True
if none_fat_found:
print("✅ All files are a universal binaries")
else:
print("❌ None universal binaries found")