Closed r58Playz closed 5 years ago
Good idea, but I'm not sure this is an ideal approach...
git pull
+ relaunch. Once the game is meaningful to users who wouldn't use git directly, we'd probably produce packaged Releases (including pyglet/dependencies), possibly as a self-contained .exe. Travis/Appveyer can automate this.git pull
likely don't have git installed to be able to run git clone
. Replacing the git clone
with something like (untested)
r = urllib.request.urlopen('https://github.com/boskee/Minecraft/archive/master.zip')
with zipfile.ZipFile(BytesIO(r.read())) as z:
z.extractall()
is more portable (non-Windows), is much more efficient/fast than a git clone
, doesn't involve temporary files, and avoids run()
in favour of pure python.
python main.py
with python update_and_run_main.py
which checks for + updates first, prior to import
'ing/exec'ing the rest of the game, though that would prevent you from having a nice pyglet Update button.That's fixed...
Replacing the
git clone
with something like (untested)r = urllib.request.urlopen('https://github.com/boskee/Minecraft/archive/master.zip') with zipfile.ZipFile(BytesIO(r.read())) as z: z.extractall()
That works, but there's a catch: It updates update.py.
So, we need to use temporary files so that while updating, the updater does not update itself(the updater overwrites the file it is in).
Oh, in the imports the urllif.request
needs to be changed to urllib.request
.
Also, append this after all the imports:from io import BytesIO
This updates the game using requests.
EDIT: The git function has been removed in commit 947bfad
Closes #71