mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 21:25:38 +01:00
Actually remove files
Minor rework of how files are removed. Actually do remove the files (earlier I accidentally committed a debug version with removal commented out).
This commit is contained in:
parent
974232f045
commit
5e39c9e94f
@ -172,10 +172,9 @@ class ChangeLog:
|
|||||||
for line in self.trailer:
|
for line in self.trailer:
|
||||||
out.write(line)
|
out.write(line)
|
||||||
|
|
||||||
def finish_output(files_to_remove, changelog, output_file):
|
def finish_output(changelog, output_file):
|
||||||
"""Write the changelog to the output file.
|
"""Write the changelog to the output file.
|
||||||
|
|
||||||
Remove the specified input files.
|
|
||||||
"""
|
"""
|
||||||
if os.path.exists(output_file) and not os.path.isfile(output_file):
|
if os.path.exists(output_file) and not os.path.isfile(output_file):
|
||||||
# The output is a non-regular file (e.g. pipe). Write to it directly.
|
# The output is a non-regular file (e.g. pipe). Write to it directly.
|
||||||
@ -185,12 +184,13 @@ def finish_output(files_to_remove, changelog, output_file):
|
|||||||
# then move it into place atomically.
|
# then move it into place atomically.
|
||||||
output_temp = output_file + '.tmp'
|
output_temp = output_file + '.tmp'
|
||||||
changelog.write(output_temp)
|
changelog.write(output_temp)
|
||||||
for filename in files_to_remove:
|
|
||||||
sys.stderr.write('Removing ' + filename + '\n')
|
|
||||||
#os.remove(filename)
|
|
||||||
if output_temp != output_file:
|
if output_temp != output_file:
|
||||||
os.rename(output_temp, output_file)
|
os.rename(output_temp, output_file)
|
||||||
|
|
||||||
|
def remove_merged_entries(files_to_remove):
|
||||||
|
for filename in files_to_remove:
|
||||||
|
os.remove(filename)
|
||||||
|
|
||||||
def merge_entries(options):
|
def merge_entries(options):
|
||||||
"""Merge changelog entries into the changelog file.
|
"""Merge changelog entries into the changelog file.
|
||||||
|
|
||||||
@ -208,8 +208,9 @@ def merge_entries(options):
|
|||||||
for filename in files_to_merge:
|
for filename in files_to_merge:
|
||||||
with open(filename, 'rb') as input_file:
|
with open(filename, 'rb') as input_file:
|
||||||
changelog.add_file(input_file)
|
changelog.add_file(input_file)
|
||||||
files_to_remove = [] if options.keep_entries else files_to_merge
|
finish_output(changelog, options.output)
|
||||||
finish_output(files_to_remove, changelog, options.output)
|
if not options.keep_entries:
|
||||||
|
remove_merged_entries(files_to_merge)
|
||||||
|
|
||||||
def set_defaults(options):
|
def set_defaults(options):
|
||||||
"""Add default values for missing options."""
|
"""Add default values for missing options."""
|
||||||
|
Loading…
Reference in New Issue
Block a user