diff options
author | Jesús <heckyel@hyperbola.info> | 2020-12-15 21:14:27 -0500 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2020-12-15 21:14:27 -0500 |
commit | f4b36a220d085080a881dbe2f63e51b2fb28a003 (patch) | |
tree | 8f3ec6d5ce90e7fb489e7c270ef986d84dc279b2 /generate_release.py | |
parent | cf8e8ea5b10c00639d68b8a04a292bda454cc18d (diff) | |
download | yt-local-f4b36a220d085080a881dbe2f63e51b2fb28a003.tar.lz yt-local-f4b36a220d085080a881dbe2f63e51b2fb28a003.tar.xz yt-local-f4b36a220d085080a881dbe2f63e51b2fb28a003.zip |
pep8
Diffstat (limited to 'generate_release.py')
-rw-r--r-- | generate_release.py | 12 |
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') |