Don't call add_dll_directory unless directory exists
rdb opened this issue · comments
Hi there,
Our packaging tool is running into problems (panda3d/panda3d#1492) with delvewheel-based dependencies since our tool places DLL dependencies in the root folder and does not create specific shapely.libs
, scipy.libs
, etc. subdirectories, which causes an error at runtime when os.add_dll_directory
is called with a non-existent path.
We could masquerade as PyInstaller by setting sys._MEIPASS
, but I'd rather not (I am worried about other side-effects), so we'll probably work around this by creating empty scipy.libs
etc. subdirectories when a delvewheel-based wheel is detected. But it would be simpler if delvewheel simply checked whether the directory existed before calling os.add_dll_directory
.
Alternatively, could you please provide guidance for how packaging tools are supposed to handle delvewheel-based wheels?
We ended up just automatically stripping code between # start delvewheel patch
and # end delvewheel patch
lines before compilation, can we rely on these lines not changing in the future?
Support for packaging tools is a challenge because packaging tools all use different techniques, and there's no well-defined standard for how they operate. I think it makes sense for the majority of the handling to be done within packaging tool. Anything done within delvewheel
to assist a packaging tool would be on a best-effort basis only. I have submitted 359eebc.
As for the # start delvewheel patch
and # end delvewheel patch
lines, I see no reason to change them in the near future. However, I'm also not willing to promise to keep them the same if a good reason to change them arises in the next few years.