Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add /usr/lib/<pkg> and /usr/libexec/<pkg> to search paths #467

Open
wants to merge 1 commit into
base: rolling
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions ros2pkg/ros2pkg/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,22 @@ def get_executable_paths(*, package_name):
prefix_path = get_prefix_path(package_name)
if prefix_path is None:
raise PackageNotFound(package_name)
base_path = os.path.join(prefix_path, 'lib', package_name)
base_paths = [
os.path.join(prefix_path, 'lib', package_name),
os.path.join(prefix_path, 'usr', 'lib', package_name),
os.path.join(prefix_path, 'usr', 'libexec', package_name),
]
executable_paths = []
for dirpath, dirnames, filenames in os.walk(base_path):
# ignore folder starting with .
dirnames[:] = [d for d in dirnames if d[0] not in ['.']]
dirnames.sort()
# select executable files
for filename in sorted(filenames):
path = os.path.join(dirpath, filename)
if os.access(path, os.X_OK):
executable_paths.append(path)
for base_path in base_paths:
for dirpath, dirnames, filenames in os.walk(base_path):
# ignore folder starting with .
dirnames[:] = [d for d in dirnames if d[0] not in ['.']]
dirnames.sort()
# select executable files
for filename in sorted(filenames):
path = os.path.join(dirpath, filename)
if os.access(path, os.X_OK):
executable_paths.append(path)
return executable_paths


Expand Down