uninstall.ps1 1.07 KB
Newer Older
1
$NNI_DEPENDENCY_FOLDER = [System.IO.Path]::GetTempPath()+$env:USERNAME
2
3
4
5
6

$env:PYTHONIOENCODING = "UTF-8"
if($env:VIRTUAL_ENV){
    $NNI_PYTHON3 = $env:VIRTUAL_ENV + "\Scripts"
    $NNI_PKG_FOLDER = $env:VIRTUAL_ENV + "\nni"
7
    cmd /c del "$NNI_PYTHON3\node.exe"
8
9
10
11
}
else{
    $NNI_PYTHON3 = $(python -c 'import site; from pathlib import Path; print(Path(site.getsitepackages()[0]))')
    $NNI_PKG_FOLDER = $NNI_PYTHON3 + "\nni"
12
    cmd /c del "$NNI_PYTHON3\Scripts\node.exe"
13
14
15
16
17
}

$PIP_UNINSTALL = """$NNI_PYTHON3\python"" -m pip uninstall -y "
$NNI_NODE_FOLDER = $NNI_DEPENDENCY_FOLDER+"\nni-node"
$NNI_YARN_FOLDER = $NNI_DEPENDENCY_FOLDER+"\nni-yarn"
18

19
# uninstall
20
21
cmd /c rmdir /s /q $NNI_PKG_FOLDER
cmd /c $PIP_UNINSTALL "nni"
22

23
24
25
26
27
28
29
30
31
32
# clean up
cmd /c rmdir /s /q "build"
cmd /c rmdir /s /q "src\nni_manager\dist"
cmd /c rmdir /s /q  "src\nni_manager\node_modules"
cmd /c rmdir /s /q  "src\webui\build"
cmd /c rmdir /s /q  "src\webui\node_modules"
cmd /c rmdir /s /q  "src\nasui\build"
cmd /c rmdir /s /q  "src\nasui\node_modules"
cmd /c rmdir /s /q  $NNI_YARN_FOLDER
cmd /c rmdir /s /q  $NNI_NODE_FOLDER