[Lxml-checkins] r51318 - in lxml/trunk: . src/lxml/tests
scoder at codespeak.net
scoder at codespeak.net
Thu Feb 7 08:18:03 CET 2008
Author: scoder
Date: Thu Feb 7 08:18:02 2008
New Revision: 51318
Modified:
lxml/trunk/ (props changed)
lxml/trunk/src/lxml/tests/common_imports.py
Log:
r3420 at delle: sbehnel | 2008-02-07 08:17:17 +0100
fix ET version comparison
Modified: lxml/trunk/src/lxml/tests/common_imports.py
==============================================================================
--- lxml/trunk/src/lxml/tests/common_imports.py (original)
+++ lxml/trunk/src/lxml/tests/common_imports.py Thu Feb 7 08:18:02 2008
@@ -5,6 +5,15 @@
from lxml import etree
+def make_version_tuple(version_string):
+ l = []
+ for part in re.findall('([0-9]+|[^0-9.]+)', version_string):
+ try:
+ l.append(int(part))
+ except ValueError:
+ l.append(part)
+ return tuple(l)
+
try:
from elementtree import ElementTree # standard ET
except ImportError:
@@ -14,7 +23,7 @@
ElementTree = None
if hasattr(ElementTree, 'VERSION'):
- if tuple(ElementTree.VERSION.split('.')) < (1,3):
+ if make_version_tuple(ElementTree.VERSION)[:2] < (1,3):
# compatibility tests require ET 1.3+
ElementTree = None
@@ -27,8 +36,8 @@
cElementTree = None
if hasattr(cElementTree, 'VERSION'):
- if tuple(cElementTree.VERSION.split('.')) < (1,0,7):
- # compatibility tests require cET 1.0.7+
+ if make_version_tuple(cElementTree.VERSION)[:2] <= (1,0):
+ # compatibility tests do not run with cET 1.0.7
cElementTree = None
try:
More information about the lxml-checkins
mailing list