gecko-dev/mach.ps1
Mitchell Hentges 92a19e0eb9 Bug 1740123: Allow invoking Mach outside of MozillaBuild r=glandium
Assuming that the `MOZILLABUILD` environment variable is set, allow
invoking Mach from non-MozillaBuild terminals.

Note that MozillaBuild still needs to be installed, and the
`MOZILLABUILD` environment variable will have to be set.

For future reference: when I tried setting this up with Windows
Store's Python 3.9, I encountered issues when running binaries installed
via `pip`: it would fail with `abort: failed to load Python DLL
python3x.dll`.

Differential Revision: https://phabricator.services.mozilla.com/D133936
2022-01-06 06:49:47 +00:00

35 lines
833 B
PowerShell

$mypath = $MyInvocation.MyCommand.Path
$machpath = ($mypath -replace '\\', '/').substring(0, $mypath.length - 4)
if (-not (test-path env:MACH_PS1_USE_MOZILLABUILD)) {
python $machpath $args
exit $lastexitcode
}
if (-not (test-path env:MOZILLABUILD)) {
echo "No MOZILLABUILD environment variable found, terminating."
exit 1
}
if ($machpath.contains(' ')) {
echo @'
The repository path contains whitespace which currently isn't supported in mach.ps1.
Please run MozillaBuild manually for now.
'@
exit 1
}
for ($i = 0; $i -lt $args.length; $i++) {
$arg = $args[$i]
if ($arg.contains(' ')) {
echo @'
The command contains whitespace which currently isn't supported in mach.ps1.
Please run MozillaBuild manually for now.
'@
exit 1
}
}
& "$env:MOZILLABUILD/start-shell.bat" $machpath $args
exit $lastexitcode