yum-archive/yapBox

A black box for your yapping

git clone https://git.yummers.dev/yum-archive/yapBox

yumStatically link curation TUI89e9376

master
2.1 KiB92 linesraw
1param(
2  [switch]$skip_zip = $false,
3  [string]$release = "Release",
4  [string]$install_pip = $true
5)
6
7echo "Skip zip: $skip_zip"
8echo "Release: $release"
9echo "Install pip: $install_pip"
10
11$PSDefaultParameterValues['Out-File:Encoding'] = 'utf8'
12
13$install_dir = "yapBox"
14
15if (Test-Path $install_dir) {
16  rm -Recurse -Force $install_dir
17}
18
19$py_dir = "Python"
20
21if (Test-Path $py_dir) {
22  rm -Recurse $py_dir
23}
24if (-Not (Test-Path $py_dir)) {
25  echo "Fetching python"
26
27  $PYTHON_3_10_9_URL = "https://www.python.org/ftp/python/3.10.9/python-3.10.9-embed-amd64.zip"
28  $PYTHON_URL = $PYTHON_3_10_9_URL
29  $PYTHON_FILE = $(Split-Path -Path $PYTHON_URL -Leaf)
30
31  if (-Not (Test-Path $PYTHON_FILE)) {
32    Invoke-WebRequest $PYTHON_URL -OutFile $PYTHON_FILE
33  }
34
35  mkdir Python
36  Expand-Archive $PYTHON_FILE -DestinationPath Python
37
38  echo ".." >> Python/python310._pth
39  echo "import site" >> Python/python310._pth
40}
41
42$pip_path = "$py_dir/get-pip.py"
43
44if (Test-Path $pip_path) {
45  rm -Force $pip_path
46}
47
48if (-Not (Test-Path $pip_path)) {
49  echo "Fetching pip"
50
51  $PIP_URL = "https://bootstrap.pypa.io/get-pip.py"
52  $PIP_FILE = $(Split-Path -Path $PIP_URL -Leaf)
53
54  if (-Not (Test-Path $PIP_FILE)) {
55    Invoke-WebRequest $PIP_URL -OutFile $PIP_FILE
56  }
57
58  mv $PIP_FILE $pip_path
59}
60
61if ($install_pip) {
62  ./Python/python.exe Python/get-pip.py
63
64  echo "Installing requirements"
65  echo "Assuming host has python 3.10.9 installed" # TODO test for this
66  python -m pip install -r ../requirements.txt --target Python/Lib/site-packages
67}
68
69if (-Not (Test-Path "silero-vad")) {
70  git clone "https://github.com/snakers4/silero-vad"
71}
72
73if (-Not (Test-Path "../curate/ui")) {
74  pushd ../curate/ui >$null
75  make
76  popd >$null
77}
78
79mkdir $install_dir > $null
80mkdir $install_dir/Models
81cp ../*.py $install_dir/
82cp ../*.bat $install_dir/
83cp ../*.txt $install_dir/
84cp ../curate/ui $install_dir/curation_tui_wsl
85cp -Recurse Python $install_dir/Python
86cp "silero-vad/files/silero_vad.onnx" $install_dir/Models/
87cp "silero-vad/LICENSE" $install_dir/Models/silero_vad.onnx.LICENSE
88
89if (-Not $skip_zip) {
90  Compress-Archive -Path "$install_dir" -DestinationPath "$install_dir.zip" -Force
91}
92