summaryrefslogtreecommitdiff
path: root/Build/source/texk
diff options
context:
space:
mode:
authorAndreas Scherer <andreas_tex@freenet.de>2024-06-23 22:47:31 +0000
committerAndreas Scherer <andreas_tex@freenet.de>2024-06-23 22:47:31 +0000
commitf06769e5e15390457a2100d0f6681cfe59bcbe51 (patch)
tree161346fb7fad1e601aad8ac5e6bac5410a4b01d4 /Build/source/texk
parentc00d27a0b74ae764681ee9c43d008d3b2f0b1ecb (diff)
Purge redundancy.
're.sub()' does the right thing: When the 'pattern' doesn't 'match', it simply returns the (unmodified) string. git-svn-id: svn://tug.org/texlive/trunk@71607 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rwxr-xr-xBuild/source/texk/web2c/tests/fix-changefile-lines.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/Build/source/texk/web2c/tests/fix-changefile-lines.py b/Build/source/texk/web2c/tests/fix-changefile-lines.py
index f7878ef33f3..2064724a150 100755
--- a/Build/source/texk/web2c/tests/fix-changefile-lines.py
+++ b/Build/source/texk/web2c/tests/fix-changefile-lines.py
@@ -195,9 +195,7 @@ class ChangeReader:
new_line = "@x"
if opt_handler.part_b or opt_handler.section_b:
- pattern = "\\[\\d+(\\.\\d+)?\\]"
- if re.match(pattern, old_line):
- old_line = re.sub(pattern, "", old_line, 1).strip()
+ old_line = re.sub("\\[\\d+(\\.\\d+)?\\]", "", old_line, 1).strip()
new_line += " ["
if opt_handler.part_b:
new_line += f"{part}"
@@ -208,16 +206,12 @@ class ChangeReader:
new_line += "]"
if opt_handler.line_b:
- pattern = "l\\.\\d+"
- if re.match(pattern, old_line):
- old_line = re.sub(pattern, "", old_line, 1).strip()
+ old_line = re.sub("l\\.\\d+", "", old_line, 1).strip()
new_line += f" l.{line_number}"
if opt_handler.text_b and old_line:
if opt_handler.hyphen_b:
- pattern = "-+"
- if re.match(pattern, old_line):
- old_line = re.sub(pattern, "", old_line, 1).strip()
+ old_line = re.sub("-+", "", old_line, 1).strip()
new_line += " -"
new_line += f" {old_line}"