diff --git a/mach.cmd b/mach.cmd index 1d439effe3b037..7c7c6f74ae8f8d 100644 --- a/mach.cmd +++ b/mach.cmd @@ -1,3 +1,9 @@ @ECHO OFF SET topsrcdir=%~dp0 -python %topsrcdir%mach %* + +WHERE /q py +IF %ERRORLEVEL% EQU 0 ( + py %topsrcdir%mach %* +) ELSE ( + python %topsrcdir%mach %* +) diff --git a/mach.ps1 b/mach.ps1 index deec8a18322d4d..9fec76dc2b9a8a 100644 --- a/mach.ps1 +++ b/mach.ps1 @@ -1,8 +1,14 @@ $mypath = $MyInvocation.MyCommand.Path -$machpath = ($mypath -replace '\\', '/').substring(0, $mypath.length - 4) +$machpath = $mypath.substring(0, $mypath.length - 4) + +if (Get-Command py) { + $python_executable = "py" +} else { + $python_executable = "python" +} if (-not (test-path env:MACH_PS1_USE_MOZILLABUILD)) { - python $machpath $args + &$python_executable $machpath $args exit $lastexitcode } @@ -11,6 +17,8 @@ if (-not (test-path env:MOZILLABUILD)) { exit 1 } +$machpath = ($machpath -replace '\\', '/') + if ($machpath.contains(' ')) { echo @' The repository path contains whitespace which currently isn't supported in mach.ps1. diff --git a/python/mach/docs/windows-usage-outside-mozillabuild.rst b/python/mach/docs/windows-usage-outside-mozillabuild.rst index 5dfa860aec677b..95d941a1d25788 100644 --- a/python/mach/docs/windows-usage-outside-mozillabuild.rst +++ b/python/mach/docs/windows-usage-outside-mozillabuild.rst @@ -55,7 +55,8 @@ Download Python from the `the official website `__. .. note::