Skip to content

Commit

Permalink
Fix gen_releasenotes script
Browse files Browse the repository at this point in the history
  • Loading branch information
Limych committed Sep 22, 2020
1 parent 30b5021 commit 9047dad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
15 changes: 8 additions & 7 deletions bin/gen_releasenotes
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import subprocess
from datetime import datetime
from typing import List

from git import Tag
from github import Github, Repository
from github import Github, Repository, Tag
from packaging.version import Version

# http://docs.python.org/2/howto/logging.html#library-config
Expand All @@ -20,7 +19,7 @@ logging.basicConfig(level=logging.CRITICAL)

_LOGGER = logging.getLogger(__name__)

VERSION = "1.1.0"
VERSION = "1.1.1"

ROOT = os.path.dirname(os.path.abspath(f"{__file__}/.."))

Expand All @@ -47,14 +46,16 @@ def get_commits(repo: Repository, since: datetime, until: datetime):
return reversed(list(commits)[:-1])


def get_release_tags(repo: Repository) -> List[Tag]:
def get_release_tags(repo: Repository) -> List[Tag.Tag]:
"""Get list of all release tags from repository."""
tags = list(repo.get_tags())
reg = re.compile(
r"(v|^)?[0-9]+\.[0-9]+\.[0-9]+"
r"^v?[0-9]+\.[0-9]+\.[0-9]+"
r"(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+)?$"
)
return list(filter(lambda tag: re.match(reg, tag.name), tags))
tags = list(filter(lambda tag: re.match(reg, tag.name), list(repo.get_tags())))
tags.sort(key=lambda x: x.name.lstrip("v"), reverse=True)
_LOGGER.debug("Found tags: %s", tags)
return tags


def get_period(repo: Repository, release: str = None) -> List[datetime]:
Expand Down
16 changes: 8 additions & 8 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
-r requirements.txt
black
flake8
mypy
black==20.8b1
flake8~=3.8
mypy==0.782
packaging~=20.4
pre-commit
pre-commit~=2.7
PyGithub==1.53
pylint
pylint-strict-informational
pyupgrade
yamllint
pylint~=2.6
pylint-strict-informational==0.1
pyupgrade~=2.7
yamllint~=1.24

0 comments on commit 9047dad

Please sign in to comment.