Update date in release script. [skip ci] (#8574)

This commit is contained in:
Jiaming Yuan 2022-12-09 23:16:10 +08:00 committed by GitHub
parent 0caf2be684
commit 8824b40961
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@ needed, run CMake .
<major>.<minor>.<patch>-RC1 <major>.<minor>.<patch>-RC1
""" """
import argparse import argparse
import datetime
import os import os
import re import re
import subprocess import subprocess
@ -62,6 +63,13 @@ def rpkg(major: int, minor: int, patch: int) -> None:
description = ( description = (
description[: matched.start(1)] + version + description[matched.end(1) :] description[: matched.start(1)] + version + description[matched.end(1) :]
) )
pattern = r"Date:\ ([0-9]+\-[0-9]+\-[0-9]+)"
today = datetime.date.today()
matched = re.search(pattern, description)
assert matched, "Couldn't find date string in DESCRIPTION."
description = (
description[: matched.start(1)] + str(today) + description[matched.end(1) :]
)
with open(desc_path, "w") as fd: with open(desc_path, "w") as fd:
fd.write(description) fd.write(description)