ament / ament_package Goto Github PK
View Code? Open in Web Editor NEWShell script templates used to create ament workspaces.
License: Apache License 2.0
Shell script templates used to create ament workspaces.
License: Apache License 2.0
This is what I get:
% source ./install/setup.zsh
Traceback (most recent call last):
File "/Users/william/ros2_ws/map_server_ws/install/_order_packages.py", line 71, in <module>
main()
File "/Users/william/ros2_ws/map_server_ws/install/_order_packages.py", line 37, in main
package_names = [d for d in os.listdir(path)]
FileNotFoundError: [Errno 2] No such file or directory: '/Users/william/ros2_ws/map_server_ws/install/share/ament_index/resource_index/packages'
I think this shouldn't result in an error, but a warning might be in order.
Is there a reason why ament does not include an equivalent to catkin_pkg.python_setup.generate_distutils_setup
? It would have to be updated for setuptools
, but it pains me to see redundant data in the setup.py and package.xml.
(Or is there an equivalent that I just haven't seen yet?)
I noticed that in
, the order to find python is C:\ProgramData\chocolatey\lib\python3\tools\python.exe (in the binary ros2-windows alpha8 release) and then the AMENT_PYTHON_EXECUTABLE variable. Also, when it fails to find python it just prints out something generic cannot find executable.I think it makes more sense to search the AMENT_PYTHON_EXECUTABLE variable, then whatever hard coded path the binary release has, and then the PATH variable for python. There may be a similar issue with Linux, but I'm more concerned with Windows right now.
In RC2:
$ . setup.bash
bash: /usr/bin/env python3: No such file or directory
That does evaluate to python3 for me, however I think the error is that the whole string is being passed to bash as a single command instead of being parsed by the command line options.
local_setup.bash works fine.
@jacquelinekay has also incountered this
nvidia@nvidianvidia:/data/autoware$ source install/setup.bash
-bash: ament_prepend_unique_value: command not found
I have two sets of ROS2 source code, each in a different path, and one set of autoware. When I source, the following errors occur
Using batch scripts we are reaching the the maximum length limit of environment variable for setups with many packages. Powershell should not have that limitation. The patch from #57 will keep us going for a bit longer but at some point this will be necessary.
The prefix level setup.bat
file was never converted from shell to batch.
AC:
setup.bat
of the second workspace on WindowsI was trying to build ros2 from source code, but met the following errors:
Traceback (most recent call last):
File "src/ament/ament_tools/scripts/ament.py", line 139, in
from ament_tools.package_types.ament import entry_point_data as ament_entry_point_data # noqa
File "/home/robot/workspace/ros2_ws_cov_2018-06-07/src/ament/ament_tools/ament_tools/package_types/ament.py", line 15, in
from ament_package import package_exists_at
ImportError: cannot import name 'package_exists_at'
The build steps are:
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws
wget https://raw.githubusercontent.com/ros2/ros2/master/ros2.repos
vcs-import src < ros2.repos
cd ~/ros2_ws/
src/ament/ament_tools/scripts/ament.py build --build-tests --symlink-install
There is no such build issue on release-latest branch.
Some packages install their shared libraries into /opt/ros/$ROSDISTRO/lib/x86_64-linux-gnu rather than the prefix-level lib directory directly.
The library_path environment hook will only add the lib directory of the AMENT_CURRENT_PREFIX
.
ament_package/ament_package/template/environment_hook/library_path.sh
Lines 11 to 14 in 5a4d070
In the immediate term I'm looking for the most straightforward way for my ros_workspace package to shoehorn in an environment hook that prepends the multiarch triplet (obtainable on Linux by dpkg-architecture -qDEB_HOST_MULTIARCH
or gcc -dumpmachine
).
In the long term I suppose we should determine how ament can observe the use of this directories and generate hook scripts appropriately.
Is it possible for the Ament build system to skip building a package if a different package exists? Maybe two packages do similar things and the second one shouldn't be built if the first one exists. My example: sometimes I package the DDS binaries and sometimes not. If the DDS binaries are not included then I want to include a different package that knows where to look for them and/or ensures the appropriate environment variables.
When using ament_environment_hooks
, .dsv
files not processed properly unless there is a .sh
file with the same name registered with ament_environment_hooks
. This .sh
file can be an empty file.
The issue appears to be with ament_package
since building this package with colcon
doesn't exhibit the same problem.
MWE: https://github.com/azeey/sandbox/tree/master/test_ament_pkg
It seems like
only processes files withprimary_extension
or additional_extension
, which in my system were .sh
and .zsh
, so .dsv
files seem to be ignored.
Potential fix (works for me locally):
diff --git a/ament_package/template/prefix_level/_local_setup_util.py b/ament_package/template/prefix_level/_local_setup_util.py
index fe2afda..29849f3 100644
--- a/ament_package/template/prefix_level/_local_setup_util.py
+++ b/ament_package/template/prefix_level/_local_setup_util.py
@@ -254,7 +254,7 @@ def process_dsv_file(
path_without_ext, ext = os.path.splitext(remainder)
assert ext.startswith('.')
ext = ext[1:]
- if ext in (primary_extension, additional_extension):
+ if ext in (primary_extension, additional_extension, 'dsv'):
if path_without_ext not in basenames:
basenames[path_without_ext] = set()
basenames[path_without_ext].add(ext)
Evidently parentheses need to be escaped with ^
when used in a for /f
, even if double-quoted. Without this fix, I get messages like:
/Microsoft was unexpected at this time.
Workaround is to modify the generated local_setup.bat
and escape the parentheses with carats like this:
...
set "ament_python_executable=C:/Program Files ^(x86^)/Microsoft Visual Studio/Shared/Python37_64/python.exe"
...
error msg:
Traceback (most recent call last):
File "src/ament/ament_tools/scripts/ament.py", line 37, in <module>
import ament_package
File "/home/karsten/workspace/osrf/ros2_src/src/ament/ament_package/ament_package/__init__.py", line 83
def parse_package_string(data, *, filename=None):
^
SyntaxError: invalid syntax
am I doing something wrong here?
The repository description that shows on the right side of the homepage seems inaccurate:
Python package for parsing package manifest files (package.xml).
I looked through the code and don't see any python code for parsing package.xml files in this repository. Looking elsewhere, the ament_package_xml.cmake code in ament_cmake invokes its package_xml_2_cmake.py script, and it uses parse_package_string
from catkin_pkg.package
.
OS:
ROS2 rolling - 02 April 2024
Ubuntu 24.04 Alpha LTS
This line have issue with flake8 and pycodestyle:
cat _local_setup_util_sh.py
...
FORMAT_STR_INVOKE_SCRIPT = 'COLCON_CURRENT_PREFIX="{prefix}" _colcon_prefix_sh_source_script "{script_path}"' # noqa: E501
FORMAT_STR_REMOVE_LEADING_SEPARATOR = 'if [ "$(echo -n ${name} | head -c 1)" = ":" ]; then export {name}=${{{name}#?}} ; fi' # noqa: E501
FORMAT_STR_REMOVE_TRAILING_SEPARATOR = 'if [ "$(echo -n ${name} | tail -c 1)" = ":" ]; then export {name}=${{{name}%?}} ; fi' # noqa: E501
I append noqa: E501 to bypass this errors.
See: #6 (comment)
AC:
I added the following debug message
I'm using
cmake_minimum_required(VERSION 2.8.3)
project(tf2)
find_package(ament_cmake)
find_package(geometry_msgs REQUIRED)
message(WARNING "geometry_msgs_INCLUDE_DIRS is: [[${geometry_msgs_INCLUDE_DIRS}]]")
And it appears that the geometry_msgs_INCLUDE_DIRS has 3 identical entries.
CMake Warning at CMakeLists.txt:16 (message):
geometry_msgs_INCLUDE_DIRS is:
[[/home/tfoote/work/ros2/tf3/install/include;/home/tfoote/work/ros2/tf3/install/include;/home/tfoote/work/ros2/tf3/install/include]]
The new performance enhancements that involve preparing the environment in Python (#89) can subtly collide with packages that provide environments hooks as shell scripts (instead of the newer .dsv files). This can happen because the Python code is unaware any environment changes that might occur when sourcing arbitrary shell scripts.
In particular, I ran into this issue while updating ROS 2 Java packages to work with Dashing.
In an attempt to use .dsv files for setting the CLASSPATH variable, I ran into an issue that CLASSPATH previously set by ament_cmake packages are overwritten by the .dsv file-based implementation (e.g. rcljava's JARs are missing from CLASSPATH since they are appended via shell scripts earlier in the topological ordering of packages).
Maybe related to the local_setup.zsh being broken,
But currently I get this error :
ImportError: 'from ament_package import parse_package_string' failed: No module named 'ament_package'
If I change the CMakeLists.txt file in my own package and run :
$ src/ament/ament_tools/scripts/ament.py build --build-tests --symlink-install src/ros2/my_package
However if I run
$ src/ament/ament_tools/scripts/ament.py build --build-tests --symlink-install src
Everything works, it just takes a really long time to traverse all the packages to figure out there is nothing to be done
Hi guys, thans a lot for your hard work in building ament tool. I'm not sure this is the right place for the issue/request, if not please point me to the right place.
My request is quite simple, I'm experimenting ament as a build system for my project, in which I have both ROS and NON-ROS packages.
I have an increasing number of repos (30 or so) and I'd love to use ament as my build system.
My problem is that some of my NON-ROS packages do not comply with ROS naming conventions and, while catkin
was complaining but still going on, ament
is enforcing the name convention therefore it quits immediatly.
I know this may be outside the scope of ament development, but would it be possible to have a way to skip this check for non-ROS packages?
For example by inserting a tag in the package.xml file? Or by setting a different built_type, something like:
<export>
<build_type> cmake </build_type>
</export>
It'll be really appreciate because I'm looking for a cross platform build system and this looks really promising.
I use protections in all bash scripts to prevent bugs. Bash protection of set -eu
for unbound variables errors out when sourcing a ROS environment. With complicated shell scripts, -eu
is used in CI to ensure all variables used are defined.
set -eu
source /opt/ros/humble/setup.bash
>> Terminal closes
Logs
$ set -u
$ source /opt/ros/humble/setup.bash
>>> bash: AMENT_TRACE_SETUP_FILES: unbound variable
# My long script
# Add protection
set -euf -o pipefail
echo foo
echo bar
# lots of other custom code here
set +u # temporary disable protection
source /opt/ros/humble/setup.bash
set -u # re-enable protection
# more custom code here
The following error message resulted from invalid XML in a package.xml for a new package. Although line and column numbers are given for the mismatched tag, the path of the invalid xml file is never given.
$ ./src/ament/ament_tools/scripts/ament.py build --symlink-install --build-tests
Traceback (most recent call last):
File "/home/jackie/code/ros2_ws/src/ament/ament_package/ament_package/__init__.py", line 102, in parse_package_string
root = minidom.parseString(data)
File "/usr/lib/python3.4/xml/dom/minidom.py", line 1970, in parseString
return expatbuilder.parseString(string)
File "/usr/lib/python3.4/xml/dom/expatbuilder.py", line 925, in parseString
return builder.parseString(string)
File "/usr/lib/python3.4/xml/dom/expatbuilder.py", line 223, in parseString
parser.Parse(string, True)
xml.parsers.expat.ExpatError: mismatched tag: line 20, column 23
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/jackie/code/ros2_ws/src/ament/ament_package/ament_package/__init__.py", line 60, in parse_package
return parse_package_string(f.read(), filename)
File "/home/jackie/code/ros2_ws/src/ament/ament_package/ament_package/__init__.py", line 104, in parse_package_string
raise InvalidPackage('The manifest contains invalid XML:\n%s' % ex)
ament_package.exceptions.InvalidPackage: The manifest contains invalid XML:
mismatched tag: line 20, column 23
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./src/ament/ament_tools/scripts/ament.py", line 149, in <module>
sys.exit(main() or 0)
File "/home/jackie/code/ros2_ws/src/ament/ament_tools/ament_tools/commands/ament.py", line 88, in main
rc = args.main(args)
File "/home/jackie/code/ros2_ws/src/ament/ament_tools/ament_tools/verbs/build/cli.py", line 137, in main
packages = topological_order(opts.basepath)
File "/home/jackie/code/ros2_ws/src/ament/ament_tools/ament_tools/topological_order.py", line 103, in topological_order
packages = _find_unique_packages(root_dir)
File "/home/jackie/code/ros2_ws/src/ament/ament_tools/ament_tools/packages.py", line 81, in find_unique_packages
packages = find_packages(basepath, exclude_paths=exclude_paths)
File "/home/jackie/code/ros2_ws/src/ament/ament_tools/ament_tools/packages.py", line 66, in find_packages
packages[path] = parse_package(os.path.join(basepath, path))
File "/home/jackie/code/ros2_ws/src/ament/ament_tools/ament_tools/package_types/__init__.py", line 31, in parse_package
pkg = package_type['parse_package'](path)
File "/home/jackie/code/ros2_ws/src/ament/ament_package/ament_package/__init__.py", line 64, in parse_package
(filename, e.message)]
AttributeError: 'InvalidPackage' object has no attribute 'message'
The nightly builds had a new test failure in ament_package, i.e. http://ci.ros2.org/job/nightly_win_rel/471/ . It's a little hard to see the output there, so I ran the tests on ament_package locally with src/ament/ament_tools/scripts/ament.py test --build-tests --symlink-install --isolated --only ament_package
, and saw:
checking ./test/test_pep257.py
1 errors
F
======================================================================
FAIL: test.test_pep257.test_pep257
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/nose/case.py", line 198, in runTest
self.test(*self.arg)
File "/home/ubuntu/ros2_ws-again/src/ament/ament_package/test/test_pep257.py", line 21, in test_pep257
assert rc == 0, 'Found docblock style errors'
AssertionError: Found docblock style errors
A year ago some fixes were made to allow AMENT_PYTHON_EXECUTABLE to work. However, this never made it into the prefix_level template (it went only into isolated_prefix_level). Even in reviewing the old fix, I'm not sure it should work since it doesn't use the !...!
operator when it reads the local variable. Essentially, isolated_prefix_level/local_setup.bat.in should be modified such that %_ament_python_executable%
becomes !_ament_python_executable!
. The file prefix_level/local_setup.bat.in needs that change in addition to the leading underscore as the variable names are not case sensitive.
Also, I don't think that all the python projects are getting installed with the right python path on Windows regardless of these fixes.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.