ziggy-pydust
ziggy-pydust copied to clipboard
buildzig.py's sysconfig.get_config_var("LDLIBRARY") fails on Windows
FYI,
I just happened to be testing pydust on a windows on a windows11 machine and sysconfig.get_config_var("LDLIBRARY") returns None even if Python3.11 is installed in the standard system-wide location: C:\Program Files\Python3.11
As per this stack overflow post the windows equivalent is os.path.join(sys.prefix, "libs") which on my windows machine gives:
>>> os.path.join(sys.prefix, "libs")
'C:\\Program Files\\Python311\\libs'
import sysconfig; print(sysconfig.get_config_var('LIBDIR'), end='') will also return None on windows.
os.path.join(sys.prefix, "libs") won't work if venv is active. sys.prefix returns venv path which does not contain libs directory.
I would recommend return os.path.join(get_config_var("installed_base"), "libs")
I suspect we can borrow a lot from how Maturin locates these directories? Although it looks like it has a big directory full of somewhat hard-coded sysconfigs?
I suspect we can borrow a lot from how Maturin locates these directories? Although it looks like it has a big directory full of somewhat hard-coded sysconfigs?
I assume you are talking about this https://github.com/PyO3/maturin/tree/main/sysconfig
which is most likely generated using this
https://github.com/python/cpython/blob/339c8e1c13adc299a0e2e49c93067e7817692380/Lib/sysconfig/init.py#L27
and you can see that they are using installed_base to setup a lot of paths. Not sure exactly why maturin hardcoded everything. Hardcoding also means increasing the package size unnecessarily.