forked from Semi-ATE/Semi-ATE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.ps1
169 lines (141 loc) · 5.63 KB
/
setup.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
$commands = "npm", "conda", "git"
foreach ($command in $commands)
{
if ((Get-Command $command -ErrorAction SilentlyContinue) -eq $null)
{
Write-Host "Unable to find " $command " in path"
exit
}
}
Write-Host "existing environments will be listed below:"
Invoke-Expression "conda env list"
$env = Read-Host -Prompt "If you have already defined a favorite conda environment (env),
you can enter the environment's name now, otherwise enter a new one (default environment is 'Semi-ATE')"
if (!$env)
{
$env = 'Semi-ATE'
}
$root_location = $(Get-Location)
$webui_location = "ATE/Tester/TES/ui/angular/mini-sct-gui"
$plugin_location = "Plugins/TDKMicronas"
$spyder_location = ".."
$spyder1_location = "spyder"
$spyder2_location = "../spyder"
$smoke_test_location = "tests/ATE/spyder/widgets/CI/qt/smoketest"
$apps_location = "ATE/Tester/TES/apps"
$package_is_uptodate = $False
$confirm = "y"
function Install-Dependencies {
Write-Host "install requirements"
Invoke-Expression "conda install --file requirements/run.txt -y"
Write-Host "install test requirements"
Invoke-Expression "conda install --file requirements/test.txt -y"
Write-Host "install ATE package"
Rename-Item -Path ".\MANIFEST.in" -NewName ".\MANIFEST.in.abc"
Invoke-Expression "python setup.py develop"
Rename-Item -Path ".\MANIFEST.in.abc" -NewName ".\MANIFEST.in"
Write-Host "install TDKMicronas plugin package"
Invoke-Expression "cd $plugin_location"
Invoke-Expression "python setup.py develop"
}
try
{
Invoke-Expression "conda deactivate"
Invoke-Expression "conda activate $env"
Write-Host "conda environment: " $env " is activated"
}
catch
{
Write-Host "new conda environment: " $env " will be generated"
$confirmation = Read-Host "are you sure you want proceed and create the new environment [y/n]"
if (($confirmation -eq $confirm) -or (!$confirmation))
{
Write-Host "create new conda environment: " $env
Invoke-Expression "conda create -n $env python=3.7 -y"
Invoke-Expression "conda config --append channels conda-forge"
Invoke-Expression "conda deactivate $env"
Invoke-Expression "conda activate $env"
$package_is_uptodate = $True
Install-Dependencies
} else
{
exit
}
Set-Location -Path $root_location
}
$confirmation = Read-Host "do you want to build web-UI disctribution [y/n]"
if (($confirmation -eq $confirm) -or (!$confirmation))
{
Write-Host "install angular cli dependencies"
Invoke-Expression "npm i -g @angular/cli"
Write-Host "install web-UI dependencies"
Invoke-Expression "cd $webui_location"
Invoke-Expression "npm install"
Invoke-Expression "npm audit fix"
Write-Host "generate web-UI distribution"
Invoke-Expression "ng build"
Set-Location -Path $root_location
}
Write-Host "new configuration file for master and control Apps will be generated"
$confirmation = Read-Host "are you sure you want proceed and create new configuration files [y/n]"
if (($confirmation -eq $confirm) -or (!$confirmation))
{
Set-Location -Path $apps_location
Write-Host "generate control_app configuration file"
Invoke-Expression "python auto_script.py control SCT-82-1F -conf"
Write-Host "done"
Write-Host "generate master_app configuration file"
Invoke-Expression "python auto_script.py master SCT-82-1F -conf"
Write-Host "done"
Invoke-Expression "cp le123456000_template.xml le123456000.xml"
Write-Host "testprogram name must be adapted in ATE/Tester/TES/apps/le123456000.xml, therefore replace the 'PROGRAM_DIR#' field inside
'STATION' section with the following:"
$testprogram_location = "smoketest/smoke_test/src/HW0/PR/smoke_test_HW0_PR_Die1_Production_PR_1.py"
Write-Host "(make sure you copy the absolut path!!) => test program path: " $testprogram_location
Write-Host "now you should be able to start control, master and test-application"
}
Set-Location -Path $root_location
$confirmation = Read-Host "do you want to get spyder sources [y/n]"
if (($confirmation -eq $confirm) -or (!$confirmation))
{
Set-Location -Path $spyder_location
$spyder = $(Get-Location)
Invoke-Expression "git clone https://github.com/spyder-ide/spyder.git"
Invoke-Expression "git checkout 413c994"
Write-Host "to run spyder-IDE use the following command, first change directroy to: " $spyder"/spyder"
Write-Host "python bootstrap.py"
}
$confirmation = Read-Host "do you want to install spyder dependencies [y/n]"
if (($confirmation -eq $confirm) -or (!$confirmation))
{
Set-Location -Path $root_location
try
{
Set-Location -Path $spyder2_location
Invoke-Expression "conda install --file requirements/conda.txt -y"
Set-Location -Path $root_location
Install-Dependencies
} catch
{
Set-Location -Path $spyder_location
Write-Host "spyder folder could not be found under: " $(Get-Location)
exit
}
}
Set-Location -Path $root_location
Write-Host "build test program"
Invoke-Expression "pytest $smoke_test_location"
Invoke-Expression "Copy-Item -Path $smoke_test_location -Destination ./ -Recurse -force"
Set-Location -Path $root_location
if ($package_is_uptodate -ne $True)
{
$confirmation = Read-Host "do you want to install packages again [y/n]"
if (($confirmation -eq $confirm) -or (!$confirmation))
{
Install-Dependencies
}
}
Set-Location -Path $root_location
Write-Host ""
Write-Host " !!!!!!!!!!!!!!!!!!!!!!! ATTENTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
Write-Host " please make sure you read the instruction from README.md file"