def copy_dependencies(binary_path, lib_path): relative_path = path.relpath(lib_path, path.dirname(binary_path)) + "/" # Update binary libraries binary_dependencies = set(otool(binary_path)) binary_dependencies = binary_dependencies.union(macos_dylibs()) binary_dependencies = binary_dependencies.union(macos_plugins()) change_non_system_libraries_path(binary_dependencies, relative_path, binary_path) # Update dependencies libraries need_checked = binary_dependencies checked = set() while need_checked: checking = set(need_checked) need_checked = set() for f in checking: # No need to check these for their dylibs if is_system_library(f): continue need_relinked = set(otool(f)) new_path = path.join(lib_path, path.basename(f)) if not path.exists(new_path): shutil.copyfile(f, new_path) change_non_system_libraries_path(need_relinked, relative_path, new_path) need_checked.update(need_relinked) checked.update(checking) need_checked.difference_update(checked)
def package_gstreamer_dylibs(servo_exe_dir): missing = [] gst_dylibs = macos_dylibs() + macos_plugins() for gst_lib in gst_dylibs: try: dest_path = os.path.join(servo_exe_dir, os.path.basename(gst_lib)) if os.path.isfile(dest_path): os.remove(dest_path) shutil.copy(gst_lib, servo_exe_dir) except Exception as e: print(e) missing += [str(gst_lib)] for gst_lib in missing: print("ERROR: could not find required GStreamer DLL: " + gst_lib) return not missing