ament / ament_tools Goto Github PK
View Code? Open in Web Editor NEWCommand line tools for working with ament
Command line tools for working with ament
I constantly get this error at last on my ament build. I guess, ament build
tries to overwrite the same ament.exe
which is currently used.
Installing ament.exe script to c:\dev\ros2_src\install\bin
error: [Errno 13] Permission denied: 'c:\\dev\\ros2_src\\install\\bin\\ament.exe
The build is fine though.
--
can be used to signal the end of a "catch all" argument group when invoking ament from the command line.
It's possible that, when command line arguments are being built up programmatically for example, the delimiter is added twice. This currently isn't handled.
$ ament build . --force-cmake-configure --cmake-args -DCMAKE_BUILD_TYPE=Debug -- -- --ament-cmake-args -DCMAKE_BUILD_TYPE=Release
usage: ament [-h]
[uninstall_pkg | test_pkg | package_version | uninstall | test_results | build | list_packages | build_pkg | package_name | test]
...
ament: error: unrecognized arguments: --
Once ament/ament_lint#11 is resolved update this package to use the newly split up tools.
AC:
ament_pep8
and ament_pyflakes
.I was just attempting to build ign-math (cmake project name ignition-math4
) with this package.xml file (package name ign_math
) in an ament workspace on windows 10 with VS 2017. I was getting build failures expected str instance, NoneType found
, that I traced to a missing solution file, which is named ignition-math4.sln
. I modified the package.xml name to be ignition-math4
and then it worked.
Is this a strict requirement that the cmake project name must match the package.xml name?
I'm putting this into a ticket so we can remember it, but I don't think we need it right now.
Basically we make a distinction in ament
between run environment variables and build environment variables but only provide a mechanism to extend the run environment variables.
Run environment variables are set after building a package and are necessary to "use" it, i.e. run things built by it. Examples include the PATH
, the [DY]LD_LIBRARY_PATH
, and the PYTHONPATH
.
Build environment variables are set after building a package and are needed to build something else on top of that package. Examples include the CMAKE_PREFIX_PATH
and the PKG_CONFIG_PATH
.
Since building on a package may require running something from that package, the build environment variables would also include the run environment variables.
We allow packages to extend the run environment through the use of environment hooks which get sourced when those packages are going to be used, either by the build tool before building on top of those packages, or by the user when they source a local_setup.*sh
or a setup.*sh
. However, for build specific modifications to the environment there is no pattern for doing this on a per package basis. An example of this variable is the CMAKE_PREFIX_PATH
which is not set by our setup files but is rather injected by the build tool during the build process, e.g.: https://github.com/ament/ament_tools/blob/release-alpha3/ament_tools/build_types/cmake.py#L376-L377
In my opinion there are three downsides to setting these build only environment variables in the tool rather than through a build specific environment hook of the package:
For example, if a package needs to be on the CMAKE_PREFIX_PATH
and it needs to be on the PKG_CONFIG_PATH
in order to built on, then it would have a problem because it would only be on the CMAKE_PREFIX_PATH
by default. In order to extend the PKG_CONFIG_PATH
it would need to use a run environment hook. This isn't really an issue, but it's not conceptually consistent because we have a distinction between build and run time environment changes, but you can only extend one of them.
Consider you built a workspace with ament build
and then you wanted to build a single CMake package by hand on top of that (find_package
'ing something in the workspace). After sourcing the setup.*sh
file of the workspace, your single package would fail because the workspace is not on the CMAKE_PREFIX_PATH
. This is the case because currently workspace prefixes are added to the CMAKE_PREFIX_PATH
by the build tool. So you need to manually extend the CMAKE_PREFIX_PATH
in order to build your single package. It happens that you can just extend it with the AMENT_PREFIX_PATH
, but that's not an obvious step and if we move beyond just CMake packages in the workspace a potentially more complex step.
This usability issue is what lead me to think about and suggest this enhancement.
CMAKE_PREFIX_PATH
.Because of the logic here:
https://github.com/ament/ament_tools/blob/release-alpha3/ament_tools/build_types/cmake.py#L376-L377
Every workspace prefix on the AMENT_PREFIX_PATH
gets added to the CMAKE_PREFIX_PATH
, even if those workspaces do not contain CMake packages. This commonly happens when doing an isolated build where every package is installed to its own workspace. For example, sourcing the local_setup.sh
of an isolated build yields a AMENT_PREFIX_PATH
with a separate entry for each package, and so adding the AMENT_PREFIX_PATH
in whole to the CMAKE_PREFIX_PATH
unnecessarily adds folders which do not contain CMake packages. Again this isn't a big issue in practice, but it is not conceptually consistent and it might hide subtle bugs by putting packages on the CMAKE_PREFIX_PATH
that shouldn't be.
My proposal is two fold:
These would work just like normal environment hooks except they would not get sourced by local_setup.sh
, but instead would get sourced by a new local_build_setup.sh
. This would also mean that in order to use a workspace (just run things out of it) you'd continue to source the setup.*sh
file in the root of the workspace, but to build on top of it you'd source the build_setup.*sh
file which would source the setup.*sh
file as well as do any package specific work needed to build on top of the packages in the workspace. The availability of the build_setup.*sh
files would, in my opinion, address the usability issue described in the 2nd point from above.
These would allow packages to extend their build environment in arbitrary ways on a per package basis, which addresses both issues 1 and 3 from above.
For example:
Like I said, this isn't necessary right now, but I just wanted to capture the idea in case we want to do it in the future. Hopefully it is complete enough that someone could pick it up and run with it.
Is it possible to define and build a message in a package that has some more code that uses the message?
Or is it intended by design to separate messages and code? In the specific scenario I wanted to create a simple logger as a replacement until there is a ros2 logging package. It would be nicer if I could ship messages and logging code inside the same package.
this line tries to invoke make which doesn't exist.
Backtrace
+++ Testing 'ament_cmake_core'
Traceback (most recent call last):
File "src\ament\ament_tools\scripts\ament.py", line 111, in <module>
sys.exit(main() or 0)
File "C:\Jenkins\workspace\ros2_batch_ci_windows\src\ament\ament_tools\ament_tools\commands\ament.py", line 88, in main
rc = args.main(args)
File "C:\Jenkins\workspace\ros2_batch_ci_windows\src\ament\ament_tools\ament_tools\verbs\test\cli.py", line 63, in main
build_main(opts, test_pkg_main_wrapper)
File "C:\Jenkins\workspace\ros2_batch_ci_windows\src\ament\ament_tools\ament_tools\verbs\build\cli.py", line 138, in main
iterate_packages(opts, packages, per_package_main)
File "C:\Jenkins\workspace\ros2_batch_ci_windows\src\ament\ament_tools\ament_tools\verbs\build\cli.py", line 190, in iterate_packages
rc = per_package_callback(opts)
File "C:\Jenkins\workspace\ros2_batch_ci_windows\src\ament\ament_tools\ament_tools\verbs\test\cli.py", line 56, in test_pkg_main_wrapper
rc = test_pkg_main(opts)
File "C:\Jenkins\workspace\ros2_batch_ci_windows\src\ament\ament_tools\ament_tools\verbs\test_pkg\cli.py", line 49, in main
handle_build_action(on_test_ret, context)
File "C:\Jenkins\workspace\ros2_batch_ci_windows\src\ament\ament_tools\ament_tools\verbs\build_pkg\cli.py", line 255, in handle_build_action
for build_action in build_action_ret:
File "C:\Jenkins\workspace\ros2_batch_ci_windows\src\ament\ament_tools\ament_tools\build_types\ament_cmake.py", line 153, in on_test
if has_make_target(context.build_space, 'test') or context.dry_run:
File "C:\Jenkins\workspace\ros2_batch_ci_windows\src\ament\ament_tools\ament_tools\build_types\cmake_common.py", line 30, in has_make_target
output = subprocess.check_output([MAKE_EXECUTABLE, '-pn'], cwd=path)
File "C:\tools\python\lib\subprocess.py", line 607, in check_output
with Popen(*popenargs, stdout=PIPE, **kwargs) as process:
File "C:\tools\python\lib\subprocess.py", line 858, in __init__
restore_signals, start_new_session)
File "C:\tools\python\lib\subprocess.py", line 1085, in _execute_child
args = list2cmdline(args)
File "C:\tools\python\lib\subprocess.py", line 663, in list2cmdline
needquote = (" " in arg) or ("\t" in arg) or not arg
It actually detects that make does not exist and passes None as the command which is the failure.
It should detect and abort with a message if nose is necessary.
My process:
Adding a debug print statement shows:
build_action.cmd: ['.', '/root/ros2_ws/build/ament_package/ament_python__test.sh', '&&', None, '--nocapture', '--with-xunit', '--xunit-file=/root/ros2_ws/build/ament_package/nosetests.xml', '--with-coverage', '--cover-erase', '--cover-tests', '--cover-branches', '--cover-package=ament_package']
This breaks the join method. The print is fixable but I think it exposes a problem at a higher level. It looks like the command was not found, but there was not an error.
Looking at the command the missing executable is nose. Installing python3-nose fixed the problem.
The new output was:
build_action.cmd: ['.', '/root/ros2_ws/build/ament_package/ament_python__test.sh', '&&', '/usr/bin/nosetests3', '--nocapture', '--with-xunit', '--xunit-file=/root/ros2_ws/build/ament_package/nosetests.xml', '--with-coverage', '--cover-erase', '--cover-tests', '--cover-branches', '--cover-package=ament_package']
This is after following: https://github.com/ros2/examples/wiki substituting for the pre_api_review instead of master.
It also happens if you test a single package.
Full backtrace an error:
root@01ae413d64d0:~/ros2_ws# src/ament/ament_tools/scripts/ament.py test src/
# Topological order
- ament_package
- ament_cmake_core
- ament_cmake_export_definitions
- ament_cmake_export_dependencies
- ament_cmake
- ament_cmake_export_include_directories
- ament_cmake_export_interfaces
- ament_cmake_export_libraries
- ament_cmake_gmock
- ament_cmake_gtest
- ament_cmake_include_directories
- ament_cmake_libraries
- ament_cmake_nose
- ament_cmake_python
- ament_cmake_target_dependencies
- ament_cmake_test
- ament_clang_format
- ament_cmake_auto
- ament_copyright
- ament_cppcheck
- ament_cpplint
- ament_lint_cmake
- ament_pep8
- ament_pyflakes
- ament_uncrustify
- connext_cmake_module
- opensplice_cmake_module
- osrf_pycommon
- ament_tools
- rclcpp
- ros_middleware_implementation
- ros_middleware_interface
- rosidl_cmake
- rosidl_default_generators
- rosidl_generator_cpp
- rosidl_generator_dds_idl
- rosidl_parser
- rosidl_typesupport_connext_cpp
- ros_middleware_connext_cpp
- rosidl_typesupport_introspection_cpp
- ros_middleware_connext_xtypes_dynamic_cpp
- rosidl_typesupport_opensplice_cpp
- builtin_msgs
- ros_middleware_opensplice_cpp
- simple_msgs
- userland_msgs
- userland
Process package 'ament_package' with context:
--------------------------------------------------------------------------------
source_space => /root/ros2_ws/src/ament/ament_package
build_space => /root/ros2_ws/build/ament_package
install_space => /root/ros2_ws/install
make_flags => -j8, -l8
build_tests => True
--------------------------------------------------------------------------------
+++ Building 'ament_package'
+++ Installing 'ament_package'
==> '. /root/ros2_ws/build/ament_package/ament_python__install.sh && /usr/bin/python3 setup.py develop --prefix /root/ros2_ws/install --uninstall' in '/root/ros2_ws/build/ament_package'
running develop
Removing ament-package 0.0.0 from easy-install.pth file
==> '. /root/ros2_ws/build/ament_package/ament_python__install.sh && /usr/bin/python3 setup.py install --prefix /root/ros2_ws/install --record /root/ros2_ws/build/ament_package/install.log build --build-base /root/ros2_ws/build/ament_package egg_info --egg-base /root/ros2_ws/build/ament_package bdist_egg --dist-dir /root/ros2_ws/build/ament_package' in '/root/ros2_ws/src/ament/ament_package'
running install
running bdist_egg
running egg_info
writing top-level names to /root/ros2_ws/build/ament_package/ament_package.egg-info/top_level.txt
writing /root/ros2_ws/build/ament_package/ament_package.egg-info/PKG-INFO
writing dependency_links to /root/ros2_ws/build/ament_package/ament_package.egg-info/dependency_links.txt
reading manifest file '/root/ros2_ws/build/ament_package/ament_package.egg-info/SOURCES.txt'
writing manifest file '/root/ros2_ws/build/ament_package/ament_package.egg-info/SOURCES.txt'
installing library code to /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg
running install_lib
running build_py
creating /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg
creating /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package
copying /root/ros2_ws/build/ament_package/lib/ament_package/templates.py -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package
copying /root/ros2_ws/build/ament_package/lib/ament_package/export.py -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package
copying /root/ros2_ws/build/ament_package/lib/ament_package/__init__.py -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package
copying /root/ros2_ws/build/ament_package/lib/ament_package/url.py -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package
copying /root/ros2_ws/build/ament_package/lib/ament_package/person.py -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package
copying /root/ros2_ws/build/ament_package/lib/ament_package/dependency.py -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package
copying /root/ros2_ws/build/ament_package/lib/ament_package/package.py -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package
creating /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template
creating /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/environment_hook
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/environment_hook/pythonpath.sh.in -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/environment_hook
creating /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/package_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/package_level/local_setup.zsh.in -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/package_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/package_level/local_setup.bash.in -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/package_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/package_level/local_setup.sh.in -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/package_level
creating /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/isolated_prefix_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/isolated_prefix_level/_order_isolated_packages.py -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/isolated_prefix_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/isolated_prefix_level/local_setup.bash -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/isolated_prefix_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/isolated_prefix_level/local_setup.zsh -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/isolated_prefix_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/isolated_prefix_level/local_setup.sh.in -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/isolated_prefix_level
creating /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/prefix_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/prefix_level/local_setup.bash -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/prefix_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/prefix_level/setup.zsh -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/prefix_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/prefix_level/local_setup.zsh -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/prefix_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/prefix_level/local_setup.sh.in -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/prefix_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/prefix_level/setup.bash -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/prefix_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/prefix_level/setup.sh.in -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/prefix_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/exceptions.py -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package
byte-compiling /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/templates.py to templates.cpython-34.pyc
byte-compiling /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/export.py to export.cpython-34.pyc
byte-compiling /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/__init__.py to __init__.cpython-34.pyc
byte-compiling /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/url.py to url.cpython-34.pyc
byte-compiling /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/person.py to person.cpython-34.pyc
byte-compiling /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/dependency.py to dependency.cpython-34.pyc
byte-compiling /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/package.py to package.cpython-34.pyc
byte-compiling /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/isolated_prefix_level/_order_isolated_packages.py to _order_isolated_packages.cpython-34.pyc
byte-compiling /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/exceptions.py to exceptions.cpython-34.pyc
creating /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
ament_package.__pycache__.templates.cpython-34: module references __file__
creating '/root/ros2_ws/build/ament_package/ament_package-0.0.0-py3.4.egg' and adding '/root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg' to it
removing '/root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg' (and everything under it)
Creating /root/ros2_ws/install/lib/python3.4/site-packages/site.py
Processing ament_package-0.0.0-py3.4.egg
removing '/root/ros2_ws/install/lib/python3.4/site-packages/ament_package-0.0.0-py3.4.egg' (and everything under it)
creating /root/ros2_ws/install/lib/python3.4/site-packages/ament_package-0.0.0-py3.4.egg
Extracting ament_package-0.0.0-py3.4.egg to /root/ros2_ws/install/lib/python3.4/site-packages
Adding ament-package 0.0.0 to easy-install.pth file
Installed /root/ros2_ws/install/lib/python3.4/site-packages/ament_package-0.0.0-py3.4.egg
Processing dependencies for ament-package==0.0.0
Finished processing dependencies for ament-package==0.0.0
writing list of installed files to '/root/ros2_ws/build/ament_package/install.log'
running build
Process package 'ament_package' with context:
--------------------------------------------------------------------------------
source_space => /root/ros2_ws/src/ament/ament_package
build_space => /root/ros2_ws/build/ament_package
install_space => /root/ros2_ws/install
make_flags => -j8, -l8
build_tests => True
--------------------------------------------------------------------------------
+++ Testing 'ament_package'
Traceback (most recent call last):
File "src/ament/ament_tools/scripts/ament.py", line 111, in <module>
sys.exit(main() or 0)
File "/root/ros2_ws/src/ament/ament_tools/ament_tools/commands/ament.py", line 88, in main
rc = args.main(args)
File "/root/ros2_ws/src/ament/ament_tools/ament_tools/verbs/test/cli.py", line 65, in main
build_main(opts, test_pkg_main_wrapper)
File "/root/ros2_ws/src/ament/ament_tools/ament_tools/verbs/build/cli.py", line 138, in main
iterate_packages(opts, packages, per_package_main)
File "/root/ros2_ws/src/ament/ament_tools/ament_tools/verbs/build/cli.py", line 190, in iterate_packages
rc = per_package_callback(opts)
File "/root/ros2_ws/src/ament/ament_tools/ament_tools/verbs/test/cli.py", line 58, in test_pkg_main_wrapper
rc = test_pkg_main(opts)
File "/root/ros2_ws/src/ament/ament_tools/ament_tools/verbs/test_pkg/cli.py", line 49, in main
handle_build_action(on_test_ret, context)
File "/root/ros2_ws/src/ament/ament_tools/ament_tools/verbs/build_pkg/cli.py", line 256, in handle_build_action
run_command(build_action, context)
File "/root/ros2_ws/src/ament/ament_tools/ament_tools/verbs/build_pkg/cli.py", line 237, in run_command
" ".join(build_action.cmd), cwd))
TypeError: sequence item 3: expected str instance, NoneType found
There are a few complications with this, such as passing "make arguments" through cmake --build
(when using make
), but I think it will make our tools more flexible.
Many packages try to provide ros integration without making ros a requirement for other potential package users that do not or cannot support ros/ros2 for legacy, contractual, or application specific reasons. Ideally the new build system will make it as simple a process as possible to enable a package to support ROS2 messages/nodes while not requiring them. This means if a recommended layout is provided it is not required, and if ament isn't installed on the system CMake builds can still succeed, perhaps depending on a simple parameter or check for the presence of amant.
Thanks for considering this request!
As @wjwwood suggested during our discussion of #42, we could accommodate system installations by adding an option to ament build
, say, --sudo-install
that would prefix the install steps (but not the build steps) with sudo
. Windows compatibility would be an issue, so perhaps this option wouldn't be supported on that platform.
When installing Python packages and trying to keep all build artifacts out-of-source (--egg-base
) the EGG-INFO folder lacks several files, e.g. entry_points.txt
which breaks entry points.
This is ticketed upstream at https://bitbucket.org/pypa/setuptools/pull-request/85/
A work around is to use --symlink-install
which uses setup.py develop
instead of install
. But that only works when the Python packages don't have any scripts (see #18).
http://www.cmake.org/Wiki/CMake:Packaging_With_CPack
Since ament uses CMake under the covers, it seems reasonable to me to support some of the CPack features like generating Debian packages directly from ament packages. Not everyone wants to set up bloom and the complicated multi-repository upstream stuff... Sometimes I just want to take the install space I've already generated, add a control file, and be done with it.
I'd like to propose a new verb and accompanying ament cmake macros. Something like 'ament release' (and 'ament release_pkg') to generate debs (or other installer formats) from all packages or selected packages. The cmake macros would be helpful wrappers that automatically pull information from package.xml to populate the cpack variables.
I propose that ament build
only build and not install. A new ament install
subcommand would build (which might be very quick if everything is built) and install. In other words, follow the make
and make install
pattern.
I realize that this separation of steps is already possible by using the --skip-build
and --skip-install
options to ament build
. I also realize that it's not recommended that I try to actually use the result of the build
step (this is the case with lots of software). But as it currently stands, the default behavior of ament build
is different from the default behavior of every other command-line build tool I've used.
How can I use ament in order to list all packages a package depends on? The command ament list_packages
only has an option that list all packages that depend on a given package.
Filled upstream: https://bitbucket.org/pypa/setuptools/issue/361/
Make sure they actually install package.xml, etc
What python3-pytest
I installed is 2.8.7-4
and there is no support to option -o
now from the checking of output via:
python3 -u -m pytest --help
After enabling python unittest of a ROS2 components, for example:
find_package(ament_cmake_pytest REQUIRED)
ament_add_pytest_test(enumerants.py "enumerants.py")
then build and run the tests accordingly
ament test --skip-build --skip-install --only-packages <your-component>
The following error will occurs:
2: Test timeout computed to be: 60
2: -- run_test.py: invoking following command in '/home/ethan/Myspace/rosdev/2upstream/vision_opencv/cv_bridge':
2: - /usr/bin/python3 -u -m pytest /home/ethan/Myspace/rosdev/2upstream/ci/src/cv_bridge/test/enumerants.py -o cache_dir=/home/ethan/Myspace/rosdev/2upstream/ci/build/cv_bridge/test/ament_cmake_pytest/enumerants.py/.cache --junit-xml=/home/ethan/Myspace/rosdev/2upstream/ci/build/cv_bridge/test_results/cv_bridge/enumerants.py.xunit.xml --junit-prefix=cv_bridge
2: usage: pytest.py [options] [file_or_dir] [file_or_dir] [...]
2: pytest.py: error: unrecognized arguments: -o cache_dir=/home/ethan/Myspace/rosdev/2upstream/ci/build/cv_bridge/test/ament_cmake_pytest/enumerants.py/.cache
2: inifile: None
2: rootdir: /home/ethan/Myspace/rosdev/2upstream
2: -- run_test.py: return code 2
2: -- run_test.py: generate result file '/home/ethan/Myspace/rosdev/2upstream/ci/build/cv_bridge/test_results/cv_bridge/enumerants.py.xunit.xml' with failed test
2: -- run_test.py: verify result file '/home/ethan/Myspace/rosdev/2upstream/ci/build/cv_bridge/test_results/cv_bridge/enumerants.py.xunit.xml'
2/4 Test #2: enumerants.py ....................***Failed 0.48 sec
If I have an ament_cmake
package with python tests, if they take too long they timeout and get killed by ctest.
If the same test is being called from within an ament_python
package, I can't get the timeout to trigger.
See for example this dummy package: changing this line to ament_cmake
makes the timeout trigger.
How can I get the nose test to timeout? from what I've read (python3 -m nose --help
) there should be a default timeout value of 10 seconds. I have tried adding --process-timeout=2
to the test call but nothing changed.
I am implementing list_dependencies verb for ament.py and ran into the following:
$ ament.py list_dependencies -h
optional arguments:
-h, --help show this help message and exit
--build Show build dependencies of a given package
while when I run
$ ament.py list_dependencies --build foobar
build_pkg
usage: ament.py build_pkg [-h] [--build-space BUILD_SPACE]
That happens because prepare_argument of build_pkg verb removes the verb and tries to parse other arguments regardless of the verb given.
See also: osrf/osrf_pycommon#33
Whenever I try to use the build_pkg or test_pkg verbs on ament_cmake packages instead of build/test, I get the following error:
$ ament build_pkg .
Process package 'pendulum_msgs' with context:
--------------------------------------------------------------------------------
source_space => /Users/deanna/ros2_ws/src-master/ros2/demos/pendulum_msgs
build_space => /Users/deanna/ros2_ws/src-master/ros2/demos/pendulum_msgs/build/pendulum_msgs
install_space => /Users/deanna/ros2_ws/src-master/ros2/demos/pendulum_msgs/install
make_flags => None
build_tests => False
--------------------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/deanna/ros2_ws/src-master/ament/ament_tools/install/bin/ament", line 9, in <module>
load_entry_point('ament-tools==0.0.0', 'console_scripts', 'ament')()
File "/Users/deanna/ros2_ws/src-master/ament/ament_tools/install/lib/python3.5/site-packages/ament_tools/commands/ament.py", line 88, in main
rc = args.main(args)
File "/Users/deanna/ros2_ws/src-master/ament/ament_tools/install/lib/python3.5/site-packages/ament_tools/verbs/build_pkg/cli.py", line 270, in main
context = get_context(opts)
File "/Users/deanna/ros2_ws/src-master/ament/ament_tools/install/lib/python3.5/site-packages/ament_tools/verbs/build_pkg/cli.py", line 276, in get_context
return create_context(opts)
File "/Users/deanna/ros2_ws/src-master/ament/ament_tools/install/lib/python3.5/site-packages/ament_tools/verbs/build_pkg/cli.py", line 383, in create_context
ce = build_type_impl.extend_context(opts)
File "/Users/deanna/ros2_ws/src-master/ament/ament_tools/install/lib/python3.5/site-packages/ament_tools/build_types/ament_cmake.py", line 59, in extend_context
ce = super(AmentCmakeBuildType, self).extend_context(options)
File "/Users/deanna/ros2_ws/src-master/ament/ament_tools/install/lib/python3.5/site-packages/ament_tools/build_types/cmake.py", line 88, in extend_context
force_cmake_configure = options.force_cmake_configure
AttributeError: 'Namespace' object has no attribute 'force_cmake_configure'
This happens for me regardless of the options passed, but I think the fix might depend on the following:
Is it expected that cmake options can be passed to ament_cmake packages when using build_pkg
, as is possible with build
?
If the answer's no, then I think it might be sufficient to provide default values for the cmake args to avoid the error here
If the answer's yes, then I think cmake args, in addition to the ament_cmake args, have to be added to the build_pkg subparser when an ament_cmake package is detected. (I made an attempt at this with #81)
I sometimes have the problem that a build on windows of a package hangs. I can then press STRG + C and it continues compilation.
The last package I had this problem was this one: https://github.com/firesurfer/rclcs_testing_ws/blob/master/src/test_cpp/CMakeLists.txt
It uses a fairly old syntax but still compiles fine. I also had this problem on some packages of the ros2 sources.
discussed in the past (e.g. #114 (comment)).
Implementing a --deps
flag resulting in building the dependency of package(s) specified with --only
There is currently no setup.bash
file created when compiling with --isolated
. There is only a local_setup.bash
which makes chaining workspaces more clumsy.
Both files are generated when compiling without isolation.
As an occasional contributor, I'm frequently tripped up when the last output from ament test
is happy and I forget to check for earlier failures. I know that I can run ament test_results
to get the summary, but I guess that I just can't get over the expectation that ament test
should provide me some sort of summary or at least a red light vs. green light at then of its run (at present, a test failure somewhere in the run doesn't even produce a non-zero return code at the end).
E.g., ros2/cli_tools#6 is a case where that mistake on my part lead @mikaelarguedas and I to spend time investigating a non-existent problem.
Proposal: modify ament test
to give the ament test_results
output when it's done. If compute overhead for collating the results is a concern, then an option could be added to disable the summary (but the default should be to enable it). If this sounds like a good change, I'm happy to provide a PR.
If I install to a particular location, delete it, and then install to a different location, cmake is still trying to install to the first location.
It will install to the second location if I add --force-cmake-configure
, but I feel like it's not really "expected behaviour" that this is not triggered automatically.
Note that this means that sourcing the setup file of the second install fails with:
dhood@osrf-esteve:~/ros2_test_ws [ros2_test_ws]$ source install_2/setup.bash
Traceback (most recent call last):
File "/home/dhood/ros2_test_ws/install_2/_order_packages.py", line 72, in <module>
main()
File "/home/dhood/ros2_test_ws/install_2/_order_packages.py", line 38, in main
package_names = [d for d in os.listdir(path)]
FileNotFoundError: [Errno 2] No such file or directory: '/home/dhood/ros2_test_ws/install_2/share/ament_index/resource_index/packages'
broken since #114
dhood@osrf-esteve:~/ros2_test_ws [ros2_test_ws]$ ament uninstall
# Topological order
Traceback (most recent call last):
File "/home/dhood/ros2_ws/install_isolated/ament_tools/bin/ament", line 9, in <module>
load_entry_point('ament-tools', 'console_scripts', 'ament')()
File "/home/dhood/ros2_ws/build_isolated/ament_tools/ament_tools/commands/ament.py", line 88, in main
rc = args.main(args)
File "/home/dhood/ros2_ws/build_isolated/ament_tools/ament_tools/verbs/uninstall/cli.py", line 91, in main
print_topological_order(opts, packages)
File "/home/dhood/ros2_ws/build_isolated/ament_tools/ament_tools/verbs/build/cli.py", line 240, in print_topological_order
if pkg_name in opts.skip_packages:
AttributeError: 'Namespace' object has no attribute 'skip_packages'
If you follow this tutorial https://github.com/ros2/ros2/wiki/Ament-Tutorial the part where it says
If you are returning with a new terminal to your development and want to pick up developing on your overlay you can simply source ~/overlay_ws/setup.bash which will source all parent workspaces environments automatically.
works fine for ament_cmake packages but doesn't seem to apply to ament_python packages.
I understand this to be related to #109
(The following outputs are from a while ago, but ros2/ros2#312, which was opened today, is the same issue)
dhood@osrf-esteve:~/overlay_ws [overlay_ws]$ . install/setup.bash
Warning: OSPL_URI was already set to [[file:///usr/etc/opensplice/config/ospl.xml]]. This will not override it to the default [[file:///home/dhood/ros2_ws1/install_isolated/opensplice_cmake_module/share/opensplice_cmake_module/config/ros_ospl.xml]]. Please make sure this is the config that you want.
dhood@osrf-esteve:~/overlay_ws [overlay_ws]$ talker_py
Traceback (most recent call last):
File "/home/dhood/overlay_ws/install/bin/talker_py", line 9, in
load_entry_point('rclpy-examples==0.0.0', 'console_scripts', 'talker_py')()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 542, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2569, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2229, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2235, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/home/dhood/overlay_ws/install/lib/python3.5/site-packages/topics/talker_py.py", line 18, in
import rclpy
File "/home/dhood/ros2_ws1/install_isolated/rclpy/lib/python3.5/site-packages/rclpy/__init__.py", line 23, in
from rclpy.impl import rmw_implementation_tools
File "/home/dhood/ros2_ws1/install_isolated/rclpy/lib/python3.5/site-packages/rclpy/impl/rmw_implementation_tools.py", line 18, in
import ament_index_python
ImportError: No module named 'ament_index_python'
dhood@osrf-esteve:~/overlay_ws [overlay_ws]$ echo $PYTHONPATH
/home/dhood/overlay_ws/install/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/tf2_msgs/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/rclpy/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/sensor_msgs/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/ros1_bridge/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/nav_msgs/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/diagnostic_msgs/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/geometry_msgs/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/std_msgs/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/rosidl_generator_py/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/rcl_interfaces/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/pendulum_msgs/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/example_interfaces/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/builtin_interfaces/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/rosidl_typesupport_opensplice_c/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/rosidl_typesupport_opensplice_cpp/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/rosidl_typesupport_introspection_cpp/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/rosidl_typesupport_introspection_c/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/rosidl_typesupport_connext_c/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/rosidl_typesupport_connext_cpp/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/rosidl_generator_dds_idl/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/rosidl_generator_cpp/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/rosidl_generator_c/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/rosidl_cmake/lib/python3.5/site-packages:/home/dhood/ros2_ws1/install_isolated/rosidl_parser/lib/python3.5/site-packages
dhood@osrf-esteve:~/overlay_ws [overlay_ws]$ echo $PYTHONPATH | grep ament
dhood@osrf-esteve:~/overlay_ws [overlay_ws]$
dhood@osrf-esteve:~/overlay_ws [overlay_ws]$ echo $PATH
/home/dhood/overlay_ws/install/bin:/home/dhood/ros2_ws1/install_isolated/uncrustify/bin:/home/dhood/ros2_ws1/install_isolated/pendulum_control/bin:/home/dhood/ros2_ws1/install_isolated/tlsf_cpp/bin:/home/dhood/ros2_ws1/install_isolated/tlsf/bin:/home/dhood/ros2_ws1/install_isolated/tf2_ros/bin:/home/dhood/ros2_ws1/install_isolated/tf2_msgs/bin:/home/dhood/ros2_ws1/install_isolated/tf2/bin:/home/dhood/ros2_ws1/install_isolated/test_rclcpp/bin:/home/dhood/ros2_ws1/install_isolated/test_communication/bin:/home/dhood/ros2_ws1/install_isolated/rclpy/bin:/home/dhood/ros2_ws1/install_isolated/rclcpp_examples/bin:/home/dhood/ros2_ws1/install_isolated/intra_process_demo/bin:/home/dhood/ros2_ws1/install_isolated/image_tools/bin:/home/dhood/ros2_ws1/install_isolated/sensor_msgs/bin:/home/dhood/ros2_ws1/install_isolated/ros1_bridge/bin:/home/dhood/ros2_ws1/install_isolated/composition/bin:/home/dhood/ros2_ws1/install_isolated/rclcpp/bin:/home/dhood/ros2_ws1/install_isolated/rclc/bin:/home/dhood/ros2_ws1/install_isolated/rcl/bin:/home/dhood/ros2_ws1/install_isolated/nav_msgs/bin:/home/dhood/ros2_ws1/install_isolated/diagnostic_msgs/bin:/home/dhood/ros2_ws1/install_isolated/geometry_msgs/bin:/home/dhood/ros2_ws1/install_isolated/std_msgs/bin:/home/dhood/ros2_ws1/install_isolated/rttest/bin:/home/dhood/ros2_ws1/install_isolated/rosidl_default_generators/bin:/home/dhood/ros2_ws1/install_isolated/rosidl_generator_py/bin:/home/dhood/ros2_ws1/install_isolated/rcl_interfaces/bin:/home/dhood/ros2_ws1/install_isolated/pendulum_msgs/bin:/home/dhood/ros2_ws1/install_isolated/example_interfaces/bin:/home/dhood/ros2_ws1/install_isolated/builtin_interfaces/bin:/home/dhood/ros2_ws1/install_isolated/rosidl_default_runtime/bin:/home/dhood/ros2_ws1/install_isolated/rmw_implementation/bin:/home/dhood/ros2_ws1/install_isolated/rmw_opensplice_cpp/bin:/home/dhood/ros2_ws1/install_isolated/rosidl_typesupport_opensplice_c/bin:/home/dhood/ros2_ws1/install_isolated/rosidl_typesupport_opensplice_cpp/bin:/home/dhood/ros2_ws1/install_isolated/rmw_fastrtps_cpp/bin:/home/dhood/ros2_ws1/install_isolated/rmw_connext_dynamic_cpp/bin:/home/dhood/ros2_ws1/install_isolated/rosidl_typesupport_introspection_cpp/bin:/home/dhood/ros2_ws1/install_isolated/rosidl_typesupport_introspection_c/bin:/home/dhood/ros2_ws1/install_isolated/rmw_connext_cpp/bin:/home/dhood/ros2_ws1/install_isolated/rosidl_typesupport_connext_c/bin:/home/dhood/ros2_ws1/install_isolated/rosidl_typesupport_connext_cpp/bin:/home/dhood/ros2_ws1/install_isolated/rosidl_generator_dds_idl/bin:/home/dhood/ros2_ws1/install_isolated/rosidl_generator_cpp/bin:/home/dhood/ros2_ws1/install_isolated/rmw/bin:/home/dhood/ros2_ws1/install_isolated/rosidl_generator_c/bin:/home/dhood/ros2_ws1/install_isolated/rosidl_cmake/bin:/home/dhood/ros2_ws1/install_isolated/rosidl_parser/bin:/home/dhood/ros2_ws1/install_isolated/rmw_implementation_cmake/bin:/home/dhood/ros2_ws1/install_isolated/rmw_connext_shared_cpp/bin:/home/dhood/ros2_ws1/install_isolated/python_cmake_module/bin:/home/dhood/ros2_ws1/install_isolated/class_loader/bin:/home/dhood/ros2_ws1/install_isolated/poco_vendor/bin:/home/dhood/ros2_ws1/install_isolated/opensplice_cmake_module/bin:/home/dhood/ros2_ws1/install_isolated/ament_index_cpp/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_gtest/bin:/home/dhood/ros2_ws1/install_isolated/gtest_vendor/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_gmock/bin:/home/dhood/ros2_ws1/install_isolated/gmock_vendor/bin:/home/dhood/ros2_ws1/install_isolated/fastrtps_cmake_module/bin:/home/dhood/ros2_ws1/install_isolated/fastrtps/bin:/home/dhood/ros2_ws1/install_isolated/fastcdr/bin:/home/dhood/ros2_ws1/install_isolated/console_bridge/bin:/home/dhood/ros2_ws1/install_isolated/connext_cmake_module/bin:/home/dhood/rti_connext_dds-5.2.3/lib/x64Linux3gcc4.8.2:/home/dhood/rti_connext_dds-5.2.3/bin:/home/dhood/ros2_ws1/install_isolated/ament_lint_common/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_uncrustify/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_pyflakes/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_pep8/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_pep257/bin:/home/dhood/ros2_ws1/install_isolated/ament_lint_auto/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_nose/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_cpplint/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_cppcheck/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_clang_format/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_copyright/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_lint_cmake/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_auto/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_test/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_target_dependencies/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_python/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_export_dependencies/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_libraries/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_include_directories/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_export_link_flags/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_export_libraries/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_export_interfaces/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_export_include_directories/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_export_definitions/bin:/home/dhood/ros2_ws1/install_isolated/ament_cmake_core/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
Context:
ament infers the dependencies of packages in order to build a workspace with multiple packages in the right order. While the Python API of ament_package
already exposes the information about a package’s dependencies, there is currently no command line option for ament
for outputting the information (see #107).
Pointers:
Re: ros2/ros2#20 Testing branch at: https://github.com/ros2/ros2/tree/spaces_in_path
- userland_msgs
- userland
Process package 'ament_copyright' with context:
--------------------------------------------------------------------------------
source_space => /home/rosbuild/ros2_ws with_space/src/ament/ament_lint/ament_copyright
build_space => /home/rosbuild/ros2_ws with_space/build space/ament_copyright
install_space => /home/rosbuild/ros2_ws with_space/install space
make_flags => -j8, -l8
build_tests => True
--------------------------------------------------------------------------------
+++ Building 'ament_copyright'
+++ Installing 'ament_copyright'
==> '. /home/rosbuild/ros2_ws with_space/build space/ament_copyright/ament_python__install.sh && /usr/bin/python3 setup.py egg_info --egg-base /home/rosbuild/ros2_ws with_space/build space/ament_copyright build --build-base /home/rosbuild/ros2_ws with_space/build space/ament_copyright/build install --prefix /home/rosbuild/ros2_ws with_space/install space --install-scripts /home/rosbuild/ros2_ws with_space/install space/bin --record /home/rosbuild/ros2_ws with_space/build space/ament_copyright/install.log bdist_egg --dist-dir /home/rosbuild/ros2_ws with_space/build space/ament_copyright/dist' in '/home/rosbuild/ros2_ws with_space/src/ament/ament_lint/ament_copyright'
/bin/sh: 159: export: with_space/install: bad variable name
<== Command '. '/home/rosbuild/ros2_ws with_space/build space/ament_copyright/ament_python__install.sh' && /usr/bin/python3 setup.py egg_info --egg-base '/home/rosbuild/ros2_ws with_space/build space/ament_copyright' build --build-base '/home/rosbuild/ros2_ws with_space/build space/ament_copyright/build' install --prefix '/home/rosbuild/ros2_ws with_space/install space' --install-scripts '/home/rosbuild/ros2_ws with_space/install space/bin' --record '/home/rosbuild/ros2_ws with_space/build space/ament_copyright/install.log' bdist_egg --dist-dir '/home/rosbuild/ros2_ws with_space/build space/ament_copyright/dist'' failed with exit code '2'
Connects to ros2/ros2#20
I did some research last night about getting colors out of msbuild
since the output is really hard to read without it. But the best solution I could come up with is to make a custom logger for msbuild
which outputs ANSI escape sequences rather than the normal Windows color system.
Combining this with the ANSI Jenkins plugin which I've already tested, should work nicely. Test is here:
http://54.183.26.131:8080/job/testing_ansi/10/console
Basically, ament build
would need to build and provide the custom logger (a C# library) and pass it to msbuild
. Here is a library someone put together that does just that:
AC:
ament build
builds this library if on Windows and then passes it to the invocations of msbuild
.msbuild
outputs ANSI escape sequences for colored text, allowing Jenkins or Cmder to process it.This is obviously super low priority, but would be nice to have at some point.
This would catch scenarios where an ament_cmake
package (as declared in the package.xml
's <export><build_type>...
section) but the user did not call ament_package()
in cmake.
Basically the tool would just check that the file <prefix>/share/ament_index/resource_index/packages/<package name>
exists after completing the install step.
uninstalling only works if it's invoked passing the same install prefix. Is that the expected behaviour?
So, after ament build --install-space install1
I have to call ament uninstall --install-space install1
If it is the expected behaviour, I think we should be more carefull about removing the install.log
here. Always deleting it means that after calling ament uninstall
which doesn't uninstall anything, if I later call ament uninstall --install-space install1
nothing will happen
+++ Building 'ament_cppcheck'
'C:\Program' is not recognized as an internal or external command, operable program or batch file.
This happens because ament_tools/ament_tools/setup_arguments.py contains the following command line construction code:
# invoke get_setup_arguments() in a separate interpreter
cmd = prefix + [sys.executable, '-c', '"%s"' % ';'.join(code_lines)]
result = subprocess.run(
' '.join(cmd), stdout=subprocess.PIPE, shell=True, check=True)
If Python got installed into "Program Files" folder, the final unquoted command line cmd can't be executed.
Proposed solution:
sys_executable = sys.executable
if not (sys_executable.startswith('"') and sys_executable.endswith('"')):
sys_executable = '"' + sys_executable + '"'
cmd = prefix + [sys_executable, '-c', '"%s"' % ';'.join(code_lines)]
Extesnion's source files are not linked during --symlink-install, resulting in compilation failure:
sergii@s-strelkovskyi-d:/tmp/test_ament$ ament build --symlink-install
# Topological order
- ext_test
Process package 'ext_test' with context:
--------------------------------------------------------------------------------
source_space => /tmp/test_ament/src/ext_test
build_space => /tmp/test_ament/build/ext_test
install_space => /tmp/test_ament/install
make_flags => -j8, -l8
build_tests => False
--------------------------------------------------------------------------------
+++ Building 'ext_test'
+++ Installing 'ext_test'
-- [ament] Deploying: /tmp/test_ament/install/share/ext_test/package.xml
-- [ament] Deploying: /tmp/test_ament/install/share/ext_test/environment/ament_prefix_path.sh
-- [ament] Deploying: /tmp/test_ament/install/share/ext_test/environment/path.sh
-- [ament] Deploying: /tmp/test_ament/install/share/ext_test/environment/pythonpath.sh
-- [ament] Deploying: /tmp/test_ament/install/share/ext_test/local_setup.bash
-- [ament] Deploying: /tmp/test_ament/install/share/ext_test/local_setup.sh
-- [ament] Deploying: /tmp/test_ament/install/share/ext_test/local_setup.zsh
==> '. /tmp/test_ament/build/ext_test/ament_python__install.sh && /usr/bin/python3 setup.py develop --prefix /tmp/test_ament/install --no-deps' in '/tmp/test_ament/build/ext_test'
running develop
running egg_info
creating dsst.egg-info
writing dependency_links to dsst.egg-info/dependency_links.txt
writing dsst.egg-info/PKG-INFO
writing top-level names to dsst.egg-info/top_level.txt
writing manifest file 'dsst.egg-info/SOURCES.txt'
reading manifest file 'dsst.egg-info/SOURCES.txt'
writing manifest file 'dsst.egg-info/SOURCES.txt'
running build_ext
building '_ext_test' extension
creating build
creating build/temp.linux-x86_64-3.5
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack- protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr /include/python3.5m -c ext_test.c -o build/temp.linux-x86_64-3.5/ext_test.o
x86_64-linux-gnu-gcc: error: ext_test.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
<== Command '. /tmp/test_ament/build/ext_test/ament_python__install.sh && /usr/bin/python3 setup.py develop --prefix /tmp/test_ament/install --no-deps' failed in '/tmp/test_ament/build/ext_test' with exit code '1'
<== Command '. /tmp/test_ament/build/ext_test/ament_python__install.sh && /usr/bin/python3 setup.py develop --prefix /tmp/test_ament/install --no-deps' failed in '/tmp/test_ament/build/ext_test' with exit code '1'
Is there any tool currently in ament which can generate a report document (.pdf,.xls etc.) for the test results ? I want some help in this area.
If cmake is not installed ament_tools trys to invoke "None" which doesn't work.
# Building: ament_cmake_symlink_install
Build package 'ament_cmake_symlink_install' with context:
--------------------------------------------------------------------------------
source_space => /ros2_ws/src/ament/ament_cmake/ament_cmake_symlink_install
build_space => /tmp/ament_build_pkg/build/ament_cmake_symlink_install
install_space => /tmp/ament_build_pkg/install
make_flags => None
testing => False
--------------------------------------------------------------------------------
+++ Building 'ament_cmake_symlink_install'
Traceback (most recent call last):
File "//ros2_ws/venv/bin/ament", line 9, in <module>
load_entry_point('ament-tools==0.0.0', 'console_scripts', 'ament')()
File "//ros2_ws/venv/lib/python3.4/site-packages/ament_tools-0.0.0-py3.4.egg/ament_tools/commands/ament.py", line 85, in main
File "//ros2_ws/venv/lib/python3.4/site-packages/ament_tools-0.0.0-py3.4.egg/ament_tools/verbs/build/cli.py", line 113, in main
File "//ros2_ws/venv/lib/python3.4/site-packages/ament_tools-0.0.0-py3.4.egg/ament_tools/verbs/build_pkg/cli.py", line 277, in main
File "//ros2_ws/venv/lib/python3.4/site-packages/ament_tools-0.0.0-py3.4.egg/ament_tools/verbs/build_pkg/cli.py", line 225, in handle_build_action
File "//ros2_ws/venv/lib/python3.4/site-packages/ament_tools-0.0.0-py3.4.egg/ament_tools/verbs/build_pkg/cli.py", line 205, in run_command
TypeError: sequence item 0: expected str instance, NoneType found
ament seems to mess up parsing of setup's arguments if there is anything other than string:
sergii@s-strelkovskyi-d:/tmp/test_ament$ ament build
# Topological order
- ext_test
Process package 'ext_test' with context:
--------------------------------------------------------------------------------
source_space => /tmp/test_ament/src/ext_test
build_space => /tmp/test_ament/build/ext_test
install_space => /tmp/test_ament/install
make_flags => -j8, -l8
build_tests => False
--------------------------------------------------------------------------------
+++ Building 'ext_test'
Traceback (most recent call last):
File "/opt/ros/ardent/bin/ament", line 9, in <module>
load_entry_point('ament-tools==0.4.0', 'console_scripts', 'ament')()
File "/opt/ros/ardent/lib/python3.5/site-packages/ament_tools/commands/ament.py", line 88, in main
rc = args.main(args)
File "/opt/ros/ardent/lib/python3.5/site-packages/ament_tools/verbs/build/cli.py", line 172, in main
return iterate_packages(opts, packages, per_package_main)
File "/opt/ros/ardent/lib/python3.5/site-packages/ament_tools/verbs/build/cli.py", line 300, in iterate_packages
rc = process_sequentially(jobs)
File "/opt/ros/ardent/lib/python3.5/site-packages/ament_tools/verbs/build/cli.py", line 340, in process_sequentially
rc = job['callback'](job['opts'])
File "/opt/ros/ardent/lib/python3.5/site-packages/ament_tools/verbs/build_pkg/cli.py", line 280, in main
return run(opts, context)
File "/opt/ros/ardent/lib/python3.5/site-packages/ament_tools/verbs/build_pkg/cli.py", line 331, in run
handle_build_action(on_build_ret, context)
File "/opt/ros/ardent/lib/python3.5/site-packages/ament_tools/verbs/build_pkg/cli.py", line 268, in handle_build_action
for build_action in build_action_ret:
File "/opt/ros/ardent/lib/python3.5/site-packages/ament_tools/build_types/ament_python.py", line 45, in on_build
self._update_context_with_setup_arguments(context)
File "/opt/ros/ardent/lib/python3.5/site-packages/ament_tools/build_types/ament_python.py", line 411, in _update_context_with_setup_arguments
AmentPythonBuildType.build_type, context)
File "/opt/ros/ardent/lib/python3.5/site-packages/ament_tools/setup_arguments.py", line 66, in get_setup_arguments_with_context
return ast.literal_eval(output)
File "/usr/lib/python3.5/ast.py", line 46, in literal_eval
node_or_string = parse(node_or_string, mode='eval')
File "/usr/lib/python3.5/ast.py", line 35, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
File "<unknown>", line 1
{'version': '1.0.0', 'packages': [], 'name': 'test', 'ext_modules': [<setuptools.extension.Extension('test') at 0x7f34a8887cc0>]}
^
SyntaxError: invalid syntax
Following error happens on osx and trusty (at least) with any set of arguments
14:34:37 deanna /Users/deanna/ros2_ws
$ src-master/ament/ament_tools/scripts/ament.py uninstall --only-package rmw_connext_cpp
Traceback (most recent call last):
File "src-master/ament/ament_tools/scripts/ament.py", line 149, in <module>
sys.exit(main() or 0)
File "/Users/deanna/ros2_ws/src-master/ament/ament_tools/ament_tools/commands/ament.py", line 88, in main
rc = args.main(args)
File "/Users/deanna/ros2_ws/src-master/ament/ament_tools/ament_tools/verbs/uninstall/cli.py", line 90, in main
print_topological_order(opts, packages)
File "/Users/deanna/ros2_ws/src-master/ament/ament_tools/ament_tools/verbs/build/cli.py", line 172, in print_topological_order
opts.skip_packages = opts.skip_packages or []
AttributeError: 'Namespace' object has no attribute 'skip_packages'
Think the cause is similar to #84 but haven't looked into it yet
I'm using an overlay workspace ROS 2, trying to rebuild some of the ROS 2 demo nodes in the demo_nodes_py
ament_python
package.
I'm using --symlink-install
with my overlay installation, and the demo nodes also exist in the underlay (not symlink installed). I expected the overlay to have "preference", but it does not (despite being higher on the PYTHONPATH).
This happens in isolated and non-isolated installs, with the underlay from the OS X packaging job or built from source.
I am calling ament list_packages
from the base of a ROS 2 workspace. In this directory I have src
, build_isolated
and install_isolated
directories.
I get the following error:
dhood@osrf-esteve:~/ros2_ws-flake8 [ros2_ws-flake8]$ ament list_packages
Traceback (most recent call last):
File "/home/dhood/ros2_ws-flake8/install_isolated/ament_tools/bin/ament", line 9, in <module>
load_entry_point('ament-tools==0.0.0', 'console_scripts', 'ament')()
File "/home/dhood/ros2_ws-flake8/install_isolated/ament_tools/lib/python3.5/site-packages/ament_tools/commands/ament.py", line 88, in main
rc = args.main(args)
File "/home/dhood/ros2_ws-flake8/install_isolated/ament_tools/lib/python3.5/site-packages/ament_tools/verbs/list_packages.py", line 87, in main
package = package or parse_package(package_abs_path)
File "/home/dhood/ros2_ws-flake8/install_isolated/ament_tools/lib/python3.5/site-packages/ament_tools/package_types/__init__.py", line 31, in parse_package
pkg = package_type['parse_package'](path)
File "/home/dhood/ros2_ws-flake8/install_isolated/ament_tools/lib/python3.5/site-packages/ament_tools/package_types/cmake.py", line 33, in parse_package
data = extract_data(cmakelists)
File "/home/dhood/ros2_ws-flake8/install_isolated/ament_tools/lib/python3.5/site-packages/ament_tools/package_types/cmake.py", line 47, in extract_data
raise RuntimeError("Failed to extract project name from '%s'" % cmakelists)
RuntimeError: Failed to extract project name from './build_isolated/test_rclcpp/test_rclcpp__py/CMakeLists.txt'
That CMakeLists.txt
is in the build directory and is just being used as part of a package's build process, it's never installed.
Would it make sense to specify that the build and build_isolated directories be excluded when find_package_paths is called for the list verb?
Perhaps that should be the default in the find_package_paths
?
When I do a vcs list
on my workspace I notice that repositories with AMENT_IGNOREs do not get listed. That's actually really convenient, although I'm kind of confused about why it happens because I thought ament and vcstool were different tools that weren't aware of each other.
Following discussions on other issues (e.g., #139 and ros-infrastructure/ros_buildfarm#367), I'd like to propose a change in the behavior of ament
: Make ament test
return non-zero if:
At present, ament test
returns non-zero only for the first two conditions, but not the third.
Rationale: ament test
is a step that aggregates underlying steps and as such it should follow the common pattern of ORing together the return codes of those underlying steps to produce its own return code.
Pro:
ament test_results
(this command does return non-zero if any of the results include test failures).Con:
(Note that you can still distinguish build failure from test failure by run ament build
and ament test
separately.)
My opinion is that the benefits of the pro outweigh the costs of the con. Thoughts?
p.s. I'm proposing this change only for ament
, which is a new tool that we can fairly freely modify. The same change could in principle be made to catkin
, but there seems to be risk of disruption in doing that.
This function:
https://github.com/ament/ament_tools/blob/master/ament_tools/build_types/cmake.py#L346-L364
Currently sources dependencies of the package being built in an arbitrary order if they have a local_setup.*
file.
Instead it should source the local_setup.*
files for the recursive build dependencies and they should be sourced in topological order.
E.g. http://ci.ros2.org/job/ci_osx/1874/console and http://ci.ros2.org/job/ci_osx/1875/console
This looks like a bug in the parallel building logic.
ament build . --cmake-args -DCMAKE_BUILD_TYPE=Release --force-cmake-configure
gives
$ ament build . --cmake-args -DCMAKE_BUILD_TYPE=Release --force-cmake-configure
# Topological order
- rcl
Process package 'rcl' with context:
--------------------------------------------------------------------------------
source_space => /home/dhood/ros2_ws/src/ros2/rcl/rcl
build_space => /home/dhood/ros2_ws/src/ros2/rcl/rcl/build/rcl
install_space => /home/dhood/ros2_ws/src/ros2/rcl/rcl/install
make_flags => -j4, -l4
build_tests => False
--------------------------------------------------------------------------------
+++ Building 'rcl'
Running cmake because arguments have changed.
==> '. /home/dhood/ros2_ws/src/ros2/rcl/rcl/build/rcl/cmake__build.sh && /usr/bin/cmake /home/dhood/ros2_ws/src/ros2/rcl/rcl -DCMAKE_BUILD_TYPE=Release --force-cmake-configure -DCMAKE_INSTALL_PREFIX=/home/dhood/ros2_ws/src/ros2/rcl/rcl/install' in '/home/dhood/ros2_ws/src/ros2/rcl/rcl/build/rcl'
CMake Error: The source directory "/home/dhood/ros2_ws/src/ros2/rcl/rcl/build/rcl/--force-cmake-configure" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
<== Command '. /home/dhood/ros2_ws/src/ros2/rcl/rcl/build/rcl/cmake__build.sh && /usr/bin/cmake /home/dhood/ros2_ws/src/ros2/rcl/rcl -DCMAKE_BUILD_TYPE=Release --force-cmake-configure -DCMAKE_INSTALL_PREFIX=/home/dhood/ros2_ws/src/ros2/rcl/rcl/install' failed with exit code '1'
At https://github.com/ament/ament_tools/blob/release-alpha4/ament_tools/build_types/cmake.py#L78, the value of cmake_args
is ['-DCMAKE_BUILD_TYPE=Debug', '--force-cmake-configure']
. I understand that this is the expected performance of extract_argument_group
, so maybe it's just user error on my part, but I wouldn't have expected to need to invoke
ament build_pkg . --cmake-args -DCMAKE_BUILD_TYPE=Debug -- --force-cmake-configure
with the extra delimiter
When installing ament_tools inside a python virtualenv
The python site-packages remains inside the virtenv instead of being changed to
$INSTALL_PATH/lib/python/site-packages
This results in this error, even though there is rosidl_generator_cpp in site-packages :
[ 25%] Generating C++ code for ROS interfaces
/home/mtourne/virtenv/ros2/bin/python3 /home/mtourne/test/install/lib/rosidl_generator_cpp/rosidl_generator_cpp --pkg-name builtin_msgs --ros-interface-files /home/mtourne/test/examples/builtin_msgs/msg/Duration.msg /home/mtourne/test/examples/builtin_msgs/msg/Time.msg --deps --output-dir /home/mtourne/test/build/builtin_msgs/rosidl_generator_cpp/builtin_msgs --template-dir /home/mtourne/test/install/share/rosidl_generator_cpp/resource
Traceback (most recent call last):
File "/home/mtourne/test/install/lib/rosidl_generator_cpp/rosidl_generator_cpp", line 7, in <module>
from rosidl_generator_cpp import generate_cpp
ImportError: No module named 'rosidl_generator_cpp'
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.