launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26241
[Merge] ~cjwatson/launchpad:py3-xmlvalidator into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-xmlvalidator into launchpad:master.
Commit message:
Fix XMLValidator for Python 3
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/397651
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-xmlvalidator into launchpad:master.
diff --git a/lib/lp/services/xml.py b/lib/lp/services/xml.py
index e2d2bea..c47f8d7 100644
--- a/lib/lp/services/xml.py
+++ b/lib/lp/services/xml.py
@@ -9,10 +9,9 @@ __all__ = [
import os
+import subprocess
from tempfile import NamedTemporaryFile
-from lp.services.helpers import simple_popen2
-
class XMLValidator:
"""A validator for XML files against a schema."""
@@ -59,7 +58,12 @@ class XMLValidator:
catalogs = " ".join(
[local_catalog_path, "/etc/xml/catalog"])
env = {"XML_CATALOG_FILES": catalogs}
- result = simple_popen2(command, '', env=env).strip()
+ xmllint = subprocess.Popen(
+ command, env=env,
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT, universal_newlines=True)
+ result, _ = xmllint.communicate('')
+ result = result.strip()
# The output consists of lines describing possible errors; the
# last line is either "(file) fails to validate" or