Closed Mandera closed 1 year ago
I should only return non-venv pythons
Ok so issue is that I'm assuming all python executables end with 3.8 for examples. I should try calling --version on every python file to see if they are python distributions. Should I do this for windows too? A bit worried about launching random exe files but this could be a solution. Maybe I can take a closer look at how py works for windows? https://stackoverflow.com/questions/50896496/what-is-the-difference-between-py-and-python-in-the-windows-terminal
Got this on linux now with whereis python: "python: /usr/bin/python /opt/hostedtoolcache/Python/3.8.16/x64/bin/python /opt/hostedtoolcache/Python/3.8.16/x64/python /usr/share/man/man1/python.1.gz" Maybe ill just try that approach, calling is_file and then --version on these
Hmm even though Terminal had error=False it raised an OSError
Maybe I'll throw in a regex too. First I'll check out why error wasn't suppressed
When Venv() is called and there is an active venv it becomes that one. If there is no active venv it will become a non-existant Venv with cwd as path.
I don't really like this. I should make a specific class method to get active venv. Venv() should only be to get Venv with cwd.
list_python_versions is not yielding any paths on linux, I'll try to debug. I dislike having to trigger the matrix everytime I'm testing it though, there's definitely a better/faster way. Not sure it's worth the time to find right now
Regex now working, on to the next issue which was that Linux uses colon as PATH delimiter, not semi-colon like Windows.
https://github.com/ManderaGeneral/generalpackager/commit/3b657dd58a431274e23b3855c08f39cbb3b780a2
Slowly getting there. Had issue where I didn't remove env var VIRTUAL_ENV. Also had to remove .exe on linux for python. Seems to work now!! https://github.com/ManderaGeneral/generalpackager/commit/3a3745f31575ccd36bd649bb1ffdfed19435939b
Run: https://github.com/ManderaGeneral/generalpackager/actions/runs/4030507328/jobs/6929215543
Here's a good thread for linux: https://stackoverflow.com/questions/30464980/how-to-check-all-versions-of-python-installed-on-osx-and-centos
Examples with
Terminal("ls", "-1", "/usr/bin/python*", "|", "grep", "-P", "'.*\d\.\d+$'").string_result
And the one for windows: https://stackoverflow.com/questions/53312590/how-can-i-check-all-the-installed-python-versions-on-windows
Examples with
Terminal("py", "--list-paths").string_result