Navigation Menu

Skip to content
This repository has been archived by the owner on Sep 23, 2020. It is now read-only.

Commit

Permalink
quick dependency check script for administrator
Browse files Browse the repository at this point in the history
  • Loading branch information
timf committed Dec 1, 2009
1 parent f692cee commit 289184e
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
21 changes: 21 additions & 0 deletions control/sbin/test-dependencies.sh
@@ -0,0 +1,21 @@
#!/bin/bash

# -----------------------------------------------------------------------------

HELP_MESSAGE="This program (with no arguments) checks on basic prerequisites for running workspace-control, such as the libvirt Python bindings."
if [ "X$1" == "X-h" ] || [ "X$1" == "X-help" ] || [ "X$1" == "X--help" ] || [ "X$1" == "Xhelp" ]; then
echo -e "$HELP_MESSAGE"
exit 1
fi

# -----------------------------------------------------------------------------

NIMBUS_CONTROL_DIR_REL="`dirname $0`/.."
NIMBUS_CONTROL_DIR=`cd $NIMBUS_CONTROL_DIR_REL; pwd`

NIMBUS_CONTROL_PYLIB="$NIMBUS_CONTROL_DIR/lib/python"
NIMBUS_CONTROL_PYSRC="$NIMBUS_CONTROL_DIR/src/python"
PYTHONPATH="$NIMBUS_CONTROL_PYSRC:$NIMBUS_CONTROL_PYLIB:$PYTHONPATH"
export PYTHONPATH

/usr/bin/env python $NIMBUS_CONTROL_PYSRC/workspacecontrol/sbin/test-dependencies.py
48 changes: 48 additions & 0 deletions control/src/python/workspacecontrol/sbin/test-dependencies.py
@@ -0,0 +1,48 @@
#!/usr/bin/env python

import sys

ERR = "** PROBLEM: "

problem_count = 0

version = sys.version
print "Python %s" % version.replace("\n", " | ")

curr = sys.version_info
required = (2,5)

if curr[0] < required[0]:
print >>sys.stderr, "\n%sThe Python version looks too low, 2.5 is required." % ERR
problem_count += 1
elif curr[1] < required[1]:
print >>sys.stderr, "\n%sThe Python version looks too low, 2.5 is required." % ERR
problem_count += 1

try:
import zope.interface
except ImportError:
print >>sys.stderr, "\n%sCannot locate the zope.interface package." % ERR
print >>sys.stderr, "\nThis should be included in the workspace-control lib/ directory. That directory should be loaded as part of the program's PYTHONPATH."
problem_count += 1

try:
import libvirt2
except:
print >>sys.stderr, "\n%sCannot locate the libvirt Python bindings package." % ERR
print >>sys.stderr, "\nOn some Linux distributions, this is only included when you install libvirt\n when you have previously installed the 'python-dev' package."
print >>sys.stderr, "\nSee your distribution documentation."
problem_count += 1


try:
from workspacecontrol.api.exceptions import *
except:
print >>sys.stderr, "\n%sCannot locate the 'workspacecontrol' Python package." % ERR
print >>sys.stderr, "\nIf you installed this from the directions, please contact the mailing list.."
problem_count += 1

if problem_count:
sys.exit(1)

print "\nOK, looks like the Python dependencies are set up."

0 comments on commit 289184e

Please sign in to comment.