Skip to content

Commit

Permalink
Hotfix to allow the update check to run with new structures.
Browse files Browse the repository at this point in the history
  • Loading branch information
malte-storm committed Jan 7, 2025
1 parent eac51ca commit 416bb8d
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 3 deletions.
16 changes: 13 additions & 3 deletions formatter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of pydidas.
#
# Copyright 2024, Helmholtz-Zentrum Hereon
# Copyright 2024 - 2025, Helmholtz-Zentrum Hereon
# SPDX-License-Identifier: GPL-3.0-only
#
# pydidas is free software: you can redistribute it and/or modify
Expand All @@ -18,7 +18,7 @@
"""Formatting script to avoid manually calling formatting modules."""

__author__ = "Malte Storm"
__copyright__ = "Copyright 2024, Helmholtz-Zentrum Hereon"
__copyright__ = "Copyright 2024 - 2025, Helmholtz-Zentrum Hereon"
__license__ = "GPL-3.0-only"
__maintainer__ = "Malte Storm"
__status__ = "Production"
Expand Down Expand Up @@ -187,17 +187,27 @@ def check_version_tags(directory: Optional[Path] = None):
_line = [_line for _line in f.readlines() if _line.startswith("__version__")]
_version = _line[0].split("=")[1].strip().strip('"')
_timed_print("Starting version tag check.", new_lines=1)
# check the CHANGELOG:
with open(_directory.joinpath("CHANGELOG.rst"), "r") as f:
_changelog_lines = f.readlines()
_changelog_okay = f"v{_version}" in [_line.strip() for _line in _changelog_lines]
if not _changelog_okay:
_timed_print("The CHANGELOG does not include a current version tag.")
# check the CITATION.cff:
with open(_directory.joinpath("CITATION.cff"), "r") as f:
_lines = [_line.strip() for _line in f.readlines()]
_citation_okay = f"version: {_version}" in _lines
if not _citation_okay:
_timed_print("The CITATION.cff does not include the latest version tag.")
if not (_citation_okay and _changelog_okay):
# check the pydidas/version.py file which is required for consistency with old
# updaters:
with open(_directory.joinpath("pydidas", "version.py"), "r") as f:
_line = [_line for _line in f.readlines() if _line.startswith("__version__")]
_updater_version = _line[0].split("=")[1].strip().strip('"')
_updater_version_okay = _updater_version == _version
if not _updater_version_okay:
_timed_print("The pydidas/version.py differs from the src version.")
if not (_citation_okay and _changelog_okay and _updater_version_okay):
sys.exit(1)
_timed_print("Version tag check sucessfully concluded.")

Expand Down
32 changes: 32 additions & 0 deletions pydidas/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This file is part of pydidas.
#
# Copyright 2024 - 2025, Helmholtz-Zentrum Hereon
# SPDX-License-Identifier: GPL-3.0-only
#
# pydidas is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# Pydidas is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Pydidas. If not, see <http://www.gnu.org/licenses/>.


"""
Module with the pydidas Version number.
"""

__author__ = "Malte Storm"
__copyright__ = "Copyright 2024 - 2025, Helmholtz-Zentrum Hereon"
__license__ = "GPL-3.0-only"
__version__ = "24.09.19"
__maintainer__ = "Malte Storm"
__status__ = "Production"


version = __version__
VERSION = __version__

0 comments on commit 416bb8d

Please sign in to comment.