premake-core
premake-core copied to clipboard
How can I find proper python paths?
What's your question?
Is there a function for finding python include and library directories in ALL platforms? I was able to figure out the library path using os.findlib
but I cannot get include directories in any OS.
Have you tried os.findheader
?
Yeah, I tried os.findheader('Python.h')
but it returns nil
. When I added python directory as a path though, os.findheader('Python.h', { '/usr/include/python3.8' });
, I got the value but that kills the entire purpose of why I wanted to use os.findheader
in the first place.
It looks like os.findheader
doesn't go into subfolders, it only checks the root of /include
, /usr/include
and /usr/local/include
for the header. Not sure if that's by design or just an oversight, but I'm sure a PR to make it recursive would be welcome.
About python (and most lib), notice there are several versions.
How about os.findheader('python3.8/Python.h')
?
About python (and most lib), notice there are several versions. How about
os.findheader('python3.8/Python.h')
?
I hadn't considered the machine having multiple versions installed, that's a good point. In the cases where there's only a single version installed and it doesn't matter which version is installed, wouldn't it make sense to return the location of the header regardless of version?
I don't know.