pygobject / pycairo

Python bindings for cairo
https://pycairo.readthedocs.io
Other
613 stars 83 forks source link

Windows: fix DLL not found error in Python 3.8+ #277

Closed danyeaw closed 1 year ago

danyeaw commented 1 year ago

This upstreams a patch from gvsbuild. In Python 3.8, a new os.add_dll_directory method was added to make loading DLLs in Windows more consistent. The impact of this is that even if I compile GTK successfully with MSVC, and add it to the Path, INCLUDE, and LIB, I am still not able to pip install pycairo in Windows and having a working application. This finds the first GTK DLL location from the Windows PATH variable.

naveen521kk commented 1 year ago

Looks the same as https://github.com/pygobject/pycairo/pull/248 and it was decided not to do so...

danyeaw commented 1 year ago

@naveen521kk Yup, I think you are right, it is fixing the same thing - thanks for pointing that out. I don't understand the comments from the previous PR to be honest. Applications shouldn't have to do a bunch of add_dll magic to use pycairo in Windows.

danyeaw commented 1 year ago

I looked at this more, and I think only PyGObject needs to still be patched. It looks like pycairo is working great. I will remove the patch out of gvsbuild 👍