Coder Social home page Coder Social logo

ament_package's People

Contributors

audrow avatar clalancette avatar cottsay avatar dirk-thomas avatar dlu avatar esteve avatar gerkey avatar isabelparedes avatar jacobperron avatar mabelzhang avatar mikaelarguedas avatar mjcarroll avatar nuclearsandwich avatar otamachan avatar paudrow avatar sloretz avatar tfoote avatar wjwwood avatar yadunund avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ament_package's Issues

LD_LIBRARY_PATH support for packages using gnuinstalldirs

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.

if [ $_IS_DARWIN -eq 0 ]; then
ament_prepend_unique_value LD_LIBRARY_PATH "$AMENT_CURRENT_PREFIX/lib"
else
ament_prepend_unique_value DYLD_LIBRARY_PATH "$AMENT_CURRENT_PREFIX/lib"

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.

`.dsv` files are not processed unless there is `.sh` file with the same base name

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

if ext in (primary_extension, additional_extension):
only processes files with primary_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)

setup.bash fails

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

New test failure in ament_package

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

the INCLUDE_DIRS generated by ament_package are duplicated

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]]

local_setup.bat fails if PYTHON_EXECUTABLE contains parentheses

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"
...

prefix level never got the AMENT_PYTHON_EXECUTABLE fixes

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.

Environment setup can collide when .dsv files and scripts change the same env var

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).

add a way to skip building packages conditionally

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.

I can't build ros2 with the latest code of master branch

I 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.

Several lines from _local_setup_util_sh.py contain this: E501 line too long

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.

Support powershell

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.

ImportError: 'from ament_package import parse_package_string' failed: No module named 'ament_package'

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

use PATH to find for python in Windows

I noticed that in

set "ament_python_executable=@PYTHON_EXECUTABLE@"
, 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.

what error

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

Eloquent patch release

I propose to sync the eloquent branch with master which will backport #106, #107, and #108 and then release 0.8.6 into Eloquent (also --ff-only that release to the master branch). That will allow both branches to stay in sync.

Issue while building ROS2 package

Hello,
I am trying to write my own package in ROS2. while building I got errors related to ament_package.
please refer to the below screenshot and let me know what needs to be done or If I am doing any mistake.

Thank you.

image

ament build fails

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?

Setup file (at least for zsh) fails when no ament packages were in workspace

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.

Not enforcing ROS name convention when building NON-ROS packages

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.

Error reporting for invalid package.xml is unhelpful

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'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.