|
|
|
#!/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)
|
|
|
|
|
|
|
|
|
|
|
|
with open(download_page,'w') as f:
|
|
|
|
f.write(string)
|