Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to the Windows Batches #4213

Merged
merged 10 commits into from
Aug 19, 2016
39 changes: 21 additions & 18 deletions windows_bat/PokemonGo-Bot-Install.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CLS


:init
setlocal DisableDelayedExpansion
setlocal EnableDelayedExpansion
path c:\Program Files\Git\cmd;%PATH%
path C:\Python27;%PATH%
path C:\Python27\Scripts;%PATH%
Expand All @@ -20,7 +20,6 @@ set GitFName64=Git-2.9.3-64-bit.exe
set "batchPath=%~0"
for %%k in (%0) do set batchName=%%~nk
set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
setlocal EnableDelayedExpansion



Expand Down Expand Up @@ -63,7 +62,7 @@ CLS
@ECHO.
set InstallPath=
set /p InstallPath= "Choose an installation folder or press Enter to close:" ||goto:eof
FOR /F "tokens=1-4 delims=/-. " %%G IN ("%InstallPath%") DO (set InstallPath=%%G\%%H\%%I\%%J)
FOR /F "tokens=1-4 delims=/-. " %%G IN ("%InstallPath%") DO (set InstallPath=%%G\%%H\%%I)
set PGBotPath=%InstallPath%\PokemonGo-Bot
set DownPath=%InstallPath%\Install-Files
if not exist %DownPath% md %DownPath%
Expand Down Expand Up @@ -190,9 +189,11 @@ CLS
@ECHO.
@ECHO.
@ECHO.
if exist %PGBotPath%\configs\config.json copy %PGBotPath%\configs\config.json %DownPath%
if exist %PGBotPath%\web\config\userdata.js copy %PGBotPath%\web\config\userdata.js %DownPath%
if exist %PGBotPath%\encrypt. copy %PGBotPath%\encrypt. %DownPath%
if exist %PGBotPath%\encrypt.so COPY %PGBotPath%\encrypt.so %DownPath%
if exist %PGBotPath%\encrypt.dll COPY %PGBotPath%\encrypt.dll %DownPath%
if exist %PGBotPath%\encrypt_64.dll COPY %PGBotPath%\encrypt_64.dll %DownPath%
if exist %PGBotPath%\configs\config.json COPY %PGBotPath%\configs\config.json %DownPath%
if exist %PGBotPath%\web\config\userdata.js COPY %PGBotPath%\web\config\userdata.js %DownPath%
@ECHO.
@ECHO.
@ECHO.
Expand All @@ -201,24 +202,26 @@ if exist %PGBotPath%\encrypt. copy %PGBotPath%\encrypt. %DownPath%
@ECHO.
@ECHO.
if exist %PGBotPath% rmdir %PGBotPath% /s /q
if not exist %PGBotPath% md %PGBotPath%
cd C:\Python27\
pip2 install --upgrade pip
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be presented as an option to the user whether they want virtualenv or not?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed because after testing in some Windows machines it would cause issues in some of them. Pip just wouldnt be able to get setuptools from the online repositories, so it stuck on a loop and the bot would never start. Removing virtualenv made the bot work, but makes the user unable to run multiple bots simultaneously. I think this is fine, as these batches are intended to be used by people with very low knowledge of how to configure the bot, and running multiple bots require a bit more understanding of how it Works.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with what you're saying, but you shouldn't make the decision for someone, you should let them make a decision and give them the option

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I leave virtualenv in the install and start batch, they will just stop in 3 out of 4 Windows machines, show a Installing pip, setuptools message and stay there for hours, not showing any error messages.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No give the user the option "Do you want to install virtual env [Y / N]" if yes install, if no don't

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to find a way to do this, as it would require changes to both install and start batchs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it back to the installation as it installs fine, just starting it causes the freezing. Im not gonna add it to the start batch as the start batch doesnt support multiple bot anyway.

pip2 install --upgrade virtualenv
git clone --recursive -b master https://github.com/PokemonGoF/PokemonGo-Bot %PGBotPath%
if "%OS%" == "32-BIT" pip2 install --upgrade %PGBotPath%\windows_bat\PyYAML-3.11-cp27-cp27m-win32.whl
if "%OS%" == "64-BIT" pip2 install --upgrade %PGBotPath%\windows_bat\PyYAML-3.11-cp27-cp27m-win_amd64.whl
cd %PGBotPath%
virtualenv .
call "%PGBotPath%\Scripts\activate.bat"
pip2 install --upgrade -r %PGBotPath%\requirements.txt
pip2 install -r %PGBotPath%\requirements.txt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove these 2?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PyYAML is installed by the command pip2 install -r %PGBotPath%\requirements.txt in line 206. It was redundant.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 13, pyyaml==3.11

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Protobuf is there too, in line 5: protobuf==3.0.0b4. It was removed in the last PR too. I just didnt notice the PYYAML there. I saw it last night after reading the install results and seeing the requirement fulfilled messages.

@ECHO.
@ECHO.
@ECHO.
@ECHO --------------------Restoring Backup--------------------
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this line? If anything, you should remove the line without --upgrade as this line does both (whether fresh install or not)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was being done twice. Now its done only once by pip2 install -r %PGBotPath%\requirements.txt on line 206

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't include the --upgrade tag though, which imho is required, as there will be some users updating, and some users installing from fresh. Needs to account for both. There is no harm in having --upgrade if the pckage doesnt exist already, but if an older version does exist, not having this flag will not update users and will cause issues

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a --upgrade works fine until it reaches the xxhash package, where it freezes just like it happens with setuptools package. This seems to be a loop where pip fails to upgrade the package and keeps trying, for hours if you let it. Thats why I removed it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Installation of setuptools and xxhash works fine, just upgrading it wont work. Virtualenv is broken on some systems because it tries to update setuptools at start too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im gonna keep trying to run it using --upgrade on my machine and some others, as soon it Works again in most of them, I can create another PR and add that function back. Right now, this issue blocks the installation to move forward.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to allow second review to see if it's ready for merge or not

@ECHO.
@ECHO.
@ECHO.
if exist %DownPath%\encrypt. COPY %DownPath%\encrypt. %PGBotPath%
if exist %~dp0\encrypt.so COPY %~dp0\encrypt.so %PGBotPath%
if exist %~dp0\encrypt.dll COPY %~dp0\encrypt.dll %PGBotPath%
if exist %~dp0\encrypt_64.dll COPY %~dp0\encrypt_64.dll %PGBotPath%
if exist %~dp0\config.json COPY %~dp0\config.json %PGBotPath%\configs\
if exist %~dp0\userdata.js COPY %~dp0\userdata.js %PGBotPath%\web\config\
if exist %DownPath%\encrypt.so COPY %DownPath%\encrypt.so %PGBotPath%
if exist %DownPath%\encrypt.dll COPY %DownPath%\encrypt.dll %PGBotPath%
if exist %DownPath%\encrypt_64.dll COPY %DownPath%\encrypt_64.dll %PGBotPath%
if exist %DownPath%\config.json COPY %DownPath%\config.json %PGBotPath%\configs\
if exist %DownPath%\userdata.js COPY %DownPath%\userdata.js %PGBotPath%\web\config\
@ECHO.
Expand Down Expand Up @@ -247,15 +250,15 @@ CLS
@ECHO.
@ECHO.
@ECHO.
@ECHO "%PGBotPath%/configs/config.json"
@ECHO "%PGBotPath%\configs\config.json"
@ECHO INSTRUCTIONS:
@ECHO "https://github.com/PokemonGoF/PokemonGo-Bot/blob/master/docs/configuration_files.md"
@ECHO.
@ECHO "%PGBotPath%/web/config/userdata.js"
@ECHO "%PGBotPath%\web\config\userdata.js"
@ECHO INSTRUCTIONS:
@ECHO "https://github.com/PokemonGoF/PokemonGo-Bot/blob/master/docs/google_map.md"
@ECHO.
@ECHO To get an Google Map API Key:
@ECHO To get an Google Maps API Key:
@ECHO "https://developers.google.com/maps/documentation/javascript/get-api-key"
@ECHO.
@ECHO.
Expand All @@ -266,4 +269,4 @@ CLS

:eof
ENDLOCAL
exit
exit
12 changes: 4 additions & 8 deletions windows_bat/PokemonGo-Bot-Start.bat
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,19 @@ git submodule update --init --recursive
@ECHO WARNING: Verify if the Config.json file got updated. If Yes, check if your modifications are still valid before proceeding.
@ECHO.
@timeout /t 10
CLS
@ECHO --------------------Initializing environment--------------------
@ECHO.
virtualenv .
CD Scripts
call activate.bat
CD..
pip2 install --upgrade -r requirements.txt
CLS
@ECHO --------------------Initializing web server--------------------
@ECHO.
@ECHO.
set BatchPath="%~dp0"
start cmd.exe /k "CD %BatchPath%&CD..&CD web&python -m SimpleHTTPServer"
@ECHO.
@ECHO.
CLS
@ECHO --------------------Starting bot--------------------
@ECHO.
@ECHO.



Expand Down Expand Up @@ -100,4 +96,4 @@ goto:eof


:eof
exit
exit
Binary file removed windows_bat/PyYAML-3.11-cp27-cp27m-win32.whl
Binary file not shown.
Binary file removed windows_bat/PyYAML-3.11-cp27-cp27m-win_amd64.whl
Binary file not shown.