Skip to content

Commit 236f509

Browse files
committed
Update installer to use 7z format for archives and include installed size property
1 parent a9fd874 commit 236f509

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

scripts/build_installer.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ call %FUNC% DeployPython
3333
@REM Create archive of Python environment
3434
@REM ===========================================================================
3535
echo Creating archive of Python environment...
36-
set ARCHIVE_PATH=%ROOTPATH%\dist\%CI_DST%-files.zip
36+
set ARCHIVE_PATH=%ROOTPATH%\dist\%CI_DST%-files.7z
3737
if exist "%ARCHIVE_PATH%" ( del /q "%ARCHIVE_PATH%" )
3838
pushd %ROOTPATH%\dist\%CI_DST%
39-
"C:\Program Files\7-Zip\7z.exe" a -tzip -mx=1 "%ARCHIVE_PATH%" *
39+
"C:\Program Files\7-Zip\7z.exe" a -t7z -m0=bzip2 -mx=1 -mmt=on "%ARCHIVE_PATH%" *
4040
popd
4141
echo Archive created: %ARCHIVE_PATH%
4242

wix/generic-DataLab-WinPython.wxs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,19 @@
99
<WixVariable Id="WixUIBannerBmp" Value=".\wix\banner.bmp" />
1010
<MediaTemplate EmbedCab="yes" CompressionLevel="none" />
1111
<Property Id="MSIFASTINSTALL" Value="2" />
12+
<Property Id="ARPSIZE" Value="{installed_size}" />
1213
<ui:WixUI Id="WixUI_InstallDir" InstallDirectory="INSTALLFOLDER"/>
1314
<Feature Id="ProductFeature" Title="DataLab-WinPython" Level="1">
1415
<ComponentGroupRef Id="ProductComponents" />
1516
</Feature>
1617

1718
<!-- Custom actions for archive extraction using bundled 7za.exe with hidden VBScript wrappers -->
1819
<CustomAction Id="ExtractArchive" Directory="INSTALLFOLDER" Execute="deferred" Impersonate="no" HideTarget="yes"
19-
ExeCommand="&quot;[System64Folder]wscript.exe&quot; &quot;[INSTALLFOLDER]extract.vbs&quot; &quot;[INSTALLFOLDER]7za.exe&quot; &quot;[INSTALLFOLDER]DataLab-WinPython-files.zip&quot; &quot;[INSTALLFOLDER]&quot;"
20+
ExeCommand="&quot;[System64Folder]wscript.exe&quot; &quot;[INSTALLFOLDER]extract.vbs&quot; &quot;[INSTALLFOLDER]7za.exe&quot; &quot;[INSTALLFOLDER]DataLab-WinPython-files.7z&quot; &quot;[INSTALLFOLDER]&quot;"
2021
Return="check" />
2122

2223
<CustomAction Id="DeleteArchive" Directory="INSTALLFOLDER" Execute="deferred" Impersonate="no" HideTarget="yes"
23-
ExeCommand="&quot;[System64Folder]cmd.exe&quot; /c &quot;del /q &quot;[INSTALLFOLDER]DataLab-WinPython-files.zip&quot; &amp; del /q &quot;[INSTALLFOLDER]7za.exe&quot; &amp; del /q &quot;[INSTALLFOLDER]extract.vbs&quot;&quot;"
24+
ExeCommand="&quot;[System64Folder]cmd.exe&quot; /c &quot;del /q &quot;[INSTALLFOLDER]DataLab-WinPython-files.7z&quot; &amp; del /q &quot;[INSTALLFOLDER]7za.exe&quot; &amp; del /q &quot;[INSTALLFOLDER]extract.vbs&quot;&quot;"
2425
Return="ignore" />
2526

2627
<CustomAction Id="CleanupOnUninstall" Directory="INSTALLFOLDER" Execute="deferred" Impersonate="no" HideTarget="yes"
@@ -56,7 +57,7 @@
5657

5758
<!-- Archive component -->
5859
<Component Id="PC_Archive" Directory="INSTALLFOLDER" Guid="a1b2c3d4-e5f6-4a5b-8c9d-0e1f2a3b4c5d">
59-
<File Id="ArchiveFile" Name="DataLab-WinPython-files.zip" Source="{archive_path}" KeyPath="yes" />
60+
<File Id="ArchiveFile" Name="DataLab-WinPython-files.7z" Source="{archive_path}" KeyPath="yes" />
6061
</Component>
6162

6263
<!-- Launcher executables component -->

wix/makewxs.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def make_wxs(product_name: str, version: str) -> None:
4848
wix_dir = osp.abspath(osp.dirname(__file__))
4949
proj_dir = osp.abspath(osp.join(wix_dir, os.pardir))
5050
dist_dir = osp.join(proj_dir, "dist", product_name)
51-
archive_path = osp.join(proj_dir, "dist", f"{product_name}-files.zip")
51+
archive_path = osp.join(proj_dir, "dist", f"{product_name}-files.7z")
5252
wxs_path = osp.join(wix_dir, f"generic-{product_name}.wxs")
5353
output_path = osp.join(wix_dir, f"{product_name}-{version}.wxs")
5454

@@ -62,12 +62,24 @@ def make_wxs(product_name: str, version: str) -> None:
6262
# Get archive size for statistics
6363
archive_size_mb = osp.getsize(archive_path) / (1024 * 1024)
6464

65+
# Calculate actual installed size (extracted files) in KB for ARPSIZE
66+
total_size_bytes = 0
67+
for root, dirs, files in os.walk(dist_dir):
68+
for filename in files:
69+
filepath = osp.join(root, filename)
70+
if osp.exists(filepath):
71+
total_size_bytes += osp.getsize(filepath)
72+
installed_size_kb = int(total_size_bytes / 1024)
73+
6574
# Count files in dist directory for statistics
6675
total_files = sum(len(files) for _, _, files in os.walk(dist_dir))
6776

6877
print("Archive-based installer mode:")
6978
print(f" Archive: {osp.basename(archive_path)}")
7079
print(f" Archive size: {archive_size_mb:.1f} MB")
80+
print(
81+
f" Installed size: {installed_size_kb / 1024:.1f} MB ({installed_size_kb} KB)"
82+
)
7183
print(f" Total files archived: {total_files}")
7284
print(" Components in MSI: ~15 (executables + archive + cleanup)")
7385

@@ -77,7 +89,8 @@ def make_wxs(product_name: str, version: str) -> None:
7789

7890
# Replace version placeholder
7991
wxs = wxs.replace("{version}", version)
80-
wxs = wxs.replace("{archive_path}", f"dist\\{product_name}-files.zip")
92+
wxs = wxs.replace("{archive_path}", f"dist\\{product_name}-files.7z")
93+
wxs = wxs.replace("{installed_size}", str(installed_size_kb))
8194

8295
with open(output_path, "w", encoding="utf-8") as fd:
8396
fd.write(wxs)

0 commit comments

Comments
 (0)