From 8b32b7def837a15e766039501630549149d3db41 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Mon, 8 Feb 2021 15:01:14 -0800 Subject: [PATCH] Cleanup handling of old prebuild SDK tags (#697) - Remove empty llvm-tags-32bit.txt - Remove code that executes if llvm-tags-64bit.txt is missing (it can't be since its checked in these days). - Cleanup load_file_index_list I verfied manually that llvm_precompiled_tags* list are identical before and after this change. --- emsdk.py | 33 ++++++++------------------------- llvm-tags-32bit.txt | 0 llvm-tags-64bit.txt | 2 +- 3 files changed, 9 insertions(+), 26 deletions(-) delete mode 100644 llvm-tags-32bit.txt diff --git a/emsdk.py b/emsdk.py index 6d30c56..aff9b4c 100644 --- a/emsdk.py +++ b/emsdk.py @@ -2173,25 +2173,13 @@ def remove_suffix(s, suffix): # filename should be one of: 'llvm-precompiled-tags-32bit.txt', 'llvm-precompiled-tags-64bit.txt' def load_file_index_list(filename): - try: - items = open(sdk_path(filename), 'r').read().split('\n') - items = map(lambda x: remove_suffix(remove_suffix(remove_prefix(x, 'emscripten-llvm-e'), '.tar.gz'), '.zip').strip(), items) - items = filter(lambda x: 'latest' not in x and len(x) > 0, items) + items = open(sdk_path(filename)).read().splitlines() + items = [remove_suffix(remove_suffix(remove_prefix(x, 'emscripten-llvm-e'), '.tar.gz'), '.zip').strip() for x in items] + items = [x for x in items if 'latest' not in x and len(x) > 0] - # Sort versions from oldest to newest (the default sort would be lexicographic, i.e. '1.37.1 < 1.37.10 < 1.37.2') - items = sorted(items, key=version_key)[::-1] - - return items - except: - return [] - - -def load_llvm_precompiled_tags_32bit(): - return load_file_index_list('llvm-tags-32bit.txt') - - -def load_llvm_precompiled_tags_64bit(): - return load_file_index_list('llvm-tags-64bit.txt') + # Sort versions from oldest to newest (the default sort would be + # lexicographic, i.e. '1.37.1 < 1.37.10 < 1.37.2') + return sorted(items, key=version_key) def exit_with_error(msg): @@ -2237,7 +2225,6 @@ def is_string(s): def load_sdk_manifest(): - global tools, sdks try: manifest = json.loads(open(sdk_path("emsdk_manifest.json"), "r").read()) except Exception as e: @@ -2246,8 +2233,8 @@ def load_sdk_manifest(): return emscripten_tags = load_legacy_emscripten_tags() - llvm_precompiled_tags_32bit = list(reversed(load_llvm_precompiled_tags_32bit())) - llvm_precompiled_tags_64bit = list(reversed(load_llvm_precompiled_tags_64bit())) + llvm_precompiled_tags_32bit = [] + llvm_precompiled_tags_64bit = load_file_index_list('llvm-tags-64bit.txt') llvm_precompiled_tags = llvm_precompiled_tags_32bit + llvm_precompiled_tags_64bit binaryen_tags = load_legacy_binaryen_tags() releases_tags = load_releases_tags() @@ -2818,10 +2805,6 @@ def main(): cmd = sys.argv[1] - # On first run when tag list is not present, populate it to bootstrap. - if (cmd == 'install' or cmd == 'list') and not os.path.isfile(sdk_path('llvm-tags-64bit.txt')): - fetch_emscripten_tags() - load_dot_emscripten() load_sdk_manifest() diff --git a/llvm-tags-32bit.txt b/llvm-tags-32bit.txt deleted file mode 100644 index e69de29..0000000 diff --git a/llvm-tags-64bit.txt b/llvm-tags-64bit.txt index 0bc8cd8..7920f38 100644 --- a/llvm-tags-64bit.txt +++ b/llvm-tags-64bit.txt @@ -72,4 +72,4 @@ emscripten-llvm-e1.37.10.tar.gz emscripten-llvm-e1.37.1.tar.gz emscripten-llvm-e1.37.0.tar.gz emscripten-llvm-e1.36.14.tar.gz -emscripten-llvm-e1.36.13.tar.gz \ No newline at end of file +emscripten-llvm-e1.36.13.tar.gz