This repository has been archived by the owner on Sep 23, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
quick dependency check script for administrator
- Loading branch information
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
48
control/src/python/workspacecontrol/sbin/test-dependencies.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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." |