init
diff --git a/upgrade.py b/upgrade.py
new file mode 100644
index 0000000..8de756f
--- /dev/null
+++ b/upgrade.py
@@ -0,0 +1,48 @@
+#coding=utf-8
+#使用python做升级文件打包
+
+import hashlib
+import sys
+import zipfile
+from os import path
+import subprocess
+
+hashFileName = 'hash256.sign'
+
+
+def sha256_checknum(apk):
+ hash256 = hashlib.sha256()
+ srcFile = open(apk,'rb')
+ with srcFile as f:
+ for block in iter(lambda:f.read(4096),b''):
+ hash256.update(block);
+ srcFile.close()
+ hash256.update(b'nzoqPYMIu91VViA/mEIG5FtJXi8=')
+
+ hashFile = path.dirname(apk)+'/'+hashFileName
+ print('hashFile = '+hashFile)
+ destFile = open(hashFile,'w+')
+ destFile.write(hash256.hexdigest())
+ destFile.close()
+
+def zip_file(apk):
+ fileDir = path.dirname(apk)
+ version = subprocess.check_output(['git', 'describe', '--abbrev=4','--dirty','--always','--tags']).strip().decode('utf-8')
+ zipFile = fileDir+'/posa711'+'-'+version+'.zip'
+ print('zipFile = '+zipFile)
+
+ zf = zipfile.ZipFile(zipFile,'w',zipfile.ZIP_DEFLATED)
+ zf.write(fileDir+'/'+hashFileName,hashFileName)
+ zf.write(apk,'posa711.apk')
+ zf.close()
+
+if __name__ == '__main__':
+ appFile = './app/release/app-release.apk'
+ print('appFile = ' + appFile)
+
+ if not path.exists(appFile):
+ print(appFile +' is not exist')
+ exit()
+ sha256_checknum(appFile)
+ zip_file(appFile)
+ print('build upgrade zip success!')
\ No newline at end of file