This repository has been archived by the owner on Jul 26, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
robotpy-install.bat
100 lines (80 loc) · 3.1 KB
/
robotpy-install.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
@echo off
set ARGV[0]=%1
if %1.==. set ARGV[0]=none
if %ARGV[0]%=="973" (
echo Using 973's 2017-offseason...
set ROBOT_REPOSITORY=2017-offseason
set REPO=https://github.com/team973/2017-offseason
) else (
echo No argument supplied/argument not supported, defaulting...
set ROBOT_REPOSITORY=robotpy-skeleton
set REPO=https://github.com/team973/robotpy-skeleton
)
set REPO_LOCATION=%HOMEPATH%\GitHub\%ROBOT_REPOSITORY%
echo Creating install directory...
if not exist "C:\robotpy-install\" mkdir C:\robotpy-install
cd C:\robotpy-install
if not exist "%HOMEPATH%\AppData\Local\atom\atom.exe" (
if not exist "AtomSetup-x64.exe" (
echo Downloading Atom...
powershell -Command "Invoke-WebRequest https://atom.io/download/windows_x64 -OutFile AtomSetup-x64.exe" || goto :error
)
echo Installing Atom...
start /w AtomSetup-x64.exe
)
if not exist "atompackages" (
echo Downloading Atom package list...
powershell -Command "Invoke-WebRequest https://raw.githubusercontent.com/Team973/robotpy-skeleton/master/atompackages -OutFile atompackages.bat" || goto :error
)
echo Installing Atom Packages...
for /f %%a in (atompackages) do (
apm install %%a || goto :error
)
if not exist "%HOMEPATH%\AppData\Local\Programs\Python\Python36-32\" (
if not exist "python-3.6.2.exe" (
echo Downloading Python 3.6.2...
powershell -Command "Invoke-WebRequest https://www.python.org/ftp/python/3.6.2/python-3.6.2.exe -OutFile python-3.6.2.exe" || goto :error
)
echo Installing Python...
start /w python-3.6.2.exe
)
echo Installing Python Modules...
py -3 -m pip -qq install pyfrc coverage robotpy-ctre robotpy-installer || goto :error
if not exist "C:\Program Files\Git\" (
if not exist "Git-2.14.1-64-bit.exe" (
echo Downloading Git...
powershell -Command "Invoke-WebRequest https://github.com/git-for-windows/git/releases/download/v2.14.1.windows.1/Git-2.14.1-64-bit.exe -OutFile Git-2.14.1-64-bit.exe" || goto :error
)
echo Installing Git...
start /w Git-2.14.1-64-bit.exe
)
echo Creating GitHub folder...
if not exist "%HOMEPATH%\Documents\GitHub" mkdir %HOMEPATH%\Documents\GitHub
cd %HOMEPATH%\Documents\GitHub
if not exist "%REPO_LOCATION%" mkdir %REPO_LOCATION%
cd %REPO_LOCATION%
echo Cloning %ROBOT_REPOSITORY%...
git init -q || goto :error
git config remote.origin.url %REPO% || goto :error
git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/* || goto :error
git config core.autocrlf false || goto :error
git fetch origin master:refs/remotes/origin/master --tags --force || goto :error
git reset --hard origin/master || goto :error
echo Testing robot.py...
py -3 %REPO_LOCATION%\src\robot.py test || goto :error
echo Success! We are done"
echo ONLY HIT ENTER IF YOU WANT TO SETUP ROBORIO! Otherwise, hit ^C
pause
echo Unplug ethernet if plugged in!"
pause
echo Downloading RobotPy for RoboRio...
py -3 -m robotpy-installer download-robotpy
echo Plug in ethernet now!"
pause
echo Installing RobotPy for RoboRio...
set /p ROBOT=Enter your robot's number:
py -3 -m robotpy-installer install-robotpy --robot %ROBOT%
echo Success! You may unplug ethernet now.
pause
:error
exit /b %errorlevel%