Skip to content

Instantly share code, notes, and snippets.

@fredrikbonander
Created May 15, 2013 13:05
Show Gist options
  • Save fredrikbonander/5583876 to your computer and use it in GitHub Desktop.
Save fredrikbonander/5583876 to your computer and use it in GitHub Desktop.
da
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'broken'
import os
import zipfile
import yaml
from shutil import copy2
def zip_directory(path, zip):
for root, dirs, files in os.walk(path):
for file in files:
zip.write(os.path.join(root, file))
def make_zipfile(version, codename):
zip_file = zipfile.ZipFile('build/bedrock-%s-%s.zip' % (version, codename), 'w')
os.chdir('src/')
zip_directory('bedrock/', zip_file)
zip_file.close()
os.chdir('../')
copy2(zip_file.filename, 'app/')
def build():
with open('version.yaml', 'r') as f:
version_config = yaml.load(f)
make_zipfile(version_config['version'], version_config['codename'])
if __name__ == '__main__':
build()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment