Merge "Handle imagedata in test.py and validate.py"
This commit is contained in:
commit
70d53f9de4
@ -199,12 +199,28 @@ def check_deleted_files(rootdir, file_exceptions):
|
|||||||
f not in file_exceptions):
|
f not in file_exceptions):
|
||||||
path = os.path.abspath(os.path.join(root, f))
|
path = os.path.abspath(os.path.join(root, f))
|
||||||
doc = etree.parse(path)
|
doc = etree.parse(path)
|
||||||
|
|
||||||
|
# Check for inclusion of files as part of imagedata
|
||||||
|
for node in doc.findall('//{http://docbook.org/ns/docbook}imagedata'):
|
||||||
|
href = node.get('fileref')
|
||||||
|
if (f not in file_exceptions and
|
||||||
|
os.path.abspath(href) in deleted_files):
|
||||||
|
print(" File %s has an imagedata href for deleted file %s " % (f, href))
|
||||||
|
missing_reference = True
|
||||||
|
|
||||||
|
break
|
||||||
|
|
||||||
|
if missing_reference:
|
||||||
|
break
|
||||||
|
|
||||||
|
# Check for inclusion of files as part of xi:include
|
||||||
ns = {"xi": "http://www.w3.org/2001/XInclude"}
|
ns = {"xi": "http://www.w3.org/2001/XInclude"}
|
||||||
for node in doc.xpath('//xi:include', namespaces=ns):
|
for node in doc.xpath('//xi:include', namespaces=ns):
|
||||||
href = node.get('href')
|
href = node.get('href')
|
||||||
if (os.path.abspath(href) in deleted_files):
|
if (os.path.abspath(href) in deleted_files):
|
||||||
print(" File %s has an xi:include on deleted file %s " % (f, href))
|
print(" File %s has an xi:include on deleted file %s " % (f, href))
|
||||||
missing_reference = True
|
missing_reference = True
|
||||||
|
|
||||||
if missing_reference:
|
if missing_reference:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
@ -317,6 +333,19 @@ def build_affected_books(rootdir, book_exceptions, file_exceptions, force=False,
|
|||||||
f not in file_exceptions):
|
f not in file_exceptions):
|
||||||
path = os.path.abspath(os.path.join(root, f))
|
path = os.path.abspath(os.path.join(root, f))
|
||||||
doc = etree.parse(path)
|
doc = etree.parse(path)
|
||||||
|
|
||||||
|
# Check for inclusion of files as part of imagedata
|
||||||
|
for node in doc.findall('//{http://docbook.org/ns/docbook}imagedata'):
|
||||||
|
href = node.get('fileref')
|
||||||
|
if (f not in file_exceptions and
|
||||||
|
os.path.abspath(href) in modified_files):
|
||||||
|
affected_books.append(book_root)
|
||||||
|
break
|
||||||
|
|
||||||
|
if book_root in affected_books:
|
||||||
|
break
|
||||||
|
|
||||||
|
# Check for inclusion of files as part of xi:include
|
||||||
ns = {"xi": "http://www.w3.org/2001/XInclude"}
|
ns = {"xi": "http://www.w3.org/2001/XInclude"}
|
||||||
for node in doc.xpath('//xi:include', namespaces=ns):
|
for node in doc.xpath('//xi:include', namespaces=ns):
|
||||||
href = node.get('href')
|
href = node.get('href')
|
||||||
|
@ -202,6 +202,21 @@ def check_deleted_files(rootdir, file_exceptions):
|
|||||||
f not in file_exceptions):
|
f not in file_exceptions):
|
||||||
path = os.path.abspath(os.path.join(root, f))
|
path = os.path.abspath(os.path.join(root, f))
|
||||||
doc = etree.parse(path)
|
doc = etree.parse(path)
|
||||||
|
|
||||||
|
# Check for inclusion of files as part of imagedata
|
||||||
|
for node in doc.findall('//{http://docbook.org/ns/docbook}imagedata'):
|
||||||
|
href = node.get('fileref')
|
||||||
|
if (f not in file_exceptions and
|
||||||
|
os.path.abspath(href) in deleted_files):
|
||||||
|
print(" File %s has an imagedata href for deleted file %s " % (f, href))
|
||||||
|
missing_reference = True
|
||||||
|
|
||||||
|
break
|
||||||
|
|
||||||
|
if missing_reference:
|
||||||
|
break
|
||||||
|
|
||||||
|
# Check for inclusion of files as part of xi:include
|
||||||
ns = {"xi": "http://www.w3.org/2001/XInclude"}
|
ns = {"xi": "http://www.w3.org/2001/XInclude"}
|
||||||
for node in doc.xpath('//xi:include', namespaces=ns):
|
for node in doc.xpath('//xi:include', namespaces=ns):
|
||||||
href = node.get('href')
|
href = node.get('href')
|
||||||
@ -318,6 +333,19 @@ def build_affected_books(rootdir, book_exceptions, file_exceptions, force):
|
|||||||
f not in file_exceptions):
|
f not in file_exceptions):
|
||||||
path = os.path.abspath(os.path.join(root, f))
|
path = os.path.abspath(os.path.join(root, f))
|
||||||
doc = etree.parse(path)
|
doc = etree.parse(path)
|
||||||
|
|
||||||
|
# Check for inclusion of files as part of imagedata
|
||||||
|
for node in doc.findall('//{http://docbook.org/ns/docbook}imagedata'):
|
||||||
|
href = node.get('fileref')
|
||||||
|
if (f not in file_exceptions and
|
||||||
|
os.path.abspath(href) in modified_files):
|
||||||
|
affected_books.append(book_root)
|
||||||
|
break
|
||||||
|
|
||||||
|
if book_root in affected_books:
|
||||||
|
break
|
||||||
|
|
||||||
|
# Check for inclusion of files as part of xi:include
|
||||||
ns = {"xi": "http://www.w3.org/2001/XInclude"}
|
ns = {"xi": "http://www.w3.org/2001/XInclude"}
|
||||||
for node in doc.xpath('//xi:include', namespaces=ns):
|
for node in doc.xpath('//xi:include', namespaces=ns):
|
||||||
href = node.get('href')
|
href = node.get('href')
|
||||||
|
Loading…
Reference in New Issue
Block a user