Bug 1860189 - Handle virtualenv paths correctly when installing requirements. r=aglav...
[gecko.git] / mach.ps1
blob51f66aeed8eb86f7f431445d5d5ceec9409c0043
1 $mypath = $MyInvocation.MyCommand.Path
2 $machpath = $mypath.substring(0, $mypath.length - 4)
4 if (Get-Command py -ErrorAction SilentlyContinue) {
5 $python_executable = "py"
6 } else {
7 $python_executable = "python"
10 if (-not (test-path env:MACH_PS1_USE_MOZILLABUILD)) {
11 &$python_executable $machpath $args
12 exit $lastexitcode
15 if (-not (test-path env:MOZILLABUILD)) {
16 echo "No MOZILLABUILD environment variable found, terminating."
17 exit 1
20 $machpath = ($machpath -replace '\\', '/')
22 if ($machpath.contains(' ')) {
23 echo @'
24 The repository path contains whitespace which currently isn't supported in mach.ps1.
25 Please run MozillaBuild manually for now.
27 exit 1
30 for ($i = 0; $i -lt $args.length; $i++) {
31 $arg = $args[$i]
32 if ($arg.contains(' ')) {
33 echo @'
34 The command contains whitespace which currently isn't supported in mach.ps1.
35 Please run MozillaBuild manually for now.
37 exit 1
41 $mozillabuild_version = Get-Content "$env:MOZILLABUILD\VERSION"
42 # Remove "preX" postfix if the current MozillaBuild is a prerelease.
43 $mozillabuild_version = [decimal]($mozillabuild_version -replace "pre.*")
45 if ($mozillabuild_version -ge 4.0) {
46 & "$env:MOZILLABUILD/start-shell.bat" -no-start -defterm -c "$machpath $args"
47 } else {
48 & "$env:MOZILLABUILD/start-shell.bat" $machpath $args
50 exit $lastexitcode