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

[stable-3.5] Make the make_universal.py script more verbose for easier debugging #4514

Merged
merged 1 commit into from
May 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions admin/osx/make_universal.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ def is_executable(file_path):

x86_64_app_file = sys.argv[1]
if not os.path.exists(x86_64_app_file):
print("Can't create universal: Path {} already exists".format(x86_64_app_file))
print("Can't create universal: Path {} does not exist".format(x86_64_app_file))
sys.exit(1)
arm64_app_file = sys.argv[2]
if not os.path.exists(arm64_app_file):
print("Can't create universal: Path {} already exists".format(arm64_app_file))
print("Can't create universal: Path {} does not exist".format(arm64_app_file))
sys.exit(1)
output_dir = sys.argv[3]

Expand All @@ -68,15 +68,17 @@ def is_executable(file_path):
# Now walk through the copied arm64 version and replace the binaries
for root, dirs, files in os.walk(universal_app_file):
for f in files:
absoulte_file_path = os.path.join(root, f)
absolute_file_path = os.path.join(root, f)
root_relative = path_relative_to_package(universal_app_file, root)
x86_64_absolute_path = os.path.join(x86_64_app_file, root_relative, f)
arm64_absolute_path = os.path.join(arm64_app_file, root_relative, f)
if os.path.islink(absoulte_file_path) or not is_executable(absoulte_file_path):
if os.path.islink(absolute_file_path) or not is_executable(absolute_file_path):
continue
try:
execute(["lipo", "-create", "-output", absoulte_file_path, arm64_absolute_path, x86_64_absolute_path])
print(f"Going to merge {arm64_absolute_path} with {x86_64_absolute_path} into {absolute_file_path}")
execute(["lipo", "-create", "-output", absolute_file_path, arm64_absolute_path, x86_64_absolute_path])
print(execute(["lipo", "-info", absolute_file_path]))
except:
print("Could not merge {} with {} into {}!".format(arm64_absolute_path, x86_64_absolute_path, absoulte_file_path))
print(f"Could not merge {arm64_absolute_path} with {x86_64_absolute_path} into {absolute_file_path}!")

print("Finished :)")