-
Notifications
You must be signed in to change notification settings - Fork 179
Extend workspace packages using ament index for ROS2 support #699
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e8c4475
Initial check-in from ament_index_python
ruffsl c12dcc1
Remove dead code
ruffsl 5a4c827
Expose AMENT_PREFIX_PATH_ENV_VAR
ruffsl c27c866
Extend workspace packages using ament index
ruffsl 0b15d64
Add readme detailing ament code origin
ruffsl ea9b6fb
Update help message with note on ament
ruffsl cc46742
Add test case for install with ament index
ruffsl a52f89f
Add ament_packages module to setup.py
ruffsl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Code within is folder is essentially copied directly from the `ament_package` repo, or more specificity the `ament_index_python` package. See original source here: | ||
|
|
||
| https://github.com/ament/ament_index/tree/86f5a6712690830fe3e19752f70cfcdb00a3d223/ament_index_python/ament_index_python | ||
|
|
||
| TODO: reconcile duplicate code via shared codebase |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Copyright 2015 Open Source Robotics Foundation, Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| from .constants import AMENT_PREFIX_PATH_ENV_VAR | ||
| from .constants import RESOURCE_INDEX_SUBFOLDER | ||
| from .packages import get_packages_with_prefixes | ||
| from .resources import get_resources | ||
| from .search_paths import get_search_paths | ||
|
|
||
| __all__ = [ | ||
| 'get_packages_with_prefixes', | ||
| 'get_resources', | ||
| 'get_search_paths', | ||
| 'AMENT_PREFIX_PATH_ENV_VAR', | ||
| 'RESOURCE_INDEX_SUBFOLDER', | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Copyright 2015 Open Source Robotics Foundation, Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
|
|
||
| RESOURCE_INDEX_SUBFOLDER = 'share/ament_index/resource_index' | ||
| AMENT_PREFIX_PATH_ENV_VAR = 'AMENT_PREFIX_PATH' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Copyright 2017 Open Source Robotics Foundation, Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| import os | ||
|
|
||
| from .resources import get_resources | ||
|
|
||
|
|
||
| def get_packages_with_prefixes(): | ||
| """ | ||
| Return a dict of package names to the prefixes in which they are found. | ||
|
|
||
| :returns: dict of package names to their prefixes | ||
| :rtype: dict | ||
| """ | ||
| return get_resources('packages') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Copyright 2015 Open Source Robotics Foundation, Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| import os | ||
|
|
||
| from .constants import RESOURCE_INDEX_SUBFOLDER | ||
|
|
||
| from .search_paths import get_search_paths | ||
|
|
||
|
|
||
| def get_resources(resource_type): | ||
| """ | ||
| Get the resource names of all resources of the specified type. | ||
|
|
||
| :param resource_type: the type of the resource | ||
| :type resource_type: str | ||
| :returns: dict of resource names to the prefix path they are in | ||
| :raises: :exc:`EnvironmentError` | ||
| """ | ||
| assert resource_type, 'The resource type must not be empty' | ||
| resources = {} | ||
| for path in get_search_paths(): | ||
| resource_path = os.path.join(path, RESOURCE_INDEX_SUBFOLDER, resource_type) | ||
| if os.path.isdir(resource_path): | ||
| for resource in os.listdir(resource_path): | ||
| # Ignore subdirectories, and anything starting with a dot | ||
| if os.path.isdir(os.path.join(resource_path, resource)) \ | ||
| or resource.startswith('.'): | ||
| continue | ||
| if resource not in resources: | ||
| resources[resource] = path | ||
| return resources |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Copyright 2015 Open Source Robotics Foundation, Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| import os | ||
|
|
||
| from .constants import AMENT_PREFIX_PATH_ENV_VAR | ||
|
|
||
|
|
||
| def get_search_paths(): | ||
| """ | ||
| Get the paths from the environment variable '{AMENT_PREFIX_PATH_ENV_VAR}'. | ||
|
|
||
| :returns: list of paths | ||
| :raises: :exc:`EnvironmentError` | ||
| """.format(AMENT_PREFIX_PATH_ENV_VAR=AMENT_PREFIX_PATH_ENV_VAR) | ||
| ament_prefix_path = os.environ.get(AMENT_PREFIX_PATH_ENV_VAR) | ||
| if not ament_prefix_path: | ||
| raise EnvironmentError( | ||
| "Environment variable '{}' is not set or empty".format(AMENT_PREFIX_PATH_ENV_VAR)) | ||
|
|
||
| paths = ament_prefix_path.split(os.pathsep) | ||
| return [p for p in paths if p and os.path.exists(p)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <package> | ||
| <name>fake_catkin_package</name> | ||
| <version>0.0.0</version> | ||
| <description> | ||
| This is a simple package | ||
| </description> | ||
| <maintainer email="nobody@example.org">Nobody</maintainer> | ||
| <license>BSD</license> | ||
|
|
||
| <buildtool_depend>catkin</buildtool_depend> | ||
|
|
||
| <build_depend>bar</build_depend> | ||
| <build_depend>foo</build_depend> | ||
| <build_depend>metapackage_with_deps</build_depend> | ||
| </package> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.