Skip to content

Commit

Permalink
Add the appcast python scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleconroy committed Feb 16, 2013
1 parent 27921e9 commit 66578f8
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ bin/*
release.md
post.md
src/conf.lua.bak
sparkle
*.pyc
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ love: maps

maps: $(patsubst %.tmx,%.lua,$(wildcard src/maps/*.tmx))
positions: $(patsubst %.png,%.lua,$(wildcard src/positions/*.png))
oldreleases: $(shell python scripts/older_releases.py)

src/maps/%.lua: src/maps/%.tmx bin/tmx2lua
bin/tmx2lua $<
Expand Down Expand Up @@ -91,6 +92,10 @@ upload: osx win venv
venv/bin/python scripts/upload.py $(current_version) build/hawkthorne-win-x64.zip
venv/bin/python scripts/symlink.py $(current_version)

deltas:
python scripts/sparkle.py


release: release.md
git fetch origin
git fetch --tags
Expand Down Expand Up @@ -135,5 +140,3 @@ reset:
rm -rf ~/Library/Application\ Support/LOVE/hawkthorne/gamesave-*.json
rm -rf $(XDG_DATA_HOME)/love/ ~/.local/share/love/
rm -rf src/maps/*.lua

ci: $(CI)
62 changes: 62 additions & 0 deletions scripts/sparkle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import version
import os
import urllib
import logging
import subprocess
from os import path

logging.basicConfig(level=logging.INFO)

HAWK_URL = "http://files.projecthawkthorne.com/releases/{}/hawkthorne-osx.zip"
BDIFF_URL = "https://bitbucket.org/kyleconroy/love/downloads/BinaryDelta.zip"


if __name__ == "__main__":
x, y, z = version.current_version_tuple()
#versions = ["{}.{}.{}".format(x, y, int(z) - i) for i in range(1,6)]
versions = ["v0.0.70", "v0.0.69"]
current_version = versions[0]
current_dir = path.join("sparkle", "releases", current_version)

if not path.exists("sparkle/releases"):
os.makedirs("sparkle/releases")

if not path.exists("sparkle/deltas"):
os.makedirs("sparkle/deltas")

if not path.exists("sparkle/BinaryDelta"):

if not path.exists("sparkle/BinaryDelta.zip"):
logging.info("Fetching BinaryDelta")
urllib.urlretrieve(BDIFF_URL, "sparkle/BinaryDelta.zip")

subprocess.call(["unzip", "-q", "sparkle/BinaryDelta.zip", "-d", "sparkle"])

for version in versions:
app_dir = path.join("sparkle", "releases", version)
zip_path = path.join(app_dir, "hawk-osx.zip")
app_path = path.join(app_dir, "Journey to the Center of Hawkthorne.app")
# Check S3 for existing delta?? Probably a good idea

if not path.exists(app_dir):
os.makedirs(app_dir)

if not path.exists(zip_path):
logging.info("Fetching {}".format(zip_path))
urllib.urlretrieve(HAWK_URL.format(version), zip_path)

if not path.exists(app_path):
subprocess.call(["unzip", "-q", zip_path, "-d", app_dir])

for version in versions[1:]:
delta_path = path.join("sparkle", "deltas",
"{}-{}.delta".format(version, current_version))

if path.exists(delta_path):
continue

app_dir = path.join("sparkle", "releases", version)

subprocess.call(["BinaryDelta", "create",
os.path.join(app_dir, "Journey to the Center of Hawkthorne.app"),
os.path.join(current_dir, "Journey to the Center of Hawkthorne.app")])

0 comments on commit 66578f8

Please sign in to comment.