| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent cedad02 commit 8980d8c
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,27 +3,6 @@ | |||
| 3 | 3 | echo Looking for Python | |
| 4 | 4 | setlocal enabledelayedexpansion | |
| 5 | 5 | ||
| 6 | - :: To remove the preference for Python 2, but still support it, just remove | ||
| 7 | - :: the 5 blocks marked with "Python 2:" and the support warnings | ||
| 8 | - | ||
| 9 | - :: Python 2: If python.exe is in %Path%, use if it's Python 2 | ||
| 10 | - FOR /F "delims=" %%a IN ('where python.exe 2^> NUL') DO ( | ||
| 11 | - SET need_path=0 | ||
| 12 | - SET p=%%~dpa | ||
| 13 | - CALL :validate-v2 | ||
| 14 | - IF NOT ERRORLEVEL 1 GOTO :found-python2 | ||
| 15 | - GOTO :done-path-v2 | ||
| 16 | - ) | ||
| 17 | - :done-path-v2 | ||
| 18 | - | ||
| 19 | - :: Python 2: Query the 3 locations mentioned in PEP 514 for a python2 InstallPath | ||
| 20 | - FOR %%K IN ( "HKCU\Software", "HKLM\SOFTWARE", "HKLM\Software\Wow6432Node") DO ( | ||
| 21 | - SET need_path=1 | ||
| 22 | - CALL :find-versions-v2 %%K | ||
| 23 | - IF NOT ERRORLEVEL 1 CALL :validate-v2 | ||
| 24 | - IF NOT ERRORLEVEL 1 GOTO :found-python2 | ||
| 25 | - ) | ||
| 26 | - | ||
| 27 | 6 | :: Use python.exe if in %PATH% | |
| 28 | 7 | set need_path=0 | |
| 29 | 8 | for /f "delims=" %%a in ('where python.exe 2^> nul') do ( | |
@@ -41,14 +20,6 @@ for %%k in ( "HKCU\Software", "HKLM\SOFTWARE", "HKLM\Software\Wow6432Node") do ( | |||
| 41 | 20 | goto :no-python | |
| 42 | 21 | ||
| 43 | 22 | ||
| 44 | - :: Python 2: Find Python 2 installations in a registry location | ||
| 45 | - :find-versions-v2 | ||
| 46 | - for /f "delims=" %%a in ('reg query "%~1\Python\PythonCore" /f * /k 2^> nul ^| findstr /r ^^HK ^| findstr "\\2\."') do ( | ||
| 47 | - call :read-installpath %%a | ||
| 48 | - if not errorlevel 1 exit /b 0 | ||
| 49 | - ) | ||
| 50 | - exit /b 1 | ||
| 51 | - | ||
| 52 | 23 | :: Find Python installations in a registry location | |
| 53 | 24 | :find-versions | |
| 54 | 25 | for /f "delims=" %%a in ('reg query "%~1\Python\PythonCore" /f * /k 2^> nul ^| findstr /r ^^HK') do ( | |
@@ -73,32 +44,11 @@ for /f "skip=2 tokens=1* delims=)" %%a in ('reg query "%1\InstallPath" /ve /t RE | |||
| 73 | 44 | ) | |
| 74 | 45 | exit /b 1 | |
| 75 | 46 | ||
| 76 | - | ||
| 77 | - :: Python 2: Check if %p% holds a path to a real python2 executable | ||
| 78 | - :validate-v2 | ||
| 79 | - IF NOT EXIST "%p%\python.exe" EXIT /B 1 | ||
| 80 | - :: Check if %p% is python2 | ||
| 81 | - "%p%\python.exe" -V 2>&1 | findstr /R "^Python.2.*" > NUL | ||
| 82 | - EXIT /B %ERRORLEVEL% | ||
| 83 | - | ||
| 84 | - | ||
| 85 | - :: Python 2: | ||
| 86 | - :found-python2 | ||
| 87 | - echo Python 2 found in %p%\python.exe | ||
| 88 | - set pyver=2 | ||
| 89 | - goto :done | ||
| 90 | - | ||
| 91 | 47 | :found-python | |
| 92 | 48 | echo Python found in %p%\python.exe | |
| 93 | - echo WARNING: Python 3 is not yet fully supported, to avoid issues Python 2 should be installed. | ||
| 94 | - set pyver=3 | ||
| 95 | - goto :done | ||
| 96 | - | ||
| 97 | - :done | ||
| 98 | 49 | endlocal ^ | |
| 99 | 50 | & set "pt=%p%" ^ | |
| 100 | - & set "need_path_ext=%need_path%" ^ | ||
| 101 | - & set "VCBUILD_PYTHON_VERSION=%pyver%" | ||
| 51 | + & set "need_path_ext=%need_path%" | ||
| 102 | 52 | set "VCBUILD_PYTHON_LOCATION=%pt%\python.exe" | |
| 103 | 53 | if %need_path_ext%==1 set "PATH=%pt%;%PATH%" | |
| 104 | 54 | set "pt=" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -688,9 +688,6 @@ goto exit | |||
| 688 | 688 | ||
| 689 | 689 | :create-msvs-files-failed | |
| 690 | 690 | echo Failed to create vc project files. | |
| 691 | - if %VCBUILD_PYTHON_VERSION%==3 ( | ||
| 692 | - echo Python 3 is not yet fully supported, to avoid issues Python 2 should be installed. | ||
| 693 | - ) | ||
| 694 | 691 | del .used_configure_flags | |
| 695 | 692 | goto exit | |
| 696 | 693 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments