Fixed check changelog dates

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2022-11-05 19:26:07 +02:00
parent 34a5de1c24
commit f9a0648ffb
5 changed files with 13 additions and 3 deletions

View file

@ -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

View file

@ -22,6 +22,7 @@ Requirements
SQLAlchemy>=1.4.36
PyYAML>=6.0
python-dateutil>=2.8.2
Install
-------

View file

@ -1,3 +1,3 @@
SQLAlchemy>=1.4.36
PyYAML>=6.0
python-dateutil>=2.8.2

View file

@ -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]

View file

@ -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')