aboutsummaryrefslogtreecommitdiffstats
path: root/libbe
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2008-11-13 13:10:13 -0500
committerW. Trevor King <wking@drexel.edu>2008-11-13 13:10:13 -0500
commitc5d7551e6a6e98bb6da7c7d11360224edfda2f14 (patch)
tree212ac0f61c99e1290a131ca0655a31b5dbfb0eb6 /libbe
parent9055757a1b30c55798173f2454de8d4fa0676d40 (diff)
downloadbugseverywhere-c5d7551e6a6e98bb6da7c7d11360224edfda2f14.tar.gz
* use python2.4/2.5 compatible import of ElementTree
* catch Popen() calls to missing VCS binaries * test.py should only test installed backends
Diffstat (limited to 'libbe')
-rw-r--r--libbe/arch.py6
-rw-r--r--libbe/rcs.py16
-rw-r--r--libbe/restconvert.py5
3 files changed, 19 insertions, 8 deletions
diff --git a/libbe/arch.py b/libbe/arch.py
index 624aea3..038325a 100644
--- a/libbe/arch.py
+++ b/libbe/arch.py
@@ -24,7 +24,11 @@ if client is None:
config.set_val("arch_client", client)
def invoke(args):
- q = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE)
+ try :
+ q = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE)
+ except OSError, e :
+ strerror = "%s\nwhile executing %s" % (e.args[1], args)
+ raise Exception("Command failed: %s" % strerror)
output = q.stdout.read()
error = q.stderr.read()
status = q.wait()
diff --git a/libbe/rcs.py b/libbe/rcs.py
index 77d6c9a..4487fba 100644
--- a/libbe/rcs.py
+++ b/libbe/rcs.py
@@ -59,12 +59,16 @@ class CommandError(Exception):
self.status = status
def invoke(args, expect=(0,), cwd=None):
- if sys.platform != "win32":
- q = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE, cwd=cwd)
- else:
- # win32 don't have os.execvp() so have to run command in a shell
- q = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True,
- cwd=cwd)
+ try :
+ if sys.platform != "win32":
+ q = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE, cwd=cwd)
+ else:
+ # win32 don't have os.execvp() so have to run command in a shell
+ q = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True,
+ cwd=cwd)
+ except OSError, e :
+ strerror = "%s\nwhile executing %s" % (e.args[1], args)
+ raise CommandError(strerror, e.args[0])
output, error = q.communicate()
status = q.wait()
if status not in expect:
diff --git a/libbe/restconvert.py b/libbe/restconvert.py
index 8ebb6b4..cc7f866 100644
--- a/libbe/restconvert.py
+++ b/libbe/restconvert.py
@@ -23,7 +23,10 @@ from docutils.core import publish_file
from docutils.parsers import rst
from docutils.parsers.rst import directives
from docutils.parsers.rst.states import Inliner, MarkupMismatch, unescape
-from elementtree import ElementTree
+try :
+ from xml.etree import ElementTree # Python 2.5 (and greater?)
+except ImportError :
+ from elementtree import ElementTree
def rest_xml(rest):