mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* add python fixes * re-order python requirements so most important deps show first. * Only check dependencies if we are running as the poller user
30 lines
693 B
Python
Executable File
30 lines
693 B
Python
Executable File
#! /usr/bin/env python3
|
|
import os
|
|
import sys
|
|
import pkg_resources
|
|
from pkg_resources import DistributionNotFound, VersionConflict
|
|
|
|
args = sys.argv
|
|
|
|
# verbose flag
|
|
verbose = '-v' in args
|
|
|
|
target = os.path.realpath(os.path.dirname(__file__) + '/../requirements.txt')
|
|
|
|
with open(target, 'r') as file:
|
|
requirements = file.read().rstrip().split("\n")
|
|
requirements.reverse() # reverse so the most important ones show first
|
|
try:
|
|
pkg_resources.require(requirements)
|
|
except DistributionNotFound as req:
|
|
if verbose:
|
|
print(req)
|
|
exit(1)
|
|
except VersionConflict as req:
|
|
if verbose:
|
|
print(req)
|
|
exit(2)
|
|
exit(0)
|
|
|
|
exit(3)
|