Skip to content

Commit e4739b9

Browse files
committed
tools/gitlog2changelog.py.in: adapt to Python 3.13 deprecation of positional "maxsplit" parameter to re.split()
Signed-off-by: Jim Klimov <jimklimov@gmail.com>
1 parent bb81491 commit e4739b9

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

tools/gitlog2changelog.py.in

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,11 @@ for line in fin:
151151
# Match the author line and extract the part we want
152152
# (Don't use startswith to allow Author override inside commit message.)
153153
elif "Author:" in line:
154-
authorList = re.split(": ", line, 1)
154+
if sys.version_info >= (3, 13, ):
155+
authorList = re.split(": ", line, maxsplit=1)
156+
else:
157+
authorList = re.split(": ", line, 1)
158+
155159
try:
156160
author = authorList[1]
157161
author = author[0 : len(author) - fin_chop]
@@ -169,7 +173,11 @@ for line in fin:
169173

170174
# Match the date line
171175
elif line.startswith("Date:"):
172-
dateList = re.split(": ", line, 1)
176+
if sys.version_info >= (3, 13, ):
177+
dateList = re.split(": ", line, maxsplit=1)
178+
else:
179+
dateList = re.split(": ", line, 1)
180+
173181
try:
174182
date = dateList[1]
175183
date = date[0 : len(date) - fin_chop]
@@ -213,7 +221,11 @@ for line in fin:
213221
continue
214222
# Collect the files for this commit. FIXME: Still need to add +/- to files
215223
elif authorFound and dateFound and messageFound:
216-
fileList = re.split(r' \| ', line, 2)
224+
if sys.version_info >= (3, 13, ):
225+
fileList = re.split(r' \| ', line, maxsplit=2)
226+
else:
227+
fileList = re.split(r' \| ', line, 2)
228+
217229
if len(fileList) > 1:
218230
if len(files) > 0:
219231
files = files + ", " + fileList[0].strip()

0 commit comments

Comments
 (0)