forked from spesmilo/electrum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_download
executable file
·50 lines (40 loc) · 1.7 KB
/
make_download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/python3
import re
import os
import sys
import importlib
# load version.py; needlessly complicated alternative to "imp.load_source":
version_spec = importlib.util.spec_from_file_location('version', 'electrum/version.py')
version_module = importlib.util.module_from_spec(version_spec)
version_spec.loader.exec_module(version_module)
ELECTRUM_VERSION = version_module.ELECTRUM_VERSION
APK_VERSION = version_module.APK_VERSION
print("version", ELECTRUM_VERSION)
dirname = sys.argv[1]
print("directory", dirname)
download_page = os.path.join(dirname, "panel-download.html")
download_template = download_page + ".template"
with open(download_template) as f:
string = f.read()
version = version_win = version_mac = version_android = ELECTRUM_VERSION
string = string.replace("##VERSION##", version)
string = string.replace("##VERSION_WIN##", version_win)
string = string.replace("##VERSION_MAC##", version_mac)
string = string.replace("##VERSION_ANDROID##", version_android)
string = string.replace("##VERSION_APK##", APK_VERSION)
files = {
'tgz': "Electrum-%s.tar.gz" % version,
'appimage': "electrum-%s-x86_64.AppImage" % version,
'zip': "Electrum-%s.zip" % version,
'mac': "electrum-%s.dmg" % version_mac,
'win': "electrum-%s.exe" % version_win,
'win_setup': "electrum-%s-setup.exe" % version_win,
'win_portable': "electrum-%s-portable.exe" % version_win,
'apk_arm64': "Electrum-%s-arm64-v8a-release.apk" % APK_VERSION,
'apk_armeabi': "Electrum-%s-armeabi-v7a-release.apk" % APK_VERSION,
}
for k, n in files.items():
link = "https://download.electrum.org/%s/%s"%(version,n)
string = string.replace("##link_%s##"%k, link)
with open(download_page,'w') as f:
f.write(string)