From ebcfa7cbb734a541515c2b4713a733fc7de163ae Mon Sep 17 00:00:00 2001 From: mohanson Date: Sat, 4 Oct 2025 09:32:21 +0800 Subject: [PATCH] Optimizing build scripts --- script/build_spec.py | 6 ++++-- script/build_wabt.py | 3 +++ script/build_wasi.py | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/script/build_spec.py b/script/build_spec.py index 76b6d0d4..5230edde 100644 --- a/script/build_spec.py +++ b/script/build_spec.py @@ -20,6 +20,8 @@ def cd(dst: str) -> typing.Generator[None, typing.Any, None]: root = os.path.dirname(os.path.dirname(__file__)) os.chdir(root) +wast2json = f'{root}/res/wabt/bin/wast2json' + with cd('res'): if not os.path.exists('spec'): @@ -32,7 +34,7 @@ def cd(dst: str) -> typing.Generator[None, typing.Any, None]: call('git checkout fffc6e12fa454e475455a7b58d3b5dc343980c10') with cd('res/spec/test/core'): for e in sorted(glob.glob('*.wast')): - call(f'{root}/res/wabt/bin/wast2json {e}') + call(f'{wast2json} {e}') with cd('res/spec/test/core/simd'): for e in sorted(glob.glob('*.wast')): - call(f'{root}/res/wabt/bin/wast2json {e}') + call(f'{wast2json} {e}') diff --git a/script/build_wabt.py b/script/build_wabt.py index 4a259495..375d71b6 100644 --- a/script/build_wabt.py +++ b/script/build_wabt.py @@ -20,6 +20,9 @@ def cd(dst: str) -> typing.Generator[None, typing.Any, None]: os.chdir(cwd) +root = os.path.dirname(os.path.dirname(__file__)) +os.chdir(root) + version = '1.0.37' url = '' match platform.system().lower(): diff --git a/script/build_wasi.py b/script/build_wasi.py index 5b53d0ac..18fc44e9 100644 --- a/script/build_wasi.py +++ b/script/build_wasi.py @@ -17,6 +17,9 @@ def cd(dst: str) -> typing.Generator[None, typing.Any, None]: os.chdir(cwd) +root = os.path.dirname(os.path.dirname(__file__)) +os.chdir(root) + with cd('res'): if not os.path.exists('wasi-testsuite'): call('git clone --branch prod/testsuite-base https://github.com/WebAssembly/wasi-testsuite')