ziggy-pydust icon indicating copy to clipboard operation
ziggy-pydust copied to clipboard

buildzig.py's sysconfig.get_config_var("LDLIBRARY") fails on Windows

Open shakfu opened this issue 2 years ago • 6 comments
trafficstars

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

shakfu avatar Oct 05 '23 06:10 shakfu

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'

shakfu avatar Oct 05 '23 20:10 shakfu

import sysconfig; print(sysconfig.get_config_var('LIBDIR'), end='') will also return None on windows.

isFakeAccount avatar Feb 25 '24 00:02 isFakeAccount

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")

isFakeAccount avatar Feb 29 '24 06:02 isFakeAccount

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?

gatesn avatar Feb 29 '24 09:02 gatesn

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.

isFakeAccount avatar Mar 01 '24 04:03 isFakeAccount