Add gitleaks patch support
This commit is contained in:
parent
e660b4676d
commit
f55569356f
@ -43,6 +43,16 @@ def get_installed_version():
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def compare_versions(v1, v2):
|
||||
def parse(v):
|
||||
return [int(part) for part in v.split(".")]
|
||||
v1_parts = parse(v1)
|
||||
v2_parts = parse(v2)
|
||||
length = max(len(v1_parts), len(v2_parts))
|
||||
v1_parts += [0] * (length - len(v1_parts))
|
||||
v2_parts += [0] * (length - len(v2_parts))
|
||||
return v1_parts >= v2_parts
|
||||
|
||||
def get_platform_and_arch():
|
||||
import platform
|
||||
system = platform.system().lower()
|
||||
@ -85,10 +95,11 @@ def install_gitleaks(version, force):
|
||||
current_version = get_installed_version()
|
||||
|
||||
if installed and not force:
|
||||
if current_version == version:
|
||||
if compare_versions(current_version, version):
|
||||
print(f"Gitleaks {current_version} is already installed and is >= {version}. Skipping install.")
|
||||
return
|
||||
else:
|
||||
print(f"Gitleaks {current_version} is installed, but version {version} is required.")
|
||||
print(f"Gitleaks {current_version} is installed, but version >= {version} is required.")
|
||||
print(" Use --force to reinstall.")
|
||||
return
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user