mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-23 10:05:40 +01:00
Merge pull request #4253 from mstarzyk-mobica/long_url_in_changelog_entry
Allow changelog entries to have URLs exceeding 80 char limit.
This commit is contained in:
commit
9013489177
@ -201,6 +201,8 @@ class ChangeLog:
|
|||||||
# a version that is not yet released. Something like "3.1a" is accepted.
|
# a version that is not yet released. Something like "3.1a" is accepted.
|
||||||
_version_number_re = re.compile(br'[0-9]+\.[0-9A-Za-z.]+')
|
_version_number_re = re.compile(br'[0-9]+\.[0-9A-Za-z.]+')
|
||||||
_incomplete_version_number_re = re.compile(br'.*\.[A-Za-z]')
|
_incomplete_version_number_re = re.compile(br'.*\.[A-Za-z]')
|
||||||
|
_only_url_re = re.compile(br'^\s*\w+://\S+\s*$')
|
||||||
|
_has_url_re = re.compile(br'.*://.*')
|
||||||
|
|
||||||
def add_categories_from_text(self, filename, line_offset,
|
def add_categories_from_text(self, filename, line_offset,
|
||||||
text, allow_unknown_category):
|
text, allow_unknown_category):
|
||||||
@ -219,12 +221,18 @@ class ChangeLog:
|
|||||||
category.name.decode('utf8'))
|
category.name.decode('utf8'))
|
||||||
|
|
||||||
body_split = category.body.splitlines()
|
body_split = category.body.splitlines()
|
||||||
|
|
||||||
for line_number, line in enumerate(body_split, 1):
|
for line_number, line in enumerate(body_split, 1):
|
||||||
if len(line) > MAX_LINE_LENGTH:
|
if not self._only_url_re.match(line) and \
|
||||||
|
len(line) > MAX_LINE_LENGTH:
|
||||||
|
long_url_msg = '. URL exceeding length limit must be alone in its line.' \
|
||||||
|
if self._has_url_re.match(line) else ""
|
||||||
raise InputFormatError(filename,
|
raise InputFormatError(filename,
|
||||||
category.body_line + line_number,
|
category.body_line + line_number,
|
||||||
'Line is longer than allowed: Length {} (Max {})',
|
'Line is longer than allowed: '
|
||||||
len(line), MAX_LINE_LENGTH)
|
'Length {} (Max {}){}',
|
||||||
|
len(line), MAX_LINE_LENGTH,
|
||||||
|
long_url_msg)
|
||||||
|
|
||||||
self.categories[category.name] += category.body
|
self.categories[category.name] += category.body
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user