Fix mac python lib link

This commit is contained in:
zhoushunjie
2022-09-22 19:26:11 +08:00
parent 13580aeb0d
commit 50117fa6d2

View File

@@ -39,7 +39,7 @@ def process_on_linux(current_dir):
if d not in ["lib", "lib64"]: if d not in ["lib", "lib64"]:
continue continue
rel_path = os.path.relpath(os.path.join(root, d), libs_path) rel_path = os.path.relpath(os.path.join(root, d), libs_path)
if path in user_specified_dirs: if path in user_specified_dirs:
# Note(zhoushunjie): Use the absolute path for user_specified_dirs # Note(zhoushunjie): Use the absolute path for user_specified_dirs
rpath = os.path.join(root, d) rpath = os.path.join(root, d)
else: else:
@@ -78,14 +78,18 @@ def process_on_mac(current_dir):
for d in dirs: for d in dirs:
if d not in ["lib", "lib64"]: if d not in ["lib", "lib64"]:
continue continue
rel_path = rel_path = os.path.relpath(os.path.join(root, d), libs_path) rel_path = os.path.relpath(os.path.join(root, d), libs_path)
rpath = "$loader_path/" + rel_path if path in user_specified_dirs:
for lib in fd_libs: # Note(zhoushunjie): Use the absolute path for user_specified_dirs
pre_commands.append( rpath = os.path.join(root, d)
"install_name_tool -delete_rpath '@loader_path/{}' {}".format( else:
rpath, lib)) rpath = "$loader_path/" + rel_path
commands.append("install_name_tool -add_rpath 'loader_path/{}' {}". for lib in fd_libs:
format(rpath, lib)) pre_commands.append(
"install_name_tool -delete_rpath '@loader_path/{}' {}".format(
rpath, lib))
commands.append("install_name_tool -add_rpath 'loader_path/{}' {}".
format(rpath, lib))
for cmd in pre_commands: for cmd in pre_commands:
try: try:
@@ -97,7 +101,6 @@ def process_on_mac(current_dir):
assert subprocess.Popen( assert subprocess.Popen(
cmd, shell=True) != 0, "Execute command failed: {}".format(cmd) cmd, shell=True) != 0, "Execute command failed: {}".format(cmd)
def process_on_windows(current_dir): def process_on_windows(current_dir):
libs_path = os.path.join(current_dir, "fastdeploy", "libs") libs_path = os.path.join(current_dir, "fastdeploy", "libs")
third_libs_path = os.path.join(libs_path, "third_libs") third_libs_path = os.path.join(libs_path, "third_libs")