diff options
16 files changed, 286 insertions, 9 deletions
diff --git a/.be/bugs/31cd490d-a1c2-4ab3-8284-d80395e34dd2/comments/b2a333f7-eda6-42b9-8940-177f61ca7f48/body b/.be/bugs/31cd490d-a1c2-4ab3-8284-d80395e34dd2/comments/b2a333f7-eda6-42b9-8940-177f61ca7f48/body new file mode 100644 index 0000000..396c06a --- /dev/null +++ b/.be/bugs/31cd490d-a1c2-4ab3-8284-d80395e34dd2/comments/b2a333f7-eda6-42b9-8940-177f61ca7f48/body @@ -0,0 +1,51 @@ +$ python test.py +********************************************************************** +File "/home/wking/src/fun/be/libbe/plugin.py", line 31, in libbe.plugin.iter_plugins +Failed example: + "plugin" in [n for n,m in iter_plugins("libbe")] +Exception raised: + Traceback (most recent call last): + File "/usr/lib/python2.5/doctest.py", line 1228, in __run + compileflags, 1) in test.globs + File "<doctest libbe.plugin.iter_plugins[1]>", line 1, in <module> + "plugin" in [n for n,m in iter_plugins("libbe")] + File "/home/wking/src/fun/be/libbe/plugin.py", line 38, in iter_plugins + yield modfile[:-3], my_import(prefix+"."+modfile[:-3]) + File "/home/wking/src/fun/be/libbe/plugin.py", line 21, in my_import + module = __import__(mod_name) + File "/home/wking/src/fun/be/libbe/restconvert.py", line 27, in <module> + from elementtree import ElementTree + ImportError: No module named elementtree +********************************************************************** +1 items had failures: + 1 of 2 in libbe.plugin.iter_plugins +***Test Failed*** 1 failures. +Traceback (most recent call last): + File "test.py", line 32, in <module> + for module in plugin.iter_plugins("libbe"): + File "/home/wking/src/fun/be/libbe/plugin.py", line 38, in iter_plugins + yield modfile[:-3], my_import(prefix+"."+modfile[:-3]) + File "/home/wking/src/fun/be/libbe/plugin.py", line 21, in my_import + module = __import__(mod_name) + File "/home/wking/src/fun/be/libbe/restconvert.py", line 27, in <module> + from elementtree import ElementTree +ImportError: No module named elementtree + + +Looking into ElementTree, I found their webpage: +http://effbot.org/zone/element-index.htm + + It’s common practice to import ElementTree under an alias, both to + minimize typing, and to make it easier to switch between different + implementations: + + $ python + >>> import elementtree.ElementTree as ET + >>> import cElementTree as ET + >>> import lxml.etree as ET + >>> import xml.etree.ElementTree as ET # Python 2.5 + +Using new import style, fall back to old if that fails. +Affected files: + libbe/restconvert.py + Bugs-Everywhere-Web/beweb/formatting.py diff --git a/.be/bugs/31cd490d-a1c2-4ab3-8284-d80395e34dd2/comments/b2a333f7-eda6-42b9-8940-177f61ca7f48/values b/.be/bugs/31cd490d-a1c2-4ab3-8284-d80395e34dd2/comments/b2a333f7-eda6-42b9-8940-177f61ca7f48/values new file mode 100644 index 0000000..c499bfe --- /dev/null +++ b/.be/bugs/31cd490d-a1c2-4ab3-8284-d80395e34dd2/comments/b2a333f7-eda6-42b9-8940-177f61ca7f48/values @@ -0,0 +1,21 @@ + + + +Content-type=text/plain + + + + + + +Date=Thu, 13 Nov 2008 17:27:17 +0000 + + + + + + +From=wking + + + diff --git a/.be/bugs/31cd490d-a1c2-4ab3-8284-d80395e34dd2/values b/.be/bugs/31cd490d-a1c2-4ab3-8284-d80395e34dd2/values new file mode 100644 index 0000000..b528771 --- /dev/null +++ b/.be/bugs/31cd490d-a1c2-4ab3-8284-d80395e34dd2/values @@ -0,0 +1,35 @@ + + + +creator=wking + + + + + + +severity=minor + + + + + + +status=closed + + + + + + +summary=elementtree module moved in Python 2.5 + + + + + + +time=Thu, 13 Nov 2008 16:45:24 +0000 + + + diff --git a/.be/bugs/40dac9af-951e-4b98-8779-9ba02c37f8a1/comments/e1ff6c81-37d8-43ee-9dcf-17a89e07556a/body b/.be/bugs/40dac9af-951e-4b98-8779-9ba02c37f8a1/comments/e1ff6c81-37d8-43ee-9dcf-17a89e07556a/body new file mode 100644 index 0000000..20b3da3 --- /dev/null +++ b/.be/bugs/40dac9af-951e-4b98-8779-9ba02c37f8a1/comments/e1ff6c81-37d8-43ee-9dcf-17a89e07556a/body @@ -0,0 +1,3 @@ +Calls to Popen() while running `test.py` raised OSError because of +missing binaries (tla was not installed). Added catches to produce +more useful error messages in the backtrace. diff --git a/.be/bugs/40dac9af-951e-4b98-8779-9ba02c37f8a1/comments/e1ff6c81-37d8-43ee-9dcf-17a89e07556a/values b/.be/bugs/40dac9af-951e-4b98-8779-9ba02c37f8a1/comments/e1ff6c81-37d8-43ee-9dcf-17a89e07556a/values new file mode 100644 index 0000000..b5100d0 --- /dev/null +++ b/.be/bugs/40dac9af-951e-4b98-8779-9ba02c37f8a1/comments/e1ff6c81-37d8-43ee-9dcf-17a89e07556a/values @@ -0,0 +1,21 @@ + + + +Content-type=text/plain + + + + + + +Date=Thu, 13 Nov 2008 15:58:18 +0000 + + + + + + +From=wking + + + diff --git a/.be/bugs/40dac9af-951e-4b98-8779-9ba02c37f8a1/values b/.be/bugs/40dac9af-951e-4b98-8779-9ba02c37f8a1/values new file mode 100644 index 0000000..5a7b54e --- /dev/null +++ b/.be/bugs/40dac9af-951e-4b98-8779-9ba02c37f8a1/values @@ -0,0 +1,35 @@ + + + +creator=wking + + + + + + +severity=minor + + + + + + +status=closed + + + + + + +summary=Popen OSErrors not caught + + + + + + +time=Thu, 13 Nov 2008 15:54:45 +0000 + + + diff --git a/.be/bugs/c4ea43d5-4964-49ea-a1eb-2bab2bde8e2e/comments/2ca25dd6-e9d1-4581-bd29-50f2eaa32fe4/body b/.be/bugs/c4ea43d5-4964-49ea-a1eb-2bab2bde8e2e/comments/2ca25dd6-e9d1-4581-bd29-50f2eaa32fe4/body new file mode 100644 index 0000000..d589f18 --- /dev/null +++ b/.be/bugs/c4ea43d5-4964-49ea-a1eb-2bab2bde8e2e/comments/2ca25dd6-e9d1-4581-bd29-50f2eaa32fe4/body @@ -0,0 +1,7 @@ +When running `python test.py` I recieved lots of errors due to 'tla' +(the GNU Arch revision control system binary) not being installed. +I had expected test.py to only test the backends for installed VCSs. + +I've added a note saying that `python test.py` tests *all* the +backends, but someone who understands the usage better can probably +write a nicer version. diff --git a/.be/bugs/c4ea43d5-4964-49ea-a1eb-2bab2bde8e2e/comments/2ca25dd6-e9d1-4581-bd29-50f2eaa32fe4/values b/.be/bugs/c4ea43d5-4964-49ea-a1eb-2bab2bde8e2e/comments/2ca25dd6-e9d1-4581-bd29-50f2eaa32fe4/values new file mode 100644 index 0000000..9f2b558 --- /dev/null +++ b/.be/bugs/c4ea43d5-4964-49ea-a1eb-2bab2bde8e2e/comments/2ca25dd6-e9d1-4581-bd29-50f2eaa32fe4/values @@ -0,0 +1,21 @@ + + + +Content-type=text/plain + + + + + + +Date=Thu, 13 Nov 2008 16:35:24 +0000 + + + + + + +From=wking + + + diff --git a/.be/bugs/c4ea43d5-4964-49ea-a1eb-2bab2bde8e2e/comments/b3fabbe0-f05d-42a1-9037-e59e628a83e2/body b/.be/bugs/c4ea43d5-4964-49ea-a1eb-2bab2bde8e2e/comments/b3fabbe0-f05d-42a1-9037-e59e628a83e2/body new file mode 100644 index 0000000..77d75fb --- /dev/null +++ b/.be/bugs/c4ea43d5-4964-49ea-a1eb-2bab2bde8e2e/comments/b3fabbe0-f05d-42a1-9037-e59e628a83e2/body @@ -0,0 +1,3 @@ +Ideally the tests would fail gracefully with some simple message like +"tla version control system not found", and we could skip the message +in the test.py docstring. diff --git a/.be/bugs/c4ea43d5-4964-49ea-a1eb-2bab2bde8e2e/comments/b3fabbe0-f05d-42a1-9037-e59e628a83e2/values b/.be/bugs/c4ea43d5-4964-49ea-a1eb-2bab2bde8e2e/comments/b3fabbe0-f05d-42a1-9037-e59e628a83e2/values new file mode 100644 index 0000000..c404aa9 --- /dev/null +++ b/.be/bugs/c4ea43d5-4964-49ea-a1eb-2bab2bde8e2e/comments/b3fabbe0-f05d-42a1-9037-e59e628a83e2/values @@ -0,0 +1,21 @@ + + + +Content-type=text/plain + + + + + + +Date=Thu, 13 Nov 2008 16:38:36 +0000 + + + + + + +From=wking + + + diff --git a/.be/bugs/c4ea43d5-4964-49ea-a1eb-2bab2bde8e2e/values b/.be/bugs/c4ea43d5-4964-49ea-a1eb-2bab2bde8e2e/values new file mode 100644 index 0000000..5ecca35 --- /dev/null +++ b/.be/bugs/c4ea43d5-4964-49ea-a1eb-2bab2bde8e2e/values @@ -0,0 +1,35 @@ + + + +creator=wking + + + + + + +severity=minor + + + + + + +status=open + + + + + + +summary=Usage of be/test.py is unclear + + + + + + +time=Thu, 13 Nov 2008 16:31:41 +0000 + + + diff --git a/Bugs-Everywhere-Web/beweb/formatting.py b/Bugs-Everywhere-Web/beweb/formatting.py index b68d328..1278414 100644 --- a/Bugs-Everywhere-Web/beweb/formatting.py +++ b/Bugs-Everywhere-Web/beweb/formatting.py @@ -1,6 +1,9 @@ from StringIO import StringIO -from elementtree.ElementTree import XML +try : + from xml.etree.ElementTree import XML # Python 2.5 (and greater?) +except ImportError : + from elementtree.ElementTree import XML from libbe.restconvert import rest_xml def to_unix(text): 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): @@ -1,3 +1,13 @@ +"""Usage: python test.py [module] + +When called without an optional module name, run the doctests from +*all* modules. This may raise lots of errors if you haven't installed +one of the versioning control systems. + +When called with an optional module name, only run the doctests from +that module. +""" + from libbe import plugin import doctest import sys |