yum-archive/yapBox
A black box for your yapping
git clone https://git.yummers.dev/yum-archive/yapBox
ca55539
v1.1.0
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 ) { 16rm -Recurse -Force $install_dir 17} 18 19$py_dir = "Python" 20 21if ( Test-Path $py_dir ) { 22rm -Recurse $py_dir 23} 24if ( -Not ( Test-Path $py_dir )) { 25echo "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 31if ( -Not ( Test-Path $PYTHON_FILE )) { 32Invoke-WebRequest $PYTHON_URL -OutFile $PYTHON_FILE 33} 34 35mkdir Python 36Expand-Archive $PYTHON_FILE -DestinationPath Python 37 38echo ".." >> Python/ python310. _pth 39echo "import site" >> Python/ python310. _pth 40} 41 42$pip_path = " $py_dir /get-pip.py" 43 44if ( Test-Path $pip_path ) { 45rm -Force $pip_path 46} 47 48if ( -Not ( Test-Path $pip_path )) { 49echo "Fetching pip" 50 51$PIP_URL = "https://bootstrap.pypa.io/get-pip.py" 52$PIP_FILE = $( Split-Path -Path $PIP_URL -Leaf ) 53 54if ( -Not ( Test-Path $PIP_FILE )) { 55Invoke-WebRequest $PIP_URL -OutFile $PIP_FILE 56} 57 58mv $PIP_FILE $pip_path 59} 60 61if ( $install_pip ) { 62. / Python / python. exe Python/ get-pip. py 63 64echo "Installing requirements" 65echo "Assuming host has python 3.10.9 installed" # TODO test for this 66python -m pip install-r .. / requirements. txt - -target Python/ Lib/ site-packages 67} 68 69if ( -Not ( Test-Path "silero-vad" )) { 70git clone"https://github.com/snakers4/silero-vad" 71} 72 73mkdir $install_dir > $null 74mkdir $install_dir / Models 75cp .. /* . py $install_dir / 76cp .. /* . bat $install_dir / 77cp .. /* . txt $install_dir / 78cp -Recurse Python$install_dir / Python 79cp "silero-vad/files/silero_vad.onnx" $install_dir / Models/ 80cp "silero-vad/LICENSE" $install_dir / Models/ silero_vad. onnx . LICENSE 81 82if ( -Not $skip_zip ) { 83Compress-Archive -Path " $install_dir " -DestinationPath " $install_dir .zip" -Force 84} 85