make_packages script
[electrum-nvc.git] / make_packages
1 #!/usr/bin/python
2
3 from lib.version import ELECTRUM_VERSION as version
4
5 if __name__ == '__main__':
6     import sys, re, shutil, os, hashlib
7
8     if not ( os.path.exists('aes') and os.path.exists('ecdsa') ):
9         print "aes and ecdsa are missing. copy them locally before."
10         sys.exit()
11
12     if not os.path.exists('data/blockchain_headers'):
13         print "header file is missing"
14         sys.exit()
15
16     os.system("python mki18n.py")
17     os.system("pyrcc4 icons.qrc -o lib/icons_rc.py")
18     os.system("python setup.py sdist --format=zip,gztar")
19     
20     _tgz="Electrum-%s.tar.gz"%version
21     _zip="Electrum-%s.zip"%version
22
23
24     # android
25     os.system('rm -rf dist/e4a-%s'%version)
26     os.mkdir('dist/e4a-%s'%version)
27     shutil.copyfile("electrum",'dist/e4a-%s/electrum.py'%version)
28     shutil.copytree("ecdsa",'dist/e4a-%s/ecdsa'%version)
29     shutil.copytree("aes",'dist/e4a-%s/aes'%version)
30     shutil.copytree("lib",'dist/e4a-%s/electrum'%version)
31     shutil.copyfile("data/blockchain_headers",'dist/e4a-%s/blockchain_headers'%version)
32
33     os.chdir("dist" )    
34     # create the zip file
35     os.system( "zip -r e4a-%s.zip e4a-%s"%(version, version) )
36     # copy to a filename without extension
37     os.system( "cp e4a-%s.zip e4a"%version )
38     os.chdir(".." )
39
40     md5_tgz = hashlib.md5(file('dist/'+_tgz, 'r').read()).digest().encode('hex')
41     md5_zip = hashlib.md5(file('dist/'+_zip, 'r').read()).digest().encode('hex')
42     md5_android = hashlib.md5(file('dist/e4a', 'r').read()).digest().encode('hex')
43
44     print ""
45     print "Packages are ready:"
46     print "dist/%s     "%_tgz, md5_tgz
47     print "dist/%s        "%_zip, md5_zip
48     print "dist/e4a                       ", md5_android
49     print "To make a release, upload the files to https://github.com/spesmilo/electrum/downloads and update the webpages in branch gh-pages"
50