|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r84164 - trunk/tools/boostbook/test/more
From: dnljms_at_[hidden]
Date: 2013-05-06 06:29:16
Author: danieljames
Date: 2013-05-06 06:29:15 EDT (Mon, 06 May 2013)
New Revision: 84164
URL: http://svn.boost.org/trac/boost/changeset/84164
Log:
Fix boostbook tests for platform inconsistencies.
Text files modified:
trunk/tools/boostbook/test/more/run-tests.py | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
Modified: trunk/tools/boostbook/test/more/run-tests.py
==============================================================================
--- trunk/tools/boostbook/test/more/run-tests.py (original)
+++ trunk/tools/boostbook/test/more/run-tests.py 2013-05-06 06:29:15 EDT (Mon, 06 May 2013)
@@ -12,6 +12,7 @@
import difflib, getopt, os, re, sys
import lxml.ElementInclude
from lxml import etree
+from collections import defaultdict
# Globals
@@ -82,7 +83,7 @@
def normalize_boostbook_ids(doc):
ids = {}
- id_bases = {}
+ id_bases = defaultdict(int)
for node in doc.xpath("//*[starts-with(@id, 'id') or contains(@id, '_id')]"):
id = node.get('id')
@@ -90,13 +91,14 @@
if(id in ids):
print 'Duplicate id: ' + id
- match = re.match("(id|.+_id)([mp]?\d+)((?:-bb)?)", id)
+ match = re.match("(.+_id|id)([mp]?\d+)((?:-bb)?)", id)
if(match):
- count = 1
- if(match.group(1) in id_bases):
- count = id_bases[match.group(1)] + 1
- id_bases[match.group(1)] = count
- ids[id] = match.group(1) + str(count) + match.group(3)
+ # Truncate id name, as it sometimes has different lengths...
+ match2 = re.match("(.*?)([^.]*?)(_?id)", match.group(1))
+ base = match2.group(1) + match2.group(2)[:14] + match2.group(3)
+ count = id_bases[base] + 1
+ id_bases[base] = count
+ ids[id] = base + str(count) + match.group(3)
for node in doc.xpath("//*[@linkend or @id]"):
x = node.get('linkend')
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk