-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.ps1
56 lines (51 loc) · 1.52 KB
/
test.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
$pythonVersion = '3.9.6'
## checking Chocolatey
Write-Host -NoNewline "checking chocolatey..."
Try{
# Check if winget is already installed
$er = (invoke-expression "choco -v") 2>&1
if ($lastexitcode) {throw $er}
Write-Output "[Found]"
}
Catch{
Write-Output "[Not Found]"
Write-Host "installing chocolatey..."
## installing Chocolatey
# Set directory for installation - Chocolatey does not lock
# down the directory if not the default
$InstallDir='C:\ProgramData\chocolatey'
## $env:ChocolateyInstall="$InstallDir"
# If your PowerShell Execution policy is restrictive, you may
# not be able to get around that. Try setting your session to
# Bypass.
Set-ExecutionPolicy Bypass -Scope Process -Force;
# All install options - offline, proxy, etc at
# https://chocolatey.org/install
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
}
## checking python
Write-Host -NoNewline "checking python..."
Try{
# Check if python is already installed
$er = (invoke-expression "python -V") 2>&1
if ($lastexitcode) {throw $er}
Write-Output "[Found]"
}
Catch{
Write-Output "[Not Found]"
Write-Host "installing python..."
choco install python --version=$pythonVersion -y
}
## checking pipenv
Write-Host -NoNewline "checking pipenv..."
Try{
# Check if pipenv is already installed
$er = (invoke-expression "python -m pipenv --version") 2>&1
if ($lastexitcode) {throw $er}
Write-Output "[Found]"
}
Catch{
Write-Output "[Not Found]"
Write-Host "installing pipenv..."
python -m pip install pipenv
}