premake-core icon indicating copy to clipboard operation
premake-core copied to clipboard

How can I find proper python paths?

Open GasimGasimzada opened this issue 2 years ago • 6 comments

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.

GasimGasimzada avatar Mar 26 '22 08:03 GasimGasimzada

Have you tried os.findheader?

nickclark2016 avatar Mar 26 '22 19:03 nickclark2016

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.

GasimGasimzada avatar Mar 27 '22 08:03 GasimGasimzada

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.

samsinsane avatar Apr 08 '22 11:04 samsinsane

About python (and most lib), notice there are several versions. How about os.findheader('python3.8/Python.h')?

Jarod42 avatar Apr 15 '22 23:04 Jarod42

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?

samsinsane avatar Apr 16 '22 14:04 samsinsane

I don't know.

Jarod42 avatar Apr 18 '22 13:04 Jarod42