1@echo off 2rem Used by the buildbot "remotedeploy" step. 3setlocal 4 5set PATH=%PATH%;%SystemRoot%\SysNative\OpenSSH;%SystemRoot%\System32\OpenSSH 6set here=%~dp0 7set arm32_ssh= 8 9:CheckOpts 10if "%1"=="-arm32" (set arm32_ssh=true) & shift & goto CheckOpts 11if NOT "%1"=="" (echo unrecognized option %1) & goto Arm32SshHelp 12 13if "%arm32_ssh%"=="true" goto :Arm32Ssh 14 15:Arm32Ssh 16if "%SSH_SERVER%"=="" goto :Arm32SshHelp 17 18ssh %SSH_SERVER% echo Make sure we can find SSH and SSH_SERVER variable is valid 19if %ERRORLEVEL% NEQ 0 (echo SSH does not work) & exit /b %ERRORLEVEL% 20 21if "%PYTHON_SOURCE%"=="" (set PYTHON_SOURCE=%here%..\..\) 22if "%REMOTE_PYTHON_DIR%"=="" (set REMOTE_PYTHON_DIR=C:\python\) 23if NOT "%REMOTE_PYTHON_DIR:~-1,1%"=="\" (set REMOTE_PYTHON_DIR=%REMOTE_PYTHON_DIR%\) 24echo PYTHON_SOURCE = %PYTHON_SOURCE% 25echo REMOTE_PYTHON_DIR = %REMOTE_PYTHON_DIR% 26 27REM stop Python processes and remove existing files if found 28ssh %SSH_SERVER% "kill python.exe" 29ssh %SSH_SERVER% "kill python_d.exe" 30ssh %SSH_SERVER% "if EXIST %REMOTE_PYTHON_DIR% (rd %REMOTE_PYTHON_DIR% /s/q)" 31 32REM Create Python directories 33ssh %SSH_SERVER% "md %REMOTE_PYTHON_DIR%PCBuild\arm32" 34ssh %SSH_SERVER% "md %REMOTE_PYTHON_DIR%temp" 35ssh %SSH_SERVER% "md %REMOTE_PYTHON_DIR%Modules" 36ssh %SSH_SERVER% "md %REMOTE_PYTHON_DIR%PC" 37 38REM Copy Python files 39for /f "USEBACKQ" %%i in (`dir PCbuild\*.bat /b`) do @scp PCBuild\%%i "%SSH_SERVER%:%REMOTE_PYTHON_DIR%PCBuild" 40for /f "USEBACKQ" %%i in (`dir PCbuild\*.py /b`) do @scp PCBuild\%%i "%SSH_SERVER%:%REMOTE_PYTHON_DIR%PCBuild" 41for /f "USEBACKQ" %%i in (`dir PCbuild\arm32\*.exe /b`) do @scp PCBuild\arm32\%%i "%SSH_SERVER%:%REMOTE_PYTHON_DIR%PCBuild\arm32" 42for /f "USEBACKQ" %%i in (`dir PCbuild\arm32\*.pyd /b`) do @scp PCBuild\arm32\%%i "%SSH_SERVER%:%REMOTE_PYTHON_DIR%PCBuild\arm32" 43for /f "USEBACKQ" %%i in (`dir PCbuild\arm32\*.dll /b`) do @scp PCBuild\arm32\%%i "%SSH_SERVER%:%REMOTE_PYTHON_DIR%PCBuild\arm32" 44scp -r "%PYTHON_SOURCE%Include" "%SSH_SERVER%:%REMOTE_PYTHON_DIR%Include" 45scp -r "%PYTHON_SOURCE%Lib" "%SSH_SERVER%:%REMOTE_PYTHON_DIR%Lib" 46scp -r "%PYTHON_SOURCE%Parser" "%SSH_SERVER%:%REMOTE_PYTHON_DIR%Parser" 47scp -r "%PYTHON_SOURCE%Tools" "%SSH_SERVER%:%REMOTE_PYTHON_DIR%Tools" 48scp "%PYTHON_SOURCE%Modules\Setup" "%SSH_SERVER%:%REMOTE_PYTHON_DIR%Modules" 49scp "%PYTHON_SOURCE%PC\pyconfig.h" "%SSH_SERVER%:%REMOTE_PYTHON_DIR%PC" 50 51exit /b %ERRORLEVEL% 52 53:Arm32SshHelp 54echo SSH_SERVER environment variable must be set to administrator@[ip address] 55echo where [ip address] is the address of a Windows IoT Core ARM32 device. 56echo. 57echo The test worker should have the SSH agent running. 58echo Also a key must be created with ssh-keygen and added to both the buildbot worker machine 59echo and the ARM32 worker device: see https://docs.microsoft.com/en-us/windows/iot-core/connect-your-device/ssh 60exit /b 127 61