fix: bazel/emscripten_toolchain/wasm_binary.py command output without mimetype on MacOS. (#682)

Co-authored-by: xulinfeng <xulinfeng@bilibili.com>
This commit is contained in:
Leven
2021-01-27 03:17:30 +08:00
committed by GitHub
parent 6357c6dcab
commit 5fd6f034fe
2 changed files with 7 additions and 3 deletions

View File

@@ -1,9 +1,13 @@
import os
import platform
ROOT_DIR = os.environ["ROOT_DIR"]
EMSCRIPTEN_ROOT = os.environ["EMSCRIPTEN"]
LLVM_ROOT = ROOT_DIR + "/external/emscripten/bin"
EMSCRIPTEN_NATIVE_OPTIMIZER = LLVM_ROOT + "/optimizer"
NODE_JS = ROOT_DIR + "/external/nodejs_linux_amd64/bin/node"
BINARYEN_ROOT = ROOT_DIR + "/external/emscripten"
system = platform.system()
nodejs_binary = "node.exe" if(system =="Windows") else "bin/node"
NODE_JS = ROOT_DIR + "/external/nodejs_{}_amd64/{}".format(system.lower(), nodejs_binary)
BINARYEN_ROOT = ROOT_DIR + "/external/emscripten"

View File

@@ -46,7 +46,7 @@ def main(argv):
stem = basename.split('.')[0]
# Check the type of the input file
mimetype_bytes = subprocess.check_output(['file', '-Lib', FLAGS.archive])
mimetype_bytes = subprocess.check_output(['file', '-Lb', '--mime-type', '--mime-encoding', FLAGS.archive])
mimetype = mimetype_bytes.decode(sys.stdout.encoding)
# If we have a tar, extract all files. If we have just a single file, copy it.