diff options
author | Jason Albert <albertj@us.ibm.com> | 2017-08-22 22:45:11 -0500 |
---|---|---|
committer | Jason Albert <albertj@us.ibm.com> | 2017-08-22 22:45:11 -0500 |
commit | 020a8b151dc0447372236d0ad6ccbb508a61d35c (patch) | |
tree | 99ac8a5465636192aa966ef1434f416e7bfdeddc | |
parent | 087f4d00803870b9a723087af27160775326870c (diff) | |
download | vpdtools-020a8b151dc0447372236d0ad6ccbb508a61d35c.tar.gz vpdtools-020a8b151dc0447372236d0ad6ccbb508a61d35c.zip |
Only call xmllint if xmllint is installed
- A warning is put to the screen that xmllint wasn't installed
and couldn't be called
-rwxr-xr-x | createVpd.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/createVpd.py b/createVpd.py index e5c837f..956389c 100755 --- a/createVpd.py +++ b/createVpd.py @@ -138,10 +138,13 @@ def writeXml(manifest, outputFile): tree = ET.ElementTree(manifest) tree.write(outputFile, encoding="utf-8", xml_declaration=True) # Now rip it through xmllint quick to cleanup formatting problems from the ET print - rc = os.system("xmllint --format %s -o %s" % (outputFile, outputFile)) - if (rc): - out.error("Unable to call xmllint to fixing xml formatting") - return(rc) + if (os.path.isfile("/usr/bin/xmllint")): + rc = os.system("/usr/bin/xmllint --format %s -o %s" % (outputFile, outputFile)) + if (rc): + out.error("Unable to call xmllint to fix xml formatting") + return(rc) + else: + out.warn("xmllint not installed - no formatting cleanup done!") return None |