Fixes previously introduced bug
[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('packages')):
9         print "The packages directory is missing."
10         sys.exit()
11
12     # os.system("python mki18n.py")
13     os.system("pyrcc4 icons.qrc -o gui/qt/icons_rc.py")
14     os.system("python setup.py sdist --format=zip,gztar")
15     
16     _tgz="Electrum-%s.tar.gz"%version
17     _zip="Electrum-%s.zip"%version
18
19
20     # android
21     os.system('rm -rf dist/e4a-%s'%version)
22     os.mkdir('dist/e4a-%s'%version)
23     shutil.copyfile("electrum",'dist/e4a-%s/e4a.py'%version)
24     shutil.copytree("packages",'dist/e4a-%s/packages'%version)
25     shutil.copytree("lib",'dist/e4a-%s/lib'%version)
26     os.mkdir('dist/e4a-%s/gui'%version)
27     for n in ['android.py']:
28         shutil.copy("gui/%s"%n,'dist/e4a-%s/gui'%version)
29     open('dist/e4a-%s/gui/__init__.py'%version,'w').close()
30
31     os.chdir("dist")
32     # create the zip file
33     os.system( "zip -r e4a-%s.zip e4a-%s"%(version, version) )
34     os.system( "rm -rf e4a-%s"%(version) )
35
36     # change filename because some 3G carriers do not allow users to download a zip file...
37     e4a_name = "e4a-%s.zip"%version
38     e4a_name2 = e4a_name.replace(".","")
39     os.system( "mv %s %s"%(e4a_name, e4a_name2) )
40
41     import getpass
42     password = getpass.getpass("Password:")
43     for f in os.listdir("."):
44         os.system( "gpg --sign --armor --detach --passphrase \"%s\" %s"%(password, f) )
45
46     md5_tgz = hashlib.md5(file(_tgz, 'r').read()).digest().encode('hex')
47     md5_zip = hashlib.md5(file(_zip, 'r').read()).digest().encode('hex')
48     md5_android = hashlib.md5(file(e4a_name2, 'r').read()).digest().encode('hex')
49     os.chdir("..")
50
51     print ""
52     print "Packages are ready:"
53     print "dist/%s     "%_tgz, md5_tgz
54     print "dist/%s        "%_zip, md5_zip
55     print "dist/%s                "%e4a_name2, md5_android
56     print "To make a release, upload the files to the server, and update the webpages in branch gh-pages"
57