mirror of
https://github.com/cuberite/polarssl.git
synced 2025-09-30 17:09:41 -04:00
Merge pull request #8289 from daverodgman/check-changelog-exts
Check changelog extensions
This commit is contained in:
commit
0d315378bf
@ -60,6 +60,11 @@ class LostContent(Exception):
|
|||||||
message = ('Lost content from {}: "{}"'.format(filename, line))
|
message = ('Lost content from {}: "{}"'.format(filename, line))
|
||||||
super().__init__(message)
|
super().__init__(message)
|
||||||
|
|
||||||
|
class FilePathError(Exception):
|
||||||
|
def __init__(self, filenames):
|
||||||
|
message = ('Changelog filenames do not end with .txt: {}'.format(", ".join(filenames)))
|
||||||
|
super().__init__(message)
|
||||||
|
|
||||||
# The category names we use in the changelog.
|
# The category names we use in the changelog.
|
||||||
# If you edit this, update ChangeLog.d/README.md.
|
# If you edit this, update ChangeLog.d/README.md.
|
||||||
STANDARD_CATEGORIES = (
|
STANDARD_CATEGORIES = (
|
||||||
@ -443,8 +448,21 @@ def list_files_to_merge(options):
|
|||||||
"""List the entry files to merge, oldest first.
|
"""List the entry files to merge, oldest first.
|
||||||
|
|
||||||
"Oldest" is defined by `EntryFileSortKey`.
|
"Oldest" is defined by `EntryFileSortKey`.
|
||||||
|
|
||||||
|
Also check for required .txt extension
|
||||||
"""
|
"""
|
||||||
files_to_merge = glob.glob(os.path.join(options.dir, '*.txt'))
|
files_to_merge = glob.glob(os.path.join(options.dir, '*'))
|
||||||
|
|
||||||
|
# Ignore 00README.md
|
||||||
|
readme = os.path.join(options.dir, "00README.md")
|
||||||
|
if readme in files_to_merge:
|
||||||
|
files_to_merge.remove(readme)
|
||||||
|
|
||||||
|
# Identify files without the required .txt extension
|
||||||
|
bad_files = [x for x in files_to_merge if not x.endswith(".txt")]
|
||||||
|
if bad_files:
|
||||||
|
raise FilePathError(bad_files)
|
||||||
|
|
||||||
files_to_merge.sort(key=EntryFileSortKey)
|
files_to_merge.sort(key=EntryFileSortKey)
|
||||||
return files_to_merge
|
return files_to_merge
|
||||||
|
|
||||||
@ -452,6 +470,7 @@ def merge_entries(options):
|
|||||||
"""Merge changelog entries into the changelog file.
|
"""Merge changelog entries into the changelog file.
|
||||||
|
|
||||||
Read the changelog file from options.input.
|
Read the changelog file from options.input.
|
||||||
|
Check that all entries have a .txt extension
|
||||||
Read entries to merge from the directory options.dir.
|
Read entries to merge from the directory options.dir.
|
||||||
Write the new changelog to options.output.
|
Write the new changelog to options.output.
|
||||||
Remove the merged entries if options.keep_entries is false.
|
Remove the merged entries if options.keep_entries is false.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user