aboutsummaryrefslogtreecommitdiffstats
path: root/generate_release.py
diff options
context:
space:
mode:
Diffstat (limited to 'generate_release.py')
-rw-r--r--generate_release.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/generate_release.py b/generate_release.py
index ead2772..06c348b 100644
--- a/generate_release.py
+++ b/generate_release.py
@@ -13,16 +13,21 @@ import hashlib
latest_version = sys.argv[1]
+
def check(code):
if code != 0:
raise Exception('Got nonzero exit code from command')
+
+
def check_subp(x):
if x.returncode != 0:
raise Exception('Got nonzero exit code from command')
+
def log(line):
print('[generate_release.py] ' + line)
+
# https://stackoverflow.com/questions/7833715/python-deleting-certain-file-extensions
def remove_files_with_extensions(path, extensions):
for root, dirs, files in os.walk(path):
@@ -30,6 +35,7 @@ def remove_files_with_extensions(path, extensions):
if os.path.splitext(file)[1] in extensions:
os.remove(os.path.join(root, file))
+
def download_if_not_exists(file_name, url, sha256=None):
if not os.path.exists('./' + file_name):
log('Downloading ' + file_name + '..')
@@ -45,6 +51,7 @@ def download_if_not_exists(file_name, url, sha256=None):
else:
log('Using existing ' + file_name)
+
def wine_run_shell(command):
if os.name == 'posix':
check(os.system('wine ' + command.replace('\\', '/')))
@@ -53,12 +60,14 @@ def wine_run_shell(command):
else:
raise Exception('Unsupported OS')
+
def wine_run(command_parts):
if os.name == 'posix':
command_parts = ['wine',] + command_parts
if subprocess.run(command_parts).returncode != 0:
raise Exception('Got nonzero exit code from command')
+
# ---------- Get current release version, for later ----------
log('Getting current release version')
describe_result = subprocess.run(['git', 'describe', '--tags'], stdout=subprocess.PIPE)
@@ -100,7 +109,8 @@ visual_c_runtime_sha256 = '2549eb4d2ce4cf3a87425ea01940f74368bf1cda378ef8a8a1f1a
download_if_not_exists('get-pip.py', get_pip_url)
download_if_not_exists('python-dist-' + latest_version + '.zip', latest_dist_url)
download_if_not_exists('vc15_(14.10.25017.0)_2017_x86.7z',
- visual_c_runtime_url, sha256=visual_c_runtime_sha256)
+ visual_c_runtime_url,
+ sha256=visual_c_runtime_sha256)
if os.path.exists('./python'):
log('Removing old python distribution')