mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Check python3 and pip3 versions (#11739)
This commit is contained in:
@@ -50,6 +50,7 @@ class Python extends BaseValidation
|
||||
}
|
||||
|
||||
$this->checkVersion($validator, $version);
|
||||
$this->checkPipVersion($validator, $version);
|
||||
$this->checkExtensions($validator);
|
||||
}
|
||||
|
||||
@@ -60,6 +61,16 @@ class Python extends BaseValidation
|
||||
}
|
||||
}
|
||||
|
||||
private function checkPipVersion(Validator $validator, $version)
|
||||
{
|
||||
preg_match('/\(python ([0-9.]+)\)/', `pip3 --version`, $matches);
|
||||
$pip = $matches[1];
|
||||
$python = implode('.', array_slice(explode('.', $version), 0, 2));
|
||||
if (version_compare($python, $pip, '!=')) {
|
||||
$validator->fail("python3 ($python) and pip3 ($pip) versions do not match. This likely will cause dependencies to be installed for the wrong python version.");
|
||||
}
|
||||
}
|
||||
|
||||
private function checkExtensions(Validator $validator)
|
||||
{
|
||||
$pythonExtensions = '/scripts/check_requirements.py';
|
||||
|
||||
Reference in New Issue
Block a user