From 55fb47911e14324e9c11434fa3fea5fbaf38e36b Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Fri, 24 Feb 2023 15:52:07 -0800 Subject: [PATCH] replace tidy with python --- dev-scripts/prepare_pecl_release.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dev-scripts/prepare_pecl_release.py b/dev-scripts/prepare_pecl_release.py index 1bbfc5e..a510b59 100644 --- a/dev-scripts/prepare_pecl_release.py +++ b/dev-scripts/prepare_pecl_release.py @@ -1,6 +1,7 @@ import argparse import os import subprocess +import xml.dom.minidom parser = argparse.ArgumentParser(description='PECL Package generator') @@ -37,7 +38,11 @@ subprocess.run(['python3', f'{TOOLS_DIR}/prepare_pecl_package_xml.py', '--name', try: with open('package.xml', 'r') as f: package_xml = f.read() - subprocess.run(['tidy', '-xml', '-m', '-i', 'package.xml'], check=True) + doc = xml.dom.minidom.parse('package.xml') + doc.encoding = 'UTF-8' + xml_str = doc.toprettyxml(indent=' ', newl='') + with open('package.xml', 'w') as f: + f.write(xml_str) subprocess.run(['pear', 'package-validate'], check=True) subprocess.run(['pear', 'package'], check=True) except subprocess.CalledProcessError as e: