Use for mac OS library paths
@@ -61,25 +61,15 @@ class cy_build_ext(build_ext):
if sys.platform == 'darwin':
relative_module_path = ext.name.replace(".", os.sep) + get_config_vars()["SO"]
-
- if "develop" in sys.argv or "test" in sys.argv:
- # develop-mode and tests use local directory
- pkg_root = os.path.dirname(__file__)
- linker_path = os.path.join(pkg_root, relative_module_path)
- elif "bdist_wheel" in sys.argv or is_pip_install():
- # making a wheel, or pip is secretly involved
- linker_path = os.path.join("@rpath", relative_module_path)
- else:
- # making an egg: `python setup.py install` default behavior
- egg_name = '%s.egg' % self._get_egg_name()
- linker_path = os.path.join("@rpath", egg_name, relative_module_path)
+ library_path = os.path.join(
+ "@loader_path", os.path.basename(relative_module_path)
+ )
if not ext.extra_link_args:
ext.extra_link_args = []
ext.extra_link_args += ['-dynamiclib',
- '-rpath', get_python_lib(),
'-Wl,-headerpad_max_install_names',
- '-Wl,-install_name,%s' % linker_path,
+ '-Wl,-install_name,%s' % library_path,
'-Wl,-x']
else:
if not ext.extra_link_args:
