2015-01-24 23:14:25 -08:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
import sys, re, shutil, os, hashlib
|
|
|
|
import imp
|
|
|
|
import getpass
|
2015-10-07 00:44:07 -07:00
|
|
|
import subprocess
|
|
|
|
|
|
|
|
def recurse_into(target, ext, func):
|
|
|
|
# traverse root directory, and list directories as dirs and files as files
|
|
|
|
for root, dirs, files in os.walk(target):
|
|
|
|
for dfile in files:
|
|
|
|
if dfile.endswith(ext):
|
|
|
|
print('Running {} on file: {}'.format(func, dfile))
|
|
|
|
func(os.path.join(root, dfile))
|
|
|
|
|
2015-01-24 23:14:25 -08:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
2015-02-22 23:15:35 -08:00
|
|
|
d = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
|
|
|
|
os.chdir(d)
|
|
|
|
v = imp.load_source('version', 'lib/version.py')
|
|
|
|
version = v.ELECTRUM_VERSION
|
|
|
|
print "version", version
|
2015-01-24 23:14:25 -08:00
|
|
|
|
2015-10-07 00:44:07 -07:00
|
|
|
# install dependencies into 'packages' directory
|
|
|
|
deps = ['slowaes>=0.1a1',
|
|
|
|
'ecdsa>=0.9',
|
2015-02-21 02:43:53 -08:00
|
|
|
'pbkdf2',
|
2015-10-07 00:44:07 -07:00
|
|
|
'requests',
|
2015-02-21 02:43:53 -08:00
|
|
|
'qrcode',
|
2015-10-07 00:44:07 -07:00
|
|
|
'protobuf',
|
|
|
|
'dnspython',
|
|
|
|
'six']
|
|
|
|
|
|
|
|
popen = subprocess.Popen
|
|
|
|
target = os.path.join(d, 'packages')
|
2015-02-21 02:43:53 -08:00
|
|
|
for module in deps:
|
2015-10-07 00:44:07 -07:00
|
|
|
subprocess.call('pip install {} -t {}'.format(module, target), shell=True)
|
|
|
|
|
|
|
|
# recurse into dir and run func on extensions
|
|
|
|
recurse_into(target, '.pyc', os.unlink)
|
2015-01-24 23:14:25 -08:00
|
|
|
|
2015-02-21 03:49:35 -08:00
|
|
|
# fix google/__init__.py needed by pyinstaller
|
2015-10-07 00:44:07 -07:00
|
|
|
n = d + '/packages/google/__init__.py'
|
2015-02-21 03:49:35 -08:00
|
|
|
if not os.path.exists(n):
|
2015-02-22 22:14:39 -08:00
|
|
|
os.system("echo \# do not remove>%s"%n)
|
2015-02-21 03:49:35 -08:00
|
|
|
|
2015-01-24 23:14:25 -08:00
|
|
|
os.system("pyrcc4 icons.qrc -o gui/qt/icons_rc.py")
|
|
|
|
os.system("python setup.py sdist --format=zip,gztar")
|
2015-06-27 00:47:35 -07:00
|
|
|
|
2015-08-22 03:58:31 -07:00
|
|
|
print "Packages are ready in dist"
|
2015-01-24 23:14:25 -08:00
|
|
|
|
|
|
|
|