Dynamically update the copyright year

This commit is contained in:
Martin Prokoph
2024-12-26 12:44:25 +01:00
parent 76471d1adf
commit e6ebe7ac66
3 changed files with 2 additions and 2 deletions

Binary file not shown.

View File

@@ -361,7 +361,7 @@ def writeMetadata(args):
if isinstance(edition, list): edition = " ".join(args.edition) if isinstance(edition, list): edition = " ".join(args.edition)
with open("./input/pack.mcmeta") as infile, open("pack.mcmeta", "w") as outfile: with open("./input/pack.mcmeta") as infile, open("pack.mcmeta", "w") as outfile:
for line in infile: for line in infile:
line = line.replace("${version}", args.version).replace("${edition}", edition) line = line.replace("${version}", args.version).replace("${edition}", edition).replace("${year}", str(time.localtime().tm_year))
outfile.write(line) outfile.write(line)
# See https://stackoverflow.com/a/1855118 # See https://stackoverflow.com/a/1855118

View File

@@ -2,6 +2,6 @@
"pack": { "pack": {
"pack_format": 15, "pack_format": 15,
"supported_formats": [15, 99], "supported_formats": [15, 99],
"description": "§2Version ${version} §a${edition}\n§e©Motschen 2024 | MIT Licence" "description": "§2Version ${version} §a${edition}\n§e©Motschen ${year} | MIT Licence"
} }
} }