Some setup scripts, let's see how it goes though..
This commit is contained in:
parent
d2b9614d89
commit
90d5660c35
4 changed files with 97 additions and 1 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,5 +1,5 @@
|
|||
__pycache__
|
||||
/.venv
|
||||
.venv
|
||||
/*.build
|
||||
/*.dist
|
||||
/htdemucs_ft
|
||||
|
|
|
|||
68
scripts/windows/refresh_env.bat
Normal file
68
scripts/windows/refresh_env.bat
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
::
|
||||
:: RefreshEnv.cmd
|
||||
::
|
||||
:: Batch file to read environment variables from registry and
|
||||
:: set session variables to these values.
|
||||
::
|
||||
:: With this batch file, there should be no need to reload command
|
||||
:: environment every time you want environment changes to propagate
|
||||
|
||||
::echo "RefreshEnv.cmd only works from cmd.exe, please install the Chocolatey Profile to take advantage of refreshenv from PowerShell"
|
||||
echo | set /p dummy="Refreshing environment variables from registry for cmd.exe. Please wait..."
|
||||
|
||||
@echo off
|
||||
|
||||
goto main
|
||||
|
||||
:: Set one environment variable from registry key
|
||||
:SetFromReg
|
||||
"%WinDir%\System32\Reg" QUERY "%~1" /v "%~2" > "%TEMP%\_envset.tmp" 2>NUL
|
||||
for /f "usebackq skip=2 tokens=2,*" %%A IN ("%TEMP%\_envset.tmp") do (
|
||||
echo/set "%~3=%%B"
|
||||
)
|
||||
goto :EOF
|
||||
|
||||
:: Get a list of environment variables from registry
|
||||
:GetRegEnv
|
||||
"%WinDir%\System32\Reg" QUERY "%~1" > "%TEMP%\_envget.tmp"
|
||||
for /f "usebackq skip=2" %%A IN ("%TEMP%\_envget.tmp") do (
|
||||
if /I not "%%~A"=="Path" (
|
||||
call :SetFromReg "%~1" "%%~A" "%%~A"
|
||||
)
|
||||
)
|
||||
goto :EOF
|
||||
|
||||
:main
|
||||
echo/@echo off >"%TEMP%\_env.cmd"
|
||||
|
||||
:: Slowly generating final file
|
||||
call :GetRegEnv "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" >> "%TEMP%\_env.cmd"
|
||||
call :GetRegEnv "HKCU\Environment">>"%TEMP%\_env.cmd" >> "%TEMP%\_env.cmd"
|
||||
|
||||
:: Special handling for PATH - mix both User and System
|
||||
call :SetFromReg "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" Path Path_HKLM >> "%TEMP%\_env.cmd"
|
||||
call :SetFromReg "HKCU\Environment" Path Path_HKCU >> "%TEMP%\_env.cmd"
|
||||
|
||||
:: Caution: do not insert space-chars before >> redirection sign
|
||||
echo/set "Path=%%Path_HKLM%%;%%Path_HKCU%%" >> "%TEMP%\_env.cmd"
|
||||
|
||||
:: Cleanup
|
||||
del /f /q "%TEMP%\_envset.tmp" 2>nul
|
||||
del /f /q "%TEMP%\_envget.tmp" 2>nul
|
||||
|
||||
:: capture user / architecture
|
||||
SET "OriginalUserName=%USERNAME%"
|
||||
SET "OriginalArchitecture=%PROCESSOR_ARCHITECTURE%"
|
||||
|
||||
:: Set these variables
|
||||
call "%TEMP%\_env.cmd"
|
||||
|
||||
:: Cleanup
|
||||
del /f /q "%TEMP%\_env.cmd" 2>nul
|
||||
|
||||
:: reset user / architecture
|
||||
SET "USERNAME=%OriginalUserName%"
|
||||
SET "PROCESSOR_ARCHITECTURE=%OriginalArchitecture%"
|
||||
|
||||
echo | set /p dummy="Finished."
|
||||
echo .```
|
||||
9
scripts/windows/run.bat
Normal file
9
scripts/windows/run.bat
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
@REM @echo off
|
||||
|
||||
call setup.bat
|
||||
|
||||
cd ..\..
|
||||
|
||||
start /B cmd /C call .venv\Scripts\python.exe -m src.gui
|
||||
|
||||
cd scripts\windows
|
||||
19
scripts/windows/setup.bat
Normal file
19
scripts/windows/setup.bat
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
@echo off
|
||||
|
||||
@REM Install Python using WinGet if necessary
|
||||
python --version >nul 2>&1 || ( winget install -e --id Python.Python.3.10 )
|
||||
|
||||
@REM Install ffmpeg using WinGet if necessary
|
||||
ffmpeg -version >nul 2>&1 || ( winget install ffmpeg )
|
||||
|
||||
@REM Refresh the environment vars so any installed commands above are active
|
||||
call refresh_env.bat
|
||||
|
||||
@REM Set up the venv if it needs to be
|
||||
if not exist ..\..\.venv\ ( python -m venv ..\..\.venv )
|
||||
|
||||
@REM Install required scripts
|
||||
..\..\.venv\Scripts\pip.exe install -r ..\..\requirements.txt
|
||||
|
||||
@REM Activate the new venv
|
||||
..\..\.venv\Scripts\activate.bat
|
||||
Loading…
Reference in a new issue