[Concept,07/11] buildman: Make MyHTMLParser.re_arch private
Commit Message
From: Simon Glass <simon.glass@canonical.com>
The re_arch member is only used internally by handle_starttag(),
so rename it to _re_arch to indicate it's private.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
tools/buildman/toolchain.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
@@ -22,7 +22,13 @@ from u_boot_pylib import tools
(VAR_CROSS_COMPILE, VAR_PATH, VAR_ARCH, VAR_MAKE_ARGS) = range(4)
class MyHTMLParser(HTMLParser):
- """Simple class to collect links from a page"""
+ """Simple class to collect links from a page
+
+ Public members:
+ arch_link (str): URL of the toolchain for the desired architecture,
+ or None if not found
+ links (list of str): List of URLs for all .xz archives found
+ """
def __init__(self, arch):
"""Create a new parser
@@ -37,7 +43,7 @@ class MyHTMLParser(HTMLParser):
HTMLParser.__init__(self)
self.arch_link = None
self.links = []
- self.re_arch = re.compile('[-_]%s-' % arch)
+ self._re_arch = re.compile('[-_]%s-' % arch)
def handle_starttag(self, tag, attrs):
"""Handle a start tag in the HTML being parsed"""
@@ -46,7 +52,7 @@ class MyHTMLParser(HTMLParser):
if tag == 'href':
if value and value.endswith('.xz'):
self.links.append(value)
- if self.re_arch.search(value):
+ if self._re_arch.search(value):
self.arch_link = value