mirror of
https://github.com/iio612/DEFENDER.git
synced 2026-02-13 11:14:23 +00:00
install.py and installation.py:
Fix method to check python version
irc.py:
Do not log a user with different nickname, even if the password is correct
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from importlib.util import find_spec
|
||||
from subprocess import check_call, run, CalledProcessError
|
||||
from platform import python_version
|
||||
from platform import python_version, python_version_tuple
|
||||
from sys import exit
|
||||
import os
|
||||
|
||||
@@ -28,14 +28,19 @@ class Install:
|
||||
Returns:
|
||||
bool: True si la version de python est autorisé sinon False
|
||||
"""
|
||||
python_required_version = self.PYTHON_MIN_VERSION.split('.')
|
||||
python_current_version = python_version().split('.')
|
||||
# Current system version
|
||||
sys_major, sys_minor, sys_patch = python_version_tuple()
|
||||
|
||||
if int(python_current_version[0]) < int(python_required_version[0]):
|
||||
# min python version required
|
||||
python_required_version = self.PYTHON_MIN_VERSION.split('.')
|
||||
min_major, min_minor = tuple((python_required_version[0], python_required_version[1]))
|
||||
|
||||
if int(sys_major) < int(min_major):
|
||||
print(f"## Your python version must be greather than or equal to {self.PYTHON_MIN_VERSION} ##")
|
||||
return False
|
||||
elif int(python_current_version[1]) < int(python_required_version[1]):
|
||||
print(f"### Your python version must be greather than or equal to {self.PYTHON_MIN_VERSION} ###")
|
||||
|
||||
elif (int(sys_major) <= int(min_major)) and (int(sys_minor) < int(min_minor)):
|
||||
print(f"## Your python version must be greather than or equal to {self.PYTHON_MIN_VERSION} ##")
|
||||
return False
|
||||
|
||||
print(f"===> Version of python : {python_version()} ==> OK")
|
||||
|
||||
Reference in New Issue
Block a user