55$MINICONDA_URL = " http://repo.continuum.io/miniconda/"
66
77
8- function DownloadMiniconda ($python_version , $platform_suffix ) {
8+ function DownloadMiniconda ($python_version , $platform_suffix ) {
99 $webclient = New-Object System.Net.WebClient
1010 $filename = " Miniconda3-latest-Windows-" + $platform_suffix + " .exe"
1111 $url = $MINICONDA_URL + $filename
@@ -20,30 +20,30 @@ function DownloadMiniconda ($python_version, $platform_suffix) {
2020 # Download and retry up to 3 times in case of network transient errors.
2121 Write-Host " Downloading" $filename " from" $url
2222 $retry_attempts = 2
23- for ($i = 0 ; $i -lt $retry_attempts ; $i ++ ){
23+ for ($i = 0 ; $i -lt $retry_attempts ; $i ++ ) {
2424 try {
2525 $webclient.DownloadFile ($url , $filepath )
2626 break
2727 }
28- Catch [Exception ]{
28+ catch [Exception ] {
2929 Start-Sleep 1
3030 }
31- }
32- if (Test-Path $filepath ) {
33- Write-Host " File saved at" $filepath
34- } else {
35- # Retry once to get the error message if any at the last try
36- $webclient.DownloadFile ($url , $filepath )
37- }
38- return $filepath
31+ }
32+
33+ if (Test-Path $filepath ) {
34+ Write-Host " File saved at" $filepath
35+ } else {
36+ # Retry once to get the error message if any at the last try
37+ $webclient.DownloadFile ($url , $filepath )
38+ }
39+ return $filepath
3940}
4041
4142
42- function InstallMiniconda ($python_version , $architecture , $python_home ) {
43- Write-Host " Installing Python" $python_version " for " $architecture " bit architecture to " $python_home
43+ function InstallMiniconda ($python_version , $architecture , $python_home ) {
44+ Write-Host " Installing Python $python_version $architecture bit to $python_home "
4445 if (Test-Path $python_home ) {
45- Write-Host $python_home " already exists, skipping."
46- # return $false
46+ Write-Host " $python_home already exists, skipping."
4747 }
4848 if ($architecture -match " 32" ) {
4949 $platform_suffix = " x86"
@@ -52,13 +52,13 @@ function InstallMiniconda ($python_version, $architecture, $python_home) {
5252 }
5353
5454 $filepath = DownloadMiniconda $python_version $platform_suffix
55- Write-Host " Installing" $filepath " to " $python_home
55+ Write-Host " Installing $filepath to $python_home "
5656 $install_log = $python_home + " .log"
5757 $args = " /S /D=$python_home "
5858 Write-Host $filepath $args
5959 Start-Process - FilePath $filepath - ArgumentList $args - Wait - Passthru
6060 if (Test-Path $python_home ) {
61- Write-Host " Python $python_version ( $architecture ) installation complete"
61+ Write-Host " Python $python_version $architecture bit installation complete"
6262 } else {
6363 Write-Host " Failed to install Python in $python_home "
6464 Get-Content - Path $install_log
@@ -67,27 +67,29 @@ function InstallMiniconda ($python_version, $architecture, $python_home) {
6767}
6868
6969
70- function InstallCondaPackages ($python_home , $spec ) {
70+ function InstallCondaPackages ($python_home , $spec ) {
7171 $conda_path = $python_home + " \Scripts\conda.exe"
7272 $args = " install --yes " + $spec
73- Write-Host (" conda " + $args )
73+ Write-Host (" conda " + $args ) - ForegroundColor " Green "
7474 Start-Process - FilePath " $conda_path " - ArgumentList $args - Wait - Passthru
7575}
7676
7777
78- function UpdateConda ($python_home ) {
78+ function UpdateConda ($python_home ) {
7979 $conda_path = $python_home + " \Scripts\conda.exe"
80- Write-Host " Updating conda..."
80+ Write-Host " Updating conda..." - ForegroundColor " Green "
8181 $args = " update --yes conda"
8282 Write-Host $conda_path $args
8383 Start-Process - FilePath " $conda_path " - ArgumentList $args - Wait - Passthru
8484}
8585
8686
87- function main () {
87+ function main () {
88+ Write-Host " Starting install_miniconda.ps1" - ForegroundColor " Green"
8889 InstallMiniconda $env: CONDA_BLD_VERSION $env: CONDA_BLD_ARCH $env: CONDA_BLD
8990 UpdateConda $env: CONDA_BLD
9091 InstallCondaPackages $env: CONDA_BLD " conda-build jinja2 anaconda-client"
92+ Write-Host " Completed install_miniconda.ps1" - ForegroundColor " Green"
9193}
9294
9395main
0 commit comments