|
18 | 18 | import re
|
19 | 19 | import time
|
20 | 20 | import logging
|
21 |
| -import shutil |
22 | 21 | import pprint
|
23 | 22 | from collections import OrderedDict
|
24 | 23 |
|
@@ -2275,21 +2274,17 @@ def remove_trailing_zeros(memfile):
|
2275 | 2274 |
|
2276 | 2275 |
|
2277 | 2276 | def finalize_wasm(temp_files, infile, outfile, memfile, DEBUG):
|
2278 |
| - def debug_copy(src, dst): |
2279 |
| - if DEBUG: |
2280 |
| - shutil.copyfile(src, os.path.join(shared.CANONICAL_TEMP_DIR, dst)) |
2281 |
| - |
2282 | 2277 | basename = shared.unsuffixed(outfile.name)
|
2283 | 2278 | wasm = basename + '.wasm'
|
2284 | 2279 | base_wasm = infile
|
2285 |
| - debug_copy(infile, 'base.wasm') |
| 2280 | + shared.Building.debug_copy(infile, 'base.wasm') |
2286 | 2281 |
|
2287 | 2282 | args = ['--detect-features']
|
2288 | 2283 |
|
2289 | 2284 | write_source_map = shared.Settings.DEBUG_LEVEL >= 4
|
2290 | 2285 | if write_source_map:
|
2291 | 2286 | shared.Building.emit_wasm_source_map(base_wasm, base_wasm + '.map')
|
2292 |
| - debug_copy(base_wasm + '.map', 'base_wasm.map') |
| 2287 | + shared.Building.debug_copy(base_wasm + '.map', 'base_wasm.map') |
2293 | 2288 | args += ['--output-source-map-url=' + shared.Settings.SOURCE_MAP_BASE + os.path.basename(shared.Settings.WASM_BINARY_FILE) + '.map']
|
2294 | 2289 |
|
2295 | 2290 | # tell binaryen to look at the features section, and if there isn't one, to use MVP
|
@@ -2329,8 +2324,8 @@ def debug_copy(src, dst):
|
2329 | 2324 | args=args,
|
2330 | 2325 | stdout=subprocess.PIPE)
|
2331 | 2326 | if write_source_map:
|
2332 |
| - debug_copy(wasm + '.map', 'post_finalize.map') |
2333 |
| - debug_copy(wasm, 'post_finalize.wasm') |
| 2327 | + shared.Building.debug_copy(wasm + '.map', 'post_finalize.map') |
| 2328 | + shared.Building.debug_copy(wasm, 'post_finalize.wasm') |
2334 | 2329 |
|
2335 | 2330 | if not shared.Settings.MEM_INIT_IN_WASM:
|
2336 | 2331 | # we have a separate .mem file. binaryen did not strip any trailing zeros,
|
|
0 commit comments