Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion invenio_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"""Invenio module to ease the creation and management of applications."""


__version__ = "1.6.0"
__version__ = "1.6.1"

__all__ = ("__version__",)
25 changes: 17 additions & 8 deletions invenio_cli/helpers/rdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,28 @@

import re

from pipfile import Pipfile
from ..helpers.cli_config import CLIConfig


def rdm_version():
"""Return the latest RDM version."""
parsed = Pipfile.load(filename="./Pipfile")
cliConfig = CLIConfig()
if (cliConfig.project_path / "Pipfile").is_file():
depfile = cliConfig.project_path / "Pipfile"
elif (cliConfig.project_path / "pyproject.toml").is_file():
depfile = cliConfig.project_path / "pyproject.toml"

groups = re.search(
r"[0-9]*\.[0-9]*\.[0-9]*",
parsed.data["default"].get("invenio-app-rdm", {}).get("version", ""),
)
# find invenio-app-rdm line in either file
matchline = re.search(r"^.?invenio-app-rdm.*$", depfile.read_text(), re.MULTILINE)

if groups:
return [int(v) for v in groups.group(0).split(".")]
# extract the version number of invenio-app-rdm
if matchline:
match = re.search(
r"[0-9]*\.[0-9]*\.[0-9]*",
matchline.group(0),
)

if match:
return [int(v) for v in match.group(0).split(".")]
else:
return None