Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error building after deleting a file: can't copy '<deleted-file> doesn't exist or not a regular file #633

Open
tonynajjar opened this issue Mar 22, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@tonynajjar
Copy link

tonynajjar commented Mar 22, 2024

I noticed recently that in ament_python packages, when building with --symlink-install, if I delete a file that was symlinked in the build folder, then on the subsequent build I get the error: can't copy 'build/<deleted-file> doesn't exist or not a regular file. Maybe it has to do with #592?

to reproduce:

  • colcon build --symlink-install --packages-select package
  • Delete file that was included in the data_files of setup.py
  • colcon build --symlink-install --packages-select package
  • Get: can't copy 'build/<deleted-file> doesn't exist or not a regular file

The workaround is simply to delete the build folder and try again but it would be nice if that wasn't necessary. Maybe you could delete automatically orphaned symlinks?

@cottsay
Copy link
Member

cottsay commented Jun 7, 2024

I'm having trouble understanding exactly what the problem is here. Are you deleting the file from inside the build base or deleting the file in the package sources? Is the file still referenced in the setup.py or setup.cfg under data_files? Is data_files using a wildcard?

@cottsay cottsay self-assigned this Jun 7, 2024
@cottsay cottsay added the bug Something isn't working label Jun 7, 2024
@tonynajjar
Copy link
Author

tonynajjar commented Jun 7, 2024

On my phone currently so can't check in detail, but as far as I remember:

  • I mean deleting from the sources, e.g. from 'launch' folder
  • yes still referenced because the data files use a wildcard e.g. 'launch/*.launch.py'

Let me know if you can reproduce with that info or I need to provide you with a more concrete example

@cottsay
Copy link
Member

cottsay commented Jun 10, 2024

Alright, I see it now.

Here's the source of the error: https://github.com/pypa/setuptools/blob/f91fa3d9fc7262e0467e4b2f84fe463f8f8d23cf/setuptools/_distutils/file_util.py#L108-L110

It's pretty much the first thing that setuptools' copy function checks, and I don't see a way around it there. I think we might be able to modify the process that populates the "staged" package and explicitly remove dangling symlinks that match a data_files wildcard like this, but it might be tricky.

Either way, there will still be a dead symlink left in the install base. Same would happen with CMake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants