diff options
author | George Kraft <george.kraft@calxeda.com> | 2012-09-13 13:33:21 -0500 |
---|---|---|
committer | George Kraft <george.kraft@calxeda.com> | 2012-09-13 13:33:21 -0500 |
commit | 8222f5644d5cb90ca590612a36465c7cbf8ee3d0 (patch) | |
tree | 4245b46228be6a03261befc4de436bc6679b6ee3 | |
parent | 93ddbfb59cf1a14142e868e94c17eb92bb8e5c28 (diff) | |
download | cxmanage-8222f5644d5cb90ca590612a36465c7cbf8ee3d0.tar.gz |
cxmanage: Add a runtime check for pyipmi version
In most cases this isn't really useful -- pip and/or setup.py
should take care of it. Oh well.
-rwxr-xr-x | scripts/cxmanage | 20 | ||||
-rwxr-xr-x | setup.py | 2 |
2 files changed, 20 insertions, 2 deletions
diff --git a/scripts/cxmanage b/scripts/cxmanage index 778d6ea..7a1f51c 100755 --- a/scripts/cxmanage +++ b/scripts/cxmanage @@ -38,6 +38,7 @@ import os import pkgutil import sys import subprocess +import pkg_resources from cxmanage.controller import Controller @@ -281,6 +282,21 @@ def main(): def check_versions(): """Check versions of dependencies""" + # Check pyipmi version + required_pyipmi_version = '0.3.0' + try: + pyipmi_version = pkg_resources.require('pyipmi')[0].version + if pyipmi_version != required_pyipmi_version: + print 'ERROR: cxmanage requires pyipmi version %s'\ + % required_pyipmi_version + print 'Current pyipmi version is %s' % pyipmi_version + sys.exit(1) + except pkg_resources.DistributionNotFound: + print 'ERROR: cxmanage requires pyipmi version %s'\ + % required_pyipmi_version + print 'No existing version was found.' + sys.exit(1) + # Check ipmitool version if 'IPMITOOL_PATH' in os.environ: args = [os.environ['IPMITOOL_PATH'], '-V'] @@ -288,8 +304,8 @@ def check_versions(): args = ['ipmitool', '-V'] ipmitool_version = subprocess.check_output(args).split()[2] if not '-cx' in ipmitool_version: - print ('ERROR: cxmanage is not compatible with IPMItool version %s\n' - % ipmitool_version) + print 'ERROR: cxmanage is not compatible with IPMItool version %s\n'\ + % ipmitool_version print 'Please make sure a Calxeda extended version of IPMItool is available' print 'in your PATH, or point to one with the --ipmipath argument.' sys.exit(1) @@ -38,6 +38,8 @@ setup( scripts=['scripts/cxmanage', 'scripts/cxpackage'], package_data={'cxmanage': ['data/cids', 'data/registers']}, description='Calxeda Management Utility', + # NOTE: As of right now, the pyipmi version requirement needs to be updated + # in the scripts/cxmanage check_versions() function as well. install_requires=['tftpy', 'pyipmi>=0.3.0', 'argparse'], classifiers=[ 'License :: OSI Approved :: BSD License', |