Bug 1750874: Support launching Mach with py instead of python r=glandium

When installing from Python.org, the `python` command isn't available by
default (in favour of `py`). Support using `py` instead.

There were issues running `hg` when `python` isn't added to the `PATH`,
so the docs are being updated accordingly.
Of course, it's still worth supporting `py`-instead-of-`python`
workflows for `git` users who won't be impacted by that bug.

Differential Revision: https://phabricator.services.mozilla.com/D136286
This commit is contained in:
Mitchell Hentges 2022-01-21 18:22:58 +00:00
parent a37e7812d4
commit 0492b82b77
3 changed files with 19 additions and 4 deletions

View file

@ -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 %*
)

View file

@ -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.

View file

@ -55,7 +55,8 @@ Download Python from the `the official website <https://www.python.org/downloads
version is 3.10.1, so a safe version to install would be the most recent 3.9 release.
You'll want to download the "Windows installer (64-bit)" associated with the release you've chosen.
During installation, ensure that you check the "Add Python 3.x to PATH" option.
During installation, ensure that you check the "Add Python 3.x to PATH" option, otherwise you might
`encounter issues running Mercurial <https://bz.mercurial-scm.org/show_bug.cgi?id=6635>`__.
.. note::