Skip to content

Commit

Permalink
released songbook v1.1.17
Browse files Browse the repository at this point in the history
  • Loading branch information
igrek51 committed Sep 24, 2016
1 parent cdb3140 commit 51393a1
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions make-release.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

import subprocess
import os
import glob
import ConfigParser

def shellExec(cmd):
errCode = subprocess.call(cmd, shell=True)
if errCode != 0:
fatalError('failed executing: ' + cmd)

def fatalError(message):
print '[ERROR] ' + message
sys.exit()

def removeIfExists(fileName):
if os.path.exists(fileName):
print 'removing ' + fileName + '...'
os.remove(fileName)

def removeFilesWildcard(pattern):
files = glob.glob(pattern)
for file in files:
os.remove(file)

# zjebany ConfigParser
class FakeSecHead(object):
def __init__(self, fp):
self.fp = fp
self.sechead = '[dummysection]\n'

def readline(self):
if self.sechead:
try:
return self.sechead
finally:
self.sechead = None
else:
return self.fp.readline()


apkSrc = '../app/build/outputs/apk/app-debug.apk'
versionFile = '../app/version.properties'
guitarDBDir = 'guitarDB'
releaseDir = 'release'

os.chdir(releaseDir)

# wyciągnięcie numeru wersji
config = ConfigParser.RawConfigParser()
config.readfp(FakeSecHead(open(versionFile)))
versionName = config.get('dummysection', 'VERSION_NAME');

# pliki wyjściowe
apkOutputFile = 'SongBook-' + versionName + '.apk'
outputDBArchive = 'SongBook-db-' + versionName + '.zip'

# usuwanie starszych wersji
removeFilesWildcard('./SongBook-*.apk')
removeFilesWildcard('./SongBook-db-*.zip')

# aktualizacja zmian z bazy źródłowej
print 'updating ' + guitarDBDir + '...'
os.chdir(guitarDBDir)
shellExec('git pull origin master')
shellExec('git merge master')
os.chdir('..')

shellExec('cp ' + apkSrc + ' ' + apkOutputFile)

shellExec('zip -r '+outputDBArchive+' '+guitarDBDir+' -x *.git*')

print 'done'
Binary file added release/SongBook-1.1.17.apk
Binary file not shown.
Binary file added release/SongBook-db-1.1.17.zip
Binary file not shown.

0 comments on commit 51393a1

Please sign in to comment.