Improve error for missing Python (#81202)

* add error

* Fix a case were missing VC components didn't error

* handle non empty stdout

* Remove self assignment
This commit is contained in:
Dan Moseley 2023-01-26 17:44:46 -07:00 коммит произвёл GitHub
Родитель 8ba2ad4f46
Коммит d021235cde
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 11 добавлений и 11 удалений

Просмотреть файл

@ -61,6 +61,7 @@ exit /b 1
if "%__VCBuildArch%"=="" exit /b 0
:: Set the environment for the native build
if not exist "%VCINSTALLDIR%Auxiliary\Build\vcvarsall.bat" goto :VSMissing
call "%VCINSTALLDIR%Auxiliary\Build\vcvarsall.bat" %__VCBuildArch%
if not "%ErrorLevel%"=="0" exit /b 1

Просмотреть файл

@ -1,5 +1,5 @@
<Project>
<Target Name="FindPythonWindows"
<Target Name="_FindPythonWindows"
Condition="$([MSBuild]::IsOSPlatform(Windows)) and '$(PYTHON)' == ''"
Returns="$(PYTHON)">
<PropertyGroup>
@ -8,25 +8,24 @@
<Exec Command="py -3 $(_PythonLocationScript) 2&gt; nul || python3 $(_PythonLocationScript) 2&gt; nul || python $(_PythonLocationScript) 2&gt; nul"
StandardOutputImportance="Low"
EchoOff="true"
ContinueOnError="ErrorAndContinue"
ConsoleToMsBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="PYTHON" />
</Exec>
<PropertyGroup>
<PYTHON>"$(PYTHON)"</PYTHON>
</PropertyGroup>
</Target>
<Target Name="FindPythonUnix"
<Target Name="_FindPythonUnix"
Condition="!$([MSBuild]::IsOSPlatform(Windows)) and '$(PYTHON)' == ''"
Returns="$(PYTHON)">
<Exec Command="command -v python3 || command -v python || command -v py"
StandardOutputImportance="Low"
EchoOff="true"
ContinueOnError="ErrorAndContinue"
ConsoleToMsBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="PYTHON" />
</Exec>
<PropertyGroup>
<PYTHON>"$(PYTHON)"</PYTHON>
</PropertyGroup>
</Target>
<Target Name="FindPython" DependsOnTargets="FindPythonWindows;FindPythonUnix" />
<Target Name="FindPython" DependsOnTargets="_FindPythonWindows;_FindPythonUnix">
<Error Condition="'$(PYTHON)' == ''"
Text="Python not found. Please add Python 3 to your path and try again."/>
</Target>
</Project>

Просмотреть файл

@ -337,7 +337,7 @@
</PropertyGroup>
<Exec Command="$(PYTHON) -B $(_PythonWarningParameter) &quot;@(EventingGenerationScript)&quot; --man &quot;@(EventManifestFile)&quot; --intermediate &quot;$(_EventingSourceFileDirectory)&quot;" />
<Exec Command="&quot;$(PYTHON)&quot; -B $(_PythonWarningParameter) &quot;@(EventingGenerationScript)&quot; --man &quot;@(EventManifestFile)&quot; --intermediate &quot;$(_EventingSourceFileDirectory)&quot;" />
<ItemGroup>
<FileWrites Include="@(EventingSourceFile)" />

Просмотреть файл

@ -341,7 +341,7 @@
<_EventingSourceFileDirectory Condition="HasTrailingSlash('$(_EventingSourceFileDirectory)')">$(_EventingSourceFileDirectory.TrimEnd('\'))</_EventingSourceFileDirectory>
</PropertyGroup>
<Exec Command="$(PYTHON) -B $(_PythonWarningParameter) &quot;@(EventingGenerationScript)&quot; --man &quot;@(EventManifestFile)&quot; --intermediate &quot;$(_EventingSourceFileDirectory)&quot; --runtimeflavor mono" />
<Exec Command="&quot;$(PYTHON)&quot; -B $(_PythonWarningParameter) &quot;@(EventingGenerationScript)&quot; --man &quot;@(EventManifestFile)&quot; --intermediate &quot;$(_EventingSourceFileDirectory)&quot; --runtimeflavor mono" />
<ItemGroup>
<FileWrites Include="@(EventingSourceFile)" />