summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kraft <george.kraft@calxeda.com>2013-11-12 03:41:28 -0600
committerGeorge Kraft <george.kraft@calxeda.com>2013-11-12 03:41:28 -0600
commitb6bbd565b2f4672ed0a71dc9972635535bfb68f5 (patch)
treefb98ea6f15afec4697439ea3b1ea26f43a588069
parentee5d497e3fdde077b721279375e729d278c8c536 (diff)
downloadcxmanage-b6bbd565b2f4672ed0a71dc9972635535bfb68f5.tar.gz
CXMAN-254: Remove pkg_resources.require usage in cxmanage script
Still using pkg_resources.parse_version, that's ok for now.
-rwxr-xr-xscripts/cxmanage24
1 files changed, 6 insertions, 18 deletions
diff --git a/scripts/cxmanage b/scripts/cxmanage
index 3e6f8b8..875afb7 100755
--- a/scripts/cxmanage
+++ b/scripts/cxmanage
@@ -36,6 +36,8 @@ import pkg_resources
import subprocess
import sys
+import pyipmi
+import cxmanage_api
from cxmanage_api.cli.commands.power import power_command, \
power_status_command, power_policy_command, power_policy_status_command
from cxmanage_api.cli.commands.mc import mcreset_command
@@ -335,29 +337,15 @@ def validate_args(args):
sys.exit('Invalid argument --version when supplied with --skip-simg')
-def print_version():
- """ Print the current version of cxmanage """
- version = pkg_resources.require('cxmanage')[0].version
- print "cxmanage version %s" % version
-
-
def check_versions():
"""Check versions of dependencies"""
# Check pyipmi version
- try:
- pkg_resources.require('pyipmi>=%s' % PYIPMI_VERSION)
- except pkg_resources.DistributionNotFound:
- print 'ERROR: cxmanage requires pyipmi version %s'\
- % PYIPMI_VERSION
- print 'No existing version was found.'
- sys.exit(1)
- except pkg_resources.VersionConflict:
- version = pkg_resources.require('pyipmi')[0].version
+ if (pkg_resources.parse_version(pyipmi.__version__) <
+ pkg_resources.parse_version(PYIPMI_VERSION)):
print 'ERROR: cxmanage requires pyipmi version %s' % PYIPMI_VERSION
- print 'Current pyipmi version is %s' % version
+ print 'Current pyipmi version is %s' % pyipmi.__version__
sys.exit(1)
-
# Check ipmitool version
if 'IPMITOOL_PATH' in os.environ:
args = [os.environ['IPMITOOL_PATH'], '-V']
@@ -384,7 +372,7 @@ def main():
"""Get args and go"""
for arg in sys.argv[1:]:
if arg in ['-V', '--version']:
- print_version()
+ print "cxmanage version %s" % cxmanage_api.__version__
sys.exit(0)
elif arg[0] != '-':
break