Skip to content

Commit

Permalink
Use AtomicOutput in process_native_prebuilt.py
Browse files Browse the repository at this point in the history
eu-strip's output keeps mode from source file which might not be
writable thus it fails to override its output on the next run.
AtomicOutput fixes the issue. Also it is good practice anyways.

Change-Id: I7b3574dac55cc44e6d0572704f26e42969331ddc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2458786
Auto-Submit: Mohamed Heikal <mheikal@chromium.org>
Commit-Queue: Sam Maier <smaier@chromium.org>
Reviewed-by: Sam Maier <smaier@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814841}
  • Loading branch information
m0hamed authored and Commit Bot committed Oct 7, 2020
1 parent f357279 commit b9eb1a9
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions build/android/gyp/process_native_prebuilt.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@ def main(args):
parser.add_argument('--unstripped-output-path', required=True, help='')
options = parser.parse_args(args)

cmd = [
options.strip_path,
options.input_path,
'-o',
options.stripped_output_path,
]

build_utils.CheckOutput(cmd)
# eu-strip's output keeps mode from source file which might not be writable
# thus it fails to override its output on the next run. AtomicOutput fixes
# the issue.
with build_utils.AtomicOutput(options.stripped_output_path) as out:
cmd = [
options.strip_path,
options.input_path,
'-o',
out.name,
]
build_utils.CheckOutput(cmd)
shutil.copyfile(options.input_path, options.unstripped_output_path)


Expand Down

0 comments on commit b9eb1a9

Please sign in to comment.