awslabs / ros2-migration-tools

Tools for migrating packages from ROS1 to ROS2.
Apache License 2.0
182 stars 20 forks source link

Migration of avt_vimba_camera-0.0.11 #7

Open b4795 opened 4 years ago

b4795 commented 4 years ago

Hello,

When I try to migrate avt_vimba_camera-0.0.11 (https://github.com/astuff/avt_vimba_camera/releases/tag/0.0.11) I get the following:

Migration started...

Converting cmake files...Traceback (most recent call last):
  File "ros_upgrader.py", line 493, in <module>
    main()
  File "ros_upgrader.py", line 487, in main
    RosUpgrader.start_upgrade()
  File "ros_upgrader.py", line 422, in start_upgrade
    RosUpgrader.convert_all_cmake()
  File "ros_upgrader.py", line 179, in convert_all_cmake
    ported_content = CMakeListsPorter.port(content=src_file)
  File "/home/normal/src/ros2-migration-tools/porting_tools/cmake_lists_porter.py", line 64, in port
    cmake = cmkp.parse(content)
  File "/home/normal/.local/lib/python3.6/site-packages/parse_cmake/parsing.py", line 104, in parse
    nums_items = list(parse_file(nums_toks))
  File "/home/normal/.local/lib/python3.6/site-packages/parse_cmake/parsing.py", line 212, in parse_file
    line_nums, cmd = parse_command(line_num, tok_contents, toks)
  File "/home/normal/.local/lib/python3.6/site-packages/parse_cmake/parsing.py", line 252, in parse_command
    cmd.comments.append(c)
AttributeError: 'Command' object has no attribute 'comments'

Are you able to reproduce this issue? Could you provide a solution?

Thank you very much in advance.

Best regards. Adriano Carvalho

raghaprasad commented 4 years ago

Hi @b4795 , this seems like an issue with one of the packages we depend on. We have tested this repo only ubuntu xenial based docker containers. Can you specify what your build environment looks like?

b4795 commented 4 years ago

I am using Ubuntu 18.04.

thachdo commented 3 years ago

@b4795, I met the same problem. Did you solve it? or can you please recommend to me a good way to migrate to ros2?

b4795 commented 3 years ago

No, sorry. But now that I look into it the error happens here:

https://github.com/wjwwood/parse_cmake/blob/51daaefdfd68ee805bc5380f68ae88a32ef72a72/parse_cmake/parsing.py#L252

And it seems that there's a bug here:

https://github.com/wjwwood/parse_cmake/blob/51daaefdfd68ee805bc5380f68ae88a32ef72a72/parse_cmake/parsing.py#L236

Where we read "comment=None" it should be "comment=[]". My guess.

This bug probably doesn't exist on older versions of parse_cmake.

I see two options here: (1) fix the bug yourself; (2) downgrade parse_cmake to an older version.

guanyewtan commented 3 years ago

In this line: https://github.com/wjwwood/parse_cmake/blob/51daaefdfd68ee805bc5380f68ae88a32ef72a72/parse_cmake/parsing.py#L252

I changed cmd.comments.append(c) to cmd.comment.append(c) (basically changed comments to comment) and it worked! Not sure if it messed up anything else though.

dlee640 commented 3 years ago

@guanyewtan For me your solution returned different error. Seems like comment isn't even a defined type under Command object.

slambox@slambox-NUC10i7FNH:~/ros2-migration-tools$ python3 ros_upgrader.py -c ~/ros2_unitree_ws/build/a1_description/compile_commands.json -p ~/ros2_unitree_ws/src/unitree_ros/robots/a1_description/package.xml

Migration started...

Converting cmake files...Traceback (most recent call last):
  File "ros_upgrader.py", line 493, in <module>
    main()
  File "ros_upgrader.py", line 487, in main
    RosUpgrader.start_upgrade()
  File "ros_upgrader.py", line 422, in start_upgrade
    RosUpgrader.convert_all_cmake()
  File "ros_upgrader.py", line 179, in convert_all_cmake
    ported_content = CMakeListsPorter.port(content=src_file)
  File "/home/slambox/ros2-migration-tools/porting_tools/cmake_lists_porter.py", line 64, in port
    cmake = cmkp.parse(content)
  File "/home/slambox/.local/lib/python3.8/site-packages/parse_cmake/parsing.py", line 104, in parse
    nums_items = list(parse_file(nums_toks))
  File "/home/slambox/.local/lib/python3.8/site-packages/parse_cmake/parsing.py", line 212, in parse_file
    line_nums, cmd = parse_command(line_num, tok_contents, toks)
  File "/home/slambox/.local/lib/python3.8/site-packages/parse_cmake/parsing.py", line 252, in parse_command
    cmd.comment.append(c)
AttributeError: 'NoneType' object has no attribute 'append'
dlee640 commented 3 years ago

I have been having the same issue here. Can you provide us which is the correct version of parse_cmake should we be using? The issue seems to exist with version 0.4.1.

Update: Just downgraded my parse_cmake to 0.4.0 and retried. It has the same error. It seems like 0.4.0 and 0.4.1 are the two only versions that are offered by pip, so I am not sure how you guys were able to get this working without the error.