Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

fix search for python 3 #1608

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Conversation

diablodale
Copy link

Fixes #1583

Description of the changes:

  • method-wide check for python3 on path and available to execute

Before submitting a Pull Request:

I tested changes on:

  • Windows
  • Linux

via projects automated test scripts. And used in my my project.

@jaygullapalli
Copy link
Contributor

This check was created to support traditional python installer from https://www.python.org/downloads/ (assuming installation path is added to the path). The script is doing the right thing. (Python from the traditional installer does not have a suffix, it is just python.exe)

e.g.
image

@diablodale
Copy link
Author

That is false. searching for python3 is the right approach.
I challenge you to provide a full directory listing of your python install location.

I just now downloaded python3.9.5 from https://www.python.org/downloads/ and installed it to c:\Python39
Here is the directory listing

05/28/2021  01:44 PM    <DIR>          .
05/28/2021  01:44 PM    <DIR>          ..
05/28/2021  01:44 PM    <DIR>          DLLs
05/28/2021  01:44 PM    <DIR>          Doc
05/28/2021  01:44 PM    <DIR>          include
05/28/2021  01:44 PM    <DIR>          Lib
05/28/2021  01:44 PM    <DIR>          libs
05/03/2021  05:35 PM            32,628 LICENSE.txt
05/03/2021  05:37 PM         1,062,280 NEWS.txt
05/03/2021  05:35 PM           101,552 python.exe
05/03/2021  05:35 PM            59,568 python3.dll
05/03/2021  05:35 PM         4,462,768 python39.dll
05/03/2021  05:35 PM           100,016 pythonw.exe
05/28/2021  01:44 PM    <DIR>          Scripts
05/28/2021  01:44 PM    <DIR>          tcl
05/28/2021  01:44 PM    <DIR>          Tools
05/03/2021  05:35 PM            96,120 vcruntime140.dll
05/03/2021  05:35 PM            36,728 vcruntime140_1.dll
               8 File(s)      5,951,660 bytes
              10 Dir(s)  552,720,588,800 bytes free

python3 is there, and waiting to be used in the script's search.

@diablodale
Copy link
Author

Found more info. I think we are both errant, but can likely fix that.

Python and python3 app exec aliases were added to Windows 10 1903 "...every install of Windows will include python and python3 commands that take you directly to the Python store page." https://devblogs.microsoft.com/python/python-in-the-windows-10-may-2019-update/

Above means that these Win 1903 app exec aliases can easily have path priority over any other install of python. And therefore encounter the bug my fix addresses. The buggy method will find the 0 byte exe alias and fail.

https://docs.python.org/3/using/windows.html provides many install methods. So many, that its likely not worth investigating them all. Instead, to take an approach like cmake --> look on path and frequently used install locations, for known exe's.

  • python.org download 3.1.4 doesn't have python3.exe.
  • python.org download 3.8.0 doesn't have python3.exe. Yet, the 3.8 package from Windows Store does have python3.exe. Therefore, the existence of python3 isn't consistent across Windows install methods.
  • python.org download 3.9.0 doesn't have python3.exe.

python.org download added python3.exe sometime between 3.9.0 and 3.9.5

I recommend the script then

  1. check first for python3.exe. This will work for the app exe aliases added in Windows 1903, and python.org downloads 3.9ish and later
  2. Fallback to check for python.exe and examine its version stamp.

How about that approach?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

scripts/verify-windows.ps1 fails to find installed python3
2 participants