Skip to content

Commit

Permalink
v2.4.10
Browse files Browse the repository at this point in the history
  • Loading branch information
dvershinin committed Jan 24, 2023
1 parent 60072b9 commit e36a673
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog
All notable changes to this project will be documented in this file.

## [2.4.10] - 2023-01-24
### Fixed
* Fatal failure regression from release 2.4.9 on some packaging library versions
* More intelligent search in GitLab tags

## [2.4.9] - 2023-01-22
### Added
* New `--even` switch to target software that uses odd/even versioning where even is stable
Expand Down
9 changes: 6 additions & 3 deletions lastversion/GitLabRepoSession.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import os
from datetime import timedelta

from dateutil import parser

Expand Down Expand Up @@ -39,18 +40,20 @@ def get_latest(self, pre_ok=False, major=None):
if r.status_code == 200:
for t in r.json():
tag = t['name']
tag_date = parser.parse(t['commit']['created_at'])
version = self.sanitize_version(tag, pre_ok, major)
if not version:
continue
if ret and tag_date + timedelta(days=365) < ret['tag_date']:
log.info('The version {} is newer, but is too old!'.format(version))
break
if not ret or ret and version > ret['version']:
log.info("Setting version as current selection: {}.".format(version))
ret = t
ret['tag_name'] = tag
ret['tag_date'] = parser.parse(t['commit']['created_at'])
ret['tag_date'] = tag_date
ret['version'] = version
ret['type'] = 'tag'
# stop on first tag, because gitlab is good (c)
break
return ret

def release_download_url(self, release, shorter=False):
Expand Down
17 changes: 16 additions & 1 deletion lastversion/Version.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,25 @@ def local(self):
return ".".join(str(x) for x in self._version.local)
return None

@property
def major(self):
# type: () -> int
return self.release[0] if len(self.release) >= 1 else 0

@property
def minor(self):
# type: () -> int
return self.release[1] if len(self.release) >= 2 else 0

@property
def micro(self):
# type: () -> int
return self.release[2] if len(self.release) >= 3 else 0

@property
def is_prerelease(self):
# type: () -> bool
if self.micro and self.micro >= 90:
if self.micro >= 90:
return True
return self.dev is not None or self.pre is not None

Expand Down
2 changes: 1 addition & 1 deletion lastversion/__about__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = '2.4.9'
__version__ = '2.4.10'
__self__ = "dvershinin/lastversion"

0 comments on commit e36a673

Please sign in to comment.