@@ -48,12 +48,23 @@ def patch_linux_library_rpath(self, artifact: Path, rpaths: list[str]) -> None:
4848 final_rpaths .add (rpath_str )
4949 continue
5050 # Otherwise change the RPATH to point use $ORIGIN
51+ logger .debug (
52+ "Patch path from patch_linux_library_rpath: "
53+ "rpath={rpath}, artifact={artifact}" ,
54+ rpath = rpath_path ,
55+ artifact = artifact ,
56+ )
5157 new_rpath = self .path_relative_site_packages (rpath_path , artifact .parent )
5258 new_rpath_str = f"$ORIGIN/{ new_rpath } "
5359 final_rpaths .add (new_rpath_str )
5460 # Merge with all the rpaths we were given
5561 final_rpaths = final_rpaths .union (rpaths )
5662 patcher = Patchelf ()
63+ logger .debug (
64+ "Setting RPATH for {artifact} to: {rpath}" ,
65+ artifact = artifact ,
66+ rpath = final_rpaths ,
67+ )
5768 patcher .set_rpath (artifact , ":" .join (final_rpaths ))
5869
5970 def get_dependency_rpaths (self , target : Target , install_path : Path ) -> list [str ]:
@@ -64,6 +75,12 @@ def get_dependency_rpaths(self, target: Target, install_path: Path) -> list[str]
6475 dep_install_paths = self .get_wheel_install_paths (dep_target )
6576 assert len (dep_install_paths ) == 1
6677 dep_install_path = self .install_dir / next (iter (dep_install_paths ))
78+ logger .debug (
79+ "Patch path from get_dependency_rpaths: "
80+ "dep_install_path={dep_install_path}, target_path={target_path}" ,
81+ dep_install_path = dep_install_path ,
82+ target_path = target_path ,
83+ )
6784 rpath = self .path_relative_site_packages (dep_install_path , target_path )
6885 new_rpath_str = f"$ORIGIN/{ rpath } "
6986 rpaths .append (new_rpath_str )
@@ -106,6 +123,13 @@ def get_package_rpaths(self, target: Target, install_path: Path) -> list[str]:
106123 # Skip empty rpaths. Most likely will have on at the end
107124 continue
108125 rpath = Path (rpath_str )
126+ logger .debug (
127+ "Patch path from get_package_rpaths (1): "
128+ "rpath={rpath}, install_path={install_path}, is_in_site={is_in_site}" ,
129+ rpath = rpath ,
130+ install_path = install_path ,
131+ is_in_site = self .path_is_in_site_packages (rpath ),
132+ )
109133 if not self .path_is_in_site_packages (rpath ):
110134 # Skip any paths that cannot be handled. We do not check for paths in
111135 # the build directory, it should be covered by `get_dependency_rpaths`
@@ -118,16 +142,24 @@ def get_package_rpaths(self, target: Target, install_path: Path) -> list[str]:
118142 try :
119143 # TODO: how to best catch if a string is a valid path?
120144 rpath = Path (link_command .fragment )
145+ logger .debug (
146+ "Patch path from get_package_rpaths (2): "
147+ "rpath={rpath}, install_path={install_path}, is_in_site={is_in_site}" ,
148+ rpath = rpath ,
149+ install_path = install_path ,
150+ is_in_site = self .path_is_in_site_packages (rpath ),
151+ )
121152 if not rpath .is_absolute ():
122153 # Relative paths should be handled by `get_dependency_rpaths`
123154 continue
124155 rpath = self .path_relative_site_packages (rpath , install_path )
125156 new_rpath_str = f"$ORIGIN/{ rpath .parent } "
126157 rpaths .append (new_rpath_str )
127- except Exception :
158+ except Exception as exc :
128159 logger .warning (
129- "Could not parse link-library as a path: {fragment}" ,
160+ "Could not parse link-library as a path: {fragment}\n exc = {exc} " ,
130161 fragment = link_command .fragment ,
162+ exc = exc ,
131163 )
132164 continue
133165 return rpaths
0 commit comments