Skip to content

Commit

Permalink
SNOW-1055755: windows build debug - ...wix util schema update
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-mraba committed Sep 9, 2024
1 parent 37f7e87 commit c3d74ba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion scripts/packaging/win/snowflake_cli_template_v4.wxs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
<Package Name="Snowflake CLI" Language="1033" Version="$(var.SnowflakeCLIVersion)" Manufacturer="Snowflake, Inc." UpgradeCode="42280567-AE10-4184-8BB4-F98F59519CB2" InstallerVersion="405"><SummaryInformation Manufacturer="Snowflake, Inc." />
<WixVariable Id="WixUIDialogBmp" Value="scripts\packaging\win\snowflake_msi_background.png" />
<WixVariable Id="WixUIBannerBmp" Value="scripts\packaging\win\snowflake_msi_banner.png" />
Expand Down
16 changes: 11 additions & 5 deletions scripts/packaging/win/wxs_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,17 @@
WXS_TEMPLATE_FILE = WIN_RES_DIR.joinpath("snowflake_cli_template_v4.wxs")
WXS_OUTPUT_FILE = WXS_TEMPLATE_FILE.parent.joinpath("snowflake_cli.wxs")

ns = {
"util": "http://wixtoolset.org/schemas/v4/wxs/util",
"": "http://wixtoolset.org/schemas/v4/wxs",
}
for ns_name, ns_url in ns.items():
ElementTree.register_namespace(ns_name, ns_url)
wxs = ElementTree.parse(WXS_TEMPLATE_FILE)
root = wxs.getroot()
snow_files_xpath = ".//{http://wixtoolset.org/schemas/v4/wxs}Component"
snow_files = root.findall(snow_files_xpath)
snow_files = root.find(".//Component", namespaces=ns)
if snow_files is None:
raise ValueError("Component not found in the template")


lib_files = list(LIBS.glob("**/*"))
Expand Down Expand Up @@ -48,10 +55,9 @@

component.append(environment)
component.append(file)
snow_files[0].append(component)
snow_files.extend(component)


ElementTree.indent(root, space=" ", level=0)

with WXS_OUTPUT_FILE.expanduser().open("wb") as f:
wxs.write(f, encoding="utf-8")
wxs.write(WXS_OUTPUT_FILE, encoding="utf-8", xml_declaration=True)

0 comments on commit c3d74ba

Please sign in to comment.