librenms/scripts/check_requirements.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
431 B
Python
Raw Permalink Normal View History

#! /usr/bin/env python3
import pkg_resources
import sys
from pkg_resources import DistributionNotFound, VersionConflict
args = sys.argv
# verbose flag
2021-03-28 16:02:33 +00:00
verbose = "-v" in args
2021-03-28 16:02:33 +00:00
requirements = ["PyMySQL"]
try:
pkg_resources.require(requirements)
except DistributionNotFound as req:
if verbose:
print(req)
sys.exit(1)
except VersionConflict as req:
if verbose:
print(req)
sys.exit(2)
sys.exit(0)