colcon / colcon-python-setup-py

Extension for colcon to support Python packages with the metadata in the setup.py file
http://colcon.readthedocs.io
Apache License 2.0
2 stars 7 forks source link

paths incorrect after colcon-core 0.5.0 backwards-incompatible changes #29

Closed AAlon closed 4 years ago

AAlon commented 4 years ago

Hey, since using 0.5.0 our builds break with:

colcon build --build-base build --install-base install
[0.649s] ERROR:colcon.colcon_core.package_identification:Exception in package identification extension 'python_setup_py' in 'src/sagemaker_rl_agent': [Errno 2] No such file or directory: 'src/sagemaker_rl_agent/setup.py'
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/colcon_core/package_identification/__init__.py", line 143, in _identify
    retval = extension.identify(_reused_descriptor_instance)
  File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 46, in identify
    kwargs = get_setup_arguments(setup_py)
  File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 111, in get_setup_arguments
    runpy.run_path(str(setup_py))
  File "/usr/lib/python3.6/runpy.py", line 261, in run_path
    code, fname = _get_code_from_file(run_name, path_name)
  File "/usr/lib/python3.6/runpy.py", line 231, in _get_code_from_file
    with open(fname, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'src/sagemaker_rl_agent/setup.py'

0.4.5 vs. 0.5.0 shows some differences in path resolution: https://github.com/colcon/colcon-core/compare/0.4.5...0.5.0 The structure of the affected workspace can be seen here: https://github.com/aws-robotics/aws-robomaker-sample-application-objecttracker/tree/ros1/simulation_ws Also here: https://github.com/aws-robotics/aws-robomaker-sample-application-deepracer/tree/ros1/simulation_ws

@dirk-thomas We'd appreciate your help advising on the best course of action. If this is a backwards-incompatible change please consider releasing a hotfix that'll make it compatible again.

AAlon commented 4 years ago

Looks like it's due to passing in path instead of realpath here: https://github.com/colcon/colcon-core/blob/master/colcon_core/package_discovery/path.py#L64 - I don't have all the context so I'm not sure if this was intentional or not.

dirk-thomas commented 4 years ago

I don't have all the context so I'm not sure if this was intentional or not.

That change was part of colcon/colcon-core#283 and also colcon/colcon-recursive-crawl#16.

dirk-thomas commented 4 years ago

colcon/colcon-python-setup-py#28 should fix the problematic code in that extension which changes the cwd before interpreting the paths (which can now be relative and where resolved realpaths before).

dirk-thomas commented 4 years ago

Thank you for the quick report and I am sorry for the inconvenience.