ros-infrastructure / catkin_pkg

Standalone Python library for the catkin build system.
https://github.com/ros/catkin
Other
47 stars 89 forks source link

Fix crash with pyparsing 3 #282

Closed rotu closed 4 years ago

rotu commented 4 years ago

pyparsing.operatorPrecedence was deprecated in pyparsing 1.5.7 and removed in pyparsing 3

https://github.com/pyparsing/pyparsing/blob/master/CHANGES

colcon build --packages-up-to rmw_cyclonedds_cpp
[8.139s] ERROR:colcon.colcon_core.package_identification:Exception in package identification extension 'ros.bazel' in '/opt/ros/master/src/osrf/osrf_pycommon': module 'pyparsing' has no attribute 'operatorPrecedence'
Traceback (most recent call last):
  File "/Users/dan/Documents/colcon_ws/src/colcon-core/colcon_core/package_identification/__init__.py", line 143, in _identify
    retval = extension.identify(_reused_descriptor_instance)
  File "/Users/dan/Documents/colcon_ws/src/colcon-ros-bazel/colcon_ros_bazel/package_identification/ros_bazel.py", line 39, in identify
    ros_extension.identify(tmp_desc)
  File "/Users/dan/Documents/colcon_ws/src/colcon-ros/colcon_ros/package_identification/ros.py", line 59, in identify
    pkg, build_type = get_package_with_build_type(str(desc.path))
  File "/Users/dan/Documents/colcon_ws/src/colcon-ros/colcon_ros/package_identification/ros.py", line 163, in get_package_with_build_type
    pkg = _get_package(path)
  File "/Users/dan/Documents/colcon_ws/src/colcon-ros/colcon_ros/package_identification/ros.py", line 195, in _get_package
    pkg.evaluate_conditions(os.environ)
  File "/usr/local/Cellar/python/HEAD-29356e0/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/catkin_pkg/package.py", line 212, in evaluate_conditions
    conditional.evaluate_condition(context)
  File "/usr/local/Cellar/python/HEAD-29356e0/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/catkin_pkg/package.py", line 369, in evaluate_condition
    self.evaluated_condition = evaluate_condition(self.condition, context)
  File "/usr/local/Cellar/python/HEAD-29356e0/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/catkin_pkg/condition.py", line 23, in evaluate_condition
    expr = _get_condition_expression()
  File "/usr/local/Cellar/python/HEAD-29356e0/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/catkin_pkg/condition.py", line 44, in _get_condition_expression
    _condition_expression = pp.operatorPrecedence(
AttributeError: module 'pyparsing' has no attribute 'operatorPrecedence'

[8.147s] ERROR:colcon.colcon_core.package_identification:Exception in package identification extension 'ros' in '/opt/ros/master/src/osrf/osrf_pycommon': module 'pyparsing' has no attribute 'operatorPrecedence'
Traceback (most recent call last):
  File "/Users/dan/Documents/colcon_ws/src/colcon-core/colcon_core/package_identification/__init__.py", line 143, in _identify
    retval = extension.identify(_reused_descriptor_instance)
  File "/Users/dan/Documents/colcon_ws/src/colcon-ros/colcon_ros/package_identification/ros.py", line 59, in identify
    pkg, build_type = get_package_with_build_type(str(desc.path))
  File "/Users/dan/Documents/colcon_ws/src/colcon-ros/colcon_ros/package_identification/ros.py", line 163, in get_package_with_build_type
    pkg = _get_package(path)
  File "/Users/dan/Documents/colcon_ws/src/colcon-ros/colcon_ros/package_identification/ros.py", line 195, in _get_package
    pkg.evaluate_conditions(os.environ)
  File "/usr/local/Cellar/python/HEAD-29356e0/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/catkin_pkg/package.py", line 212, in evaluate_conditions
    conditional.evaluate_condition(context)
  File "/usr/local/Cellar/python/HEAD-29356e0/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/catkin_pkg/package.py", line 369, in evaluate_condition
    self.evaluated_condition = evaluate_condition(self.condition, context)
  File "/usr/local/Cellar/python/HEAD-29356e0/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/catkin_pkg/condition.py", line 23, in evaluate_condition
    expr = _get_condition_expression()
  File "/usr/local/Cellar/python/HEAD-29356e0/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/catkin_pkg/condition.py", line 44, in _get_condition_expression
    _condition_expression = pp.operatorPrecedence(
AttributeError: module 'pyparsing' has no attribute 'operatorPrecedence'
rotu commented 4 years ago

Did you test 1.5.7 because it gave me an error when trying to install.

dirk-thomas commented 4 years ago

Please feel free to share the error message you gt when trying to install it.

rotu commented 4 years ago
pip3 install 'pyparsing<2' 
Collecting pyparsing<2
  Using cached pyparsing-1.5.7.tar.gz (939 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/local/opt/python/bin/python3.9 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/yl/h3w94s910h1680sqbx3v9qv80000gp/T/pip-install-njn8ibtq/pyparsing/setup.py'"'"'; __file__='"'"'/private/var/folders/yl/h3w94s910h1680sqbx3v9qv80000gp/T/pip-install-njn8ibtq/pyparsing/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/yl/h3w94s910h1680sqbx3v9qv80000gp/T/pip-install-njn8ibtq/pyparsing/pip-egg-info
         cwd: /private/var/folders/yl/h3w94s910h1680sqbx3v9qv80000gp/T/pip-install-njn8ibtq/pyparsing/
    Complete output (8 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/yl/h3w94s910h1680sqbx3v9qv80000gp/T/pip-install-njn8ibtq/pyparsing/setup.py", line 9, in <module>
        from pyparsing import __version__ as pyparsing_version
      File "/private/var/folders/yl/h3w94s910h1680sqbx3v9qv80000gp/T/pip-install-njn8ibtq/pyparsing/pyparsing.py", line 855
        except ParseBaseException, err:
                                 ^
    SyntaxError: invalid syntax
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
dirk-thomas commented 4 years ago

You are using Python 3 and the syntax in pyparsing is Python 2 specific. When using Python 2 this should work just fine.

rotu commented 4 years ago

You're right. As of right now we don't use any pyparsing features/arguments that are exclusive to version 2 or later.

dirk-thomas commented 4 years ago

@rotu FYI this caused a regression, see #287.