Skip to content

Commit

Permalink
update scripts/version-set.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ilius committed Dec 15, 2024
1 parent fb9d353 commit 1443e05
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion _license-dialog
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PyGlossary - A tool for converting dictionary files
Copyright © 2008-2024 Saeed Rasooli
This program is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation;
License as published by the Free Software Foundation;
either version 3 of the License, or (at your option) any
later version.

Expand Down
11 changes: 11 additions & 0 deletions scripts/version-set.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
from datetime import datetime
from os.path import abspath, dirname, join

from packaging.version import parse
Expand All @@ -15,6 +17,15 @@ def main():
replaceVar(join(rootDir, "setup.py"), "VERSION", versionQuoted)
replaceVar(join(rootDir, "pyproject.toml"), "version", versionQuoted)

# update copyright year number
for fname in ("about", "_license-dialog"):
with open(fname, encoding="utf-8") as file:
text = file.read()
pos = text.find("© ")
text = text[: pos + 7] + str(datetime.now().year) + text[pos + 11 :]
with open(fname, "w", encoding="utf-8") as file:
file.write(text)


def replaceVar(fname: str, name: str, value: str) -> None:
prefix = name + " = "
Expand Down

0 comments on commit 1443e05

Please sign in to comment.