Skip to content

Commit fff33e4

Browse files
committed
Fix tue-install-ros
1 parent 9852564 commit fff33e4

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/tue_get/installer_impl.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,8 @@ def tue_install_ros(self, source_type: str, **kwargs) -> bool:
12171217
# ToDo: This depends on behaviour of tue-install-error
12181218
return False
12191219

1220-
ros_pkg_name = self._current_target.lstrip("ros-")
1220+
# Remove 'ros-' prefix
1221+
ros_pkg_name = self._current_target[4:]
12211222
if "-" in ros_pkg_name:
12221223
correct_ros_pkg_name = ros_pkg_name.replace("-", "_")
12231224
self.tue_install_error(
@@ -1301,6 +1302,7 @@ def tue_install_ros(self, source_type: str, **kwargs) -> bool:
13011302
return False
13021303

13031304
self.tue_install_debug(f"{target_dir=}")
1305+
target_sub_dir = os.path.join(target_dir, sub_dir)
13041306

13051307
ros_pkg_dir = os.path.join(ros_package_install_dir, ros_pkg_name)
13061308

@@ -1312,24 +1314,25 @@ def tue_install_ros(self, source_type: str, **kwargs) -> bool:
13121314
# ToDo: This depends on behaviour of tue-install-error
13131315
return False
13141316

1315-
if not os.path.isdir(os.path.join(target_dir, sub_dir)):
1317+
if not os.path.isdir(target_sub_dir):
13161318
self.tue_install_error(f"Subdirectory '{sub_dir}' does not exist for url '{url}'")
13171319
# ToDo: This depends on behaviour of tue-install-error
13181320
return False
13191321

13201322
# Test if the current symbolic link points to the same repository dir. If not, give a warning
13211323
# because it means the source URL has changed
13221324
if os.path.islink(ros_pkg_dir):
1323-
if os.path.realpath(ros_pkg_dir) != os.path.realpath(os.path.join(target_dir, sub_dir)):
1325+
if os.path.realpath(ros_pkg_dir) != os.path.realpath(target_sub_dir):
13241326
self.tue_install_info(f"url has changed to {url}/{sub_dir}")
13251327
os.remove(ros_pkg_dir)
1326-
os.symlink(os.path.join(target_dir, sub_dir), ros_pkg_dir)
1328+
os.symlink(target_sub_dir, ros_pkg_dir)
13271329
elif os.path.isdir(ros_pkg_dir):
13281330
self.tue_install_error(f"Can not create a symlink at '{ros_pkg_dir}' as it is a directory")
13291331
# ToDo: This depends on behaviour of tue-install-error
13301332
return False
13311333
elif not os.path.exists(ros_pkg_dir):
1332-
os.symlink(os.path.join(target_dir, sub_dir), ros_pkg_dir)
1334+
self.tue_install_debug(f"Creating symlink from {target_sub_dir} to {ros_pkg_dir}")
1335+
os.symlink(target_sub_dir, ros_pkg_dir)
13331336
else:
13341337
self.tue_install_error(f"'{ros_pkg_dir}' should not exist or be a symlink. Any other option is incorrect")
13351338

0 commit comments

Comments
 (0)