Skip to content

Commit

Permalink
Use @loader_path on macOS to fix loading wheels
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhers committed Nov 6, 2017
1 parent 3652b53 commit 54016db
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,14 @@ def run(self):
if run_process(make_cmd) != 0:
raise DistutilsSetupError(" ".join(make_cmd))

if platform.system() == "Darwin":
for lib in DATA_FILES:
new_install_name = "@loader_path/" + os.path.basename(lib)
install_name_tool_cmd = ["install_name_tool", "-id", new_install_name, lib]
log.info("Fixing install_name for %r..." % lib)
if run_process(install_name_tool_cmd) != 0:
raise DistutilsSetupError(" ".join(install_name_tool_cmd))

# This will generally be called by the manual install
elif not os.path.isdir(EIGEN3_INCLUDE_DIR):
raise RuntimeError("Could not find Eigen in EIGEN3_INCLUDE_DIR={}. If doing manual install, please set the EIGEN3_INCLUDE_DIR variable with the absolute path to Eigen manually. If doing install via pip, please file an issue on github.com/clab/dynet".format(EIGEN3_INCLUDE_DIR))
Expand Down

0 comments on commit 54016db

Please sign in to comment.