# Script to install and run EThingz Qualification Application
$msi_name = 'python-2.7.18.amd64.msi'
$msi_exec = 'C:\Windows\System32\msiexec.exe'
$python_installer = 'https://www.python.org/ftp/python/2.7.18/python-2.7.18.amd64.msi'
$python_path = 'C:\Python27\python.exe'
$virtualenv_path = 'C:\Python27\Scripts\virtualenv.exe'
$activate = 'C:\Python27\Lib\site-packages\virtualenv\activation\powershell\activate.ps1'
$env:PYTHONIOENCODING = "UTF-8"
if (-not (Test-Path $python_path)) {
Write-Host "python not found. Download." -ForegroundColor red
if (-not (Test-Path $msi_name)) {
Invoke-WebRequest $python_installer -OutFile $msi_name
}
Write-Host "Install." -ForegroundColor Yellow
if (-not (Test-Path $msi_name)) {
Write-Host "Download failed."
exit
}
if (-not (Test-Path $msi_exec)) {
Write-Host "Missing msiexec"
exit
}
# Run install
Start-Process -FilePath $msi_exec -ArgumentList "/package python-2.7.18.amd64.msi /quiet" -Wait
Remove-Item -Path $msi_name
}
else {
Write-Host "python found" -ForegroundColor green
}
if (-not (Test-Path $virtualenv_path)) {
Write-Host "virtualenv module not found. Install." -ForegroundColor Yellow
Start-Process -FilePath $python_path -ArgumentList "-m pip install virtualenv" -Wait -NoNewWindow
}
else {
Write-Host "virtualenv module found." -ForegroundColor green
}
if (-not (Test-Path $activate)) {
Start-Process -FilePath $python_path -ArgumentList "-m virtualenv .virtualenv" -Wait -NoNewWindow
}
& $activate
Start-Process -FilePath 'pip' -ArgumentList "install -r requirements.txt" -Wait -NoNewWindow
& deactivate
Nenhum comentário:
Postar um comentário