mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Python3 Module Dependency Check (#11544)
* Python3 Modul Dependency Check * code climate * binary existance check * move Python Modul Version Check * . * adding verbose argument * args parser nicement * enhance Validator for detailed approvements * Update Python.php * Update check_requirements.py * python version to Version class use Process Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
namespace LibreNMS\Util;
|
||||
|
||||
use LibreNMS\DB\Eloquent;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
class Version
|
||||
{
|
||||
@@ -88,4 +89,16 @@ class Version
|
||||
? rtrim(shell_exec("git show --pretty='%ct' -s HEAD"))
|
||||
: '';
|
||||
}
|
||||
|
||||
public static function python()
|
||||
{
|
||||
$proc = new Process(['python3', '--version']);
|
||||
$proc->run();
|
||||
|
||||
if ($proc->getExitCode() !== 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return explode(' ', rtrim($proc->getOutput()), 2)[1] ?? null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user