From 286511c4cf9dcd985882c9bbb2de42b01e7494a9 Mon Sep 17 00:00:00 2001 From: sideshowbarker Date: Fri, 1 Nov 2024 16:09:06 +0900 Subject: [PATCH] Meta: Make import-wpt-test.py use html.parser, not BeautifulSoup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change switches the Meta/import-wpt-test.py script to using the standard html.parser module rather than BeautifulSoup. Otherwise, without this change, when a contributor first tries to run the script, if they don’t have BeautifulSoup installed, it will fail. Note that this patch also includes an unrelated small change that switches to using os.path.normpath — rather than Path.absolute() — to “normalize” the destination names of the downloaded test files. --- Meta/import-wpt-test.py | 53 ++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/Meta/import-wpt-test.py b/Meta/import-wpt-test.py index 084e30a7100..56d504402ba 100755 --- a/Meta/import-wpt-test.py +++ b/Meta/import-wpt-test.py @@ -2,8 +2,9 @@ import os import sys + +from html.parser import HTMLParser from pathlib import Path -from bs4 import BeautifulSoup from urllib.parse import urljoin from urllib.request import urlopen from collections import namedtuple @@ -13,18 +14,16 @@ wpt_import_path = 'Tests/LibWeb/Text/input/wpt-import' wpt_expected_path = 'Tests/LibWeb/Text/expected/wpt-import' PathMapping = namedtuple('PathMapping', ['source', 'destination']) +src_values = [] -def get_script_sources(page_source): - # Find all the