matthew-brett / delocate

Find and copy needed dynamic libraries into python wheels
BSD 2-Clause "Simplified" License
262 stars 59 forks source link

delocate-wheel exits 'succesfully' after encountering potential errors. #90

Closed HexDecimal closed 2 years ago

HexDecimal commented 3 years ago

I've recently ran into a problem where updating a dependency I was using added another dependency which failed to be included by delocate-wheel. Because delocate-wheel doesn't exit with an error code on warnings I didn't find out there was an issue until sometime later. Example output:

delocate-wheel -v dist/*.whl
/Users/runner/work/python-tcod/python-tcod/venv/lib/python3.7/site-packages/delocate/libsana.py:111: UserWarning: Couldn't find @rpath/hidapi.framework/Versions/A/hidapi on paths:
Fixing: dist/tcod-11.19.1-cp35-abi3-macosx_10_9_x86_64.whl
    /Users/runner/work/python-tcod/python-tcod/@executable_path/Frameworks
Copied to package .dylibs directory:
    /Users/runner/work/python-tcod/python-tcod/@loader_path/Frameworks
  '\n\t'.join(realpath(path) for path in rpaths),
  /Users/runner/work/python-tcod/python-tcod/dependencies/SDL2-2.0.14/SDL2.framework/Versions/A/SDL2
/Users/runner/work/python-tcod/python-tcod/venv/lib/python3.7/site-packages/delocate/libsana.py:111: UserWarning: Couldn't find @rpath/hidapi.framework/Versions/A/hidapi on paths:
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
    /Users/runner/work/python-tcod/python-tcod/@executable_path/Frameworks
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices
    /Users/runner/work/python-tcod/python-tcod/@loader_path/Frameworks
/System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox
  '\n\t'.join(realpath(path) for path in rpaths),

I'd like to suggest a command line argument to determine if warnings like these return an error code instead of passing silently in scripts, or maybe even change the default behavior of when libraries aren't found to return an error by default with an option to allow the behavior.

I think I could implement this myself if you decide what the policy should be.

matthew-brett commented 3 years ago

Honestly I'd be happy either way - but perhaps a not-default flag to cause errors would be better for back-compatibility. Please go give it a go if you can.