From f9a0648ffbc2497a0e35e7ad393e5f929aba39e7 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 5 Nov 2022 19:26:07 +0200 Subject: [PATCH] Fixed check changelog dates Signed-off-by: Dimitris Zlatanidis --- ChangeLog.txt | 4 ++++ README.rst | 1 + requirements.txt | 2 +- setup.cfg | 1 + slpkg/check_updates.py | 8 ++++++-- 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 456376db..e1b5d529 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,7 @@ +4.2.7 - 05/11/2022 +Added: +- python3-dateutil dependency to fix check ChangeLogs dates + 4.2.6 - 03/11/2022 Fixed: - Check for the file ChangeLog.txt diff --git a/README.rst b/README.rst index 6aaca32a..6e16347e 100644 --- a/README.rst +++ b/README.rst @@ -22,6 +22,7 @@ Requirements SQLAlchemy>=1.4.36 PyYAML>=6.0 + python-dateutil>=2.8.2 Install ------- diff --git a/requirements.txt b/requirements.txt index 5db7bd95..8bd19d54 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ SQLAlchemy>=1.4.36 PyYAML>=6.0 - +python-dateutil>=2.8.2 diff --git a/setup.cfg b/setup.cfg index 166f87e1..3e4486c6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -40,6 +40,7 @@ python_requires = >=3.7 install_requires = SQLAlchemy >= 1.4.36 PyYAML >= 6.0 + python-dateutil >= 2.8.2 include_package_data = True [options.packages.find] diff --git a/slpkg/check_updates.py b/slpkg/check_updates.py index 1b267544..b87213f7 100644 --- a/slpkg/check_updates.py +++ b/slpkg/check_updates.py @@ -4,6 +4,7 @@ import os import urllib3 +from dateutil import parser from dataclasses import dataclass from slpkg.configs import Configs @@ -22,13 +23,16 @@ class CheckUpdates: if os.path.isfile(local_chg_txt): with open(local_chg_txt, 'r', encoding='utf-8') as f: - local_date = f.readline().strip() + ldate = f.readline().strip() http = urllib3.PoolManager() repo = http.request( 'GET', f'{self.sbo_repo_url}/{self.chglog_txt}') - repo_date = repo.data.decode().split('\\')[0][:len(local_date)].strip() + rdate = repo.data.decode().split('\\')[0][:len(ldate)].strip() + + repo_date = parser.parse(rdate) + local_date = parser.parse(ldate) if repo_date > local_date: print('\nThere are new updates available.\n')