summaryrefslogtreecommitdiff
path: root/portato.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xportato.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/portato.py b/portato.py
index 5e8b30a..736d2f3 100755
--- a/portato.py
+++ b/portato.py
@@ -67,12 +67,17 @@ def main ():
show_ebuild(options.ebuild)
elif options.validate:
from lxml import etree
- if etree.XMLSchema(file = XSD_LOCATION).validate(etree.parse(options.validate)):
- print "Passed validation."
- return
- else:
- print "Verification failed."
+ try:
+ etree.XMLSchema(file = XSD_LOCATION).assertValid(etree.parse(options.validate))
+ except etree.XMLSyntaxError, e:
+ print "Verification failed. XML syntax error: %s." % e[0]
+ sys.exit(3)
+ except etree.DocumentInvalid:
+ print "Verification failed. Does not comply with schema."
sys.exit(3)
+ else:
+ print "Verification succeeded."
+ return
else:
run()