
The methodology used to generate this CL is documented in https://crbug.com/1098010#c34. An earlier version of this CL, https://crrev.com/c/3879808, was reverted due to an issue that was resolved with https://crrev.com/c/3881211. No-Try: true Bug: 1098010 Change-Id: I91174ff0a9dd8b6dee79e6cba8209b614ce2b712 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3884220 Reviewed-by: Mark Mentovai <mark@chromium.org> Auto-Submit: Avi Drissman <avi@chromium.org> Owners-Override: Avi Drissman <avi@chromium.org> Commit-Queue: Mark Mentovai <mark@chromium.org> Cr-Commit-Position: refs/heads/main@{#1044745}
41 lines
911 B
Python
Executable File
41 lines
911 B
Python
Executable File
#!/usr/bin/env python
|
|
# Copyright 2016 The Chromium Authors
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
"""Delete a file.
|
|
|
|
This module works much like the rm posix command.
|
|
"""
|
|
|
|
from __future__ import print_function
|
|
|
|
import argparse
|
|
import os
|
|
import sys
|
|
|
|
|
|
def Main():
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('files', nargs='+')
|
|
parser.add_argument('-f', '--force', action='store_true',
|
|
help="don't err on missing")
|
|
parser.add_argument('--stamp', required=True, help='touch this file')
|
|
args = parser.parse_args()
|
|
for f in args.files:
|
|
try:
|
|
os.remove(f)
|
|
except OSError:
|
|
if not args.force:
|
|
print("'%s' does not exist" % f, file=sys.stderr)
|
|
return 1
|
|
|
|
with open(args.stamp, 'w'):
|
|
os.utime(args.stamp, None)
|
|
|
|
return 0
|
|
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(Main())
|