From 1fbbc0eeb3fe64ebb1d895d482f250ff989473ae Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Fri, 15 Dec 2023 14:11:08 +0100 Subject: [PATCH] remove lxml based schema linter now in galaxy core https://github.com/galaxyproject/galaxy/pull/17081 --- planemo/xml/validation.py | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/planemo/xml/validation.py b/planemo/xml/validation.py index d2f312769..85d8e6483 100644 --- a/planemo/xml/validation.py +++ b/planemo/xml/validation.py @@ -3,7 +3,6 @@ import subprocess from collections import namedtuple -from galaxy.util import unicodify from galaxy.util.commands import which try: @@ -14,7 +13,7 @@ XMLLINT_COMMAND = "xmllint --noout --schema {0} {1} 2>&1" INSTALL_VALIDATOR_MESSAGE = ( "This feature requires an external dependency " - "to function, pleaes install xmllint (e.g 'brew " + "to function, please install xmllint (e.g 'brew " "install libxml2' or 'apt-get install " "libxml2-utils'." ) @@ -41,27 +40,11 @@ def enabled(self): ValidationResult = namedtuple("ValidationResult", ["passed", "output"]) -class LxmlValidator(XsdValidator): - """Validate XSD files using lxml library.""" - - def validate(self, schema_path, target_path): - try: - xsd_doc = etree.parse(schema_path) - xsd = etree.XMLSchema(xsd_doc) - xml = etree.parse(target_path) - passed = xsd.validate(xml) - return ValidationResult(passed, xsd.error_log) - except etree.XMLSyntaxError as e: - return ValidationResult(False, unicodify(e)) - - def enabled(self): - return etree is not None - - class XmllintValidator(XsdValidator): """Validate XSD files with the external tool xmllint.""" def validate(self, schema_path, target_path): + print("XmllintValidator") command = XMLLINT_COMMAND.format(schema_path, target_path) p = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True) stdout, _ = p.communicate() @@ -72,7 +55,7 @@ def enabled(self): return bool(which("xmllint")) -VALIDATORS = [LxmlValidator(), XmllintValidator()] +VALIDATORS = [XmllintValidator()] def get_validator(require=True):