Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1d9d184

Browse files
committed
Format/Rename install.ps1->install_miniconda.ps1
1 parent 166a3d2 commit 1d9d184

File tree

3 files changed

+35
-49
lines changed

3 files changed

+35
-49
lines changed

appveyor.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ init:
3838

3939
install:
4040
# install conda and deps
41-
- ps: ".\\ci\\install.ps1"
42-
- "%CONDA_BLD%\\Scripts\\conda config --set show_channel_urls true --set always_yes true --set changeps1 false"
43-
- "%CONDA_BLD%\\Scripts\\conda update -q conda"
44-
- "%CONDA_BLD%\\Scripts\\conda info -a"
41+
- ps: .\ci\install_miniconda.ps1
4542

4643
# install for wheels
4744
- "%PYTHON%\\python.exe -m pip install --upgrade pip"

ci/install.ps1 renamed to ci/install_miniconda.ps1

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
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

9395
main

ci/run_with_env.cmd

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,38 +43,25 @@
4343
SET COMMAND_TO_RUN=%*
4444
SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows
4545

46-
:: Extract the major and minor versions, and allow for the minor version to be
47-
:: more than 9. This requires the version number to have two dots in it.
46+
:: CONDA_PY style, such as 27, 34 etc.
4847
SET MAJOR_PYTHON_VERSION=%CONDA_PY:~0,1%
49-
50-
IF "%CONDA_PY:~2,1%" == "" (
51-
:: CONDA_PY style, such as 27, 34 etc.
52-
SET MINOR_PYTHON_VERSION=%CONDA_PY:~1,1%
53-
) ELSE (
54-
IF "%CONDA_PY:~3,1%" == "." (
55-
SET MINOR_PYTHON_VERSION=%CONDA_PY:~2,1%
56-
) ELSE (
57-
SET MINOR_PYTHON_VERSION=%CONDA_PY:~2,2%
58-
)
59-
)
48+
SET MINOR_PYTHON_VERSION=%CONDA_PY:~1,1%
6049

6150
:: Based on the Python version, determine what SDK version to use, and whether
6251
:: to set the SDK for 64-bit.
6352
IF %MAJOR_PYTHON_VERSION% == 2 (
6453
SET WINDOWS_SDK_VERSION="v7.0"
6554
SET SET_SDK_64=Y
66-
) ELSE (
67-
IF %MAJOR_PYTHON_VERSION% == 3 (
68-
SET WINDOWS_SDK_VERSION="v7.1"
69-
IF %MINOR_PYTHON_VERSION% LEQ 4 (
70-
SET SET_SDK_64=Y
71-
) ELSE (
72-
SET SET_SDK_64=N
73-
)
55+
) ELSE IF %MAJOR_PYTHON_VERSION% == 3 (
56+
SET WINDOWS_SDK_VERSION="v7.1"
57+
IF %MINOR_PYTHON_VERSION% LEQ 4 (
58+
SET SET_SDK_64=Y
7459
) ELSE (
75-
ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%"
76-
EXIT /B 1
60+
SET SET_SDK_64=N
7761
)
62+
) ELSE (
63+
ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%"
64+
EXIT /B 1
7865
)
7966

8067
IF "%PYTHON_ARCH%"=="64" (

0 commit comments

Comments
 (0)