From 5e2634e7b80af01a0a6e629decbec08b11463f4a Mon Sep 17 00:00:00 2001 From: Ryan Malloy Date: Fri, 13 Feb 2026 01:00:07 -0700 Subject: [PATCH] Fix package_data for gvpr and empty BOM crash - Include *.gvpr files in package_data so wv_gvpr.gvpr ships in the wheel distribution (reported by web-ui integration agent) - Guard generate_html_output() against empty BOM list to prevent IndexError when YAML has no connectors/cables --- setup.py | 2 +- src/wireviz/wv_output.py | 52 +++++++++++++++++++++------------------- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/setup.py b/setup.py index e998449..6514503 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ setup( keywords="cable connector hardware harness wiring wiring-diagram wiring-harness", url=APP_URL, package_dir={"": "src"}, - package_data={CMD_NAME: ["templates/*.html"]}, + package_data={CMD_NAME: ["templates/*.html", "*.gvpr"]}, packages=find_packages("src"), entry_points={ "console_scripts": [ diff --git a/src/wireviz/wv_output.py b/src/wireviz/wv_output.py index 803d886..b9cfd78 100644 --- a/src/wireviz/wv_output.py +++ b/src/wireviz/wv_output.py @@ -107,32 +107,36 @@ def generate_html_output( ) # generate BOM table - # generate BOM header (may be at the top or bottom of the table) - bom_header_html = " \n" - for item in bom[0]: - th_class = f"bom_col_{item.lower()}" - bom_header_html = f'{bom_header_html} {item}\n' - bom_header_html = f"{bom_header_html} \n" + if bom: + # generate BOM header (may be at the top or bottom of the table) + bom_header_html = " \n" + for item in bom[0]: + th_class = f"bom_col_{item.lower()}" + bom_header_html = f'{bom_header_html} {item}\n' + bom_header_html = f"{bom_header_html} \n" - # generate BOM contents - bom_contents = [] - for row in bom[1:]: - row_html = " \n" - for i, item in enumerate(row): - td_class = f"bom_col_{bom[0][i].lower()}" - row_html = f'{row_html} {item if item is not None else ""}\n' - row_html = f"{row_html} \n" - bom_contents.append(row_html) + # generate BOM contents + bom_contents = [] + for row in bom[1:]: + row_html = " \n" + for i, item in enumerate(row): + td_class = f"bom_col_{bom[0][i].lower()}" + row_html = f'{row_html} {item if item is not None else ""}\n' + row_html = f"{row_html} \n" + bom_contents.append(row_html) - bom_html = ( - '\n' + bom_header_html + "".join(bom_contents) + "
\n" - ) - bom_html_reversed = ( - '\n' - + "".join(list(reversed(bom_contents))) - + bom_header_html - + "
\n" - ) + bom_html = ( + '\n' + bom_header_html + "".join(bom_contents) + "
\n" + ) + bom_html_reversed = ( + '\n' + + "".join(list(reversed(bom_contents))) + + bom_header_html + + "
\n" + ) + else: + bom_html = "" + bom_html_reversed = "" # prepare simple replacements replacements = {