Skip to content

Commit d2d01d9

Browse files
[windows] add an option to install Embeddable Python 3.10.1 in the toolchain installer
1 parent fa9f484 commit d2d01d9

File tree

10 files changed

+168
-5
lines changed

10 files changed

+168
-5
lines changed

platforms/Windows/Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
ArePackageCabsEmbedded=$(ArePackageCabsEmbedded);
8282
BaseReleaseDownloadUrl=$(BaseReleaseDownloadUrl);
8383
ImageRoot=$(ImageRoot);
84+
PythonVersion=$(PythonVersion);
8485
WindowsRuntimeARM64=$(WindowsRuntimeARM64);
8586
WindowsRuntimeX64=$(WindowsRuntimeX64);
8687
WindowsRuntimeX86=$(WindowsRuntimeX86);

platforms/Windows/SideBySideUpgradeStrategy.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<RtlUpgradeCode>{BEA8C6DC-F73E-445B-9486-2333D1CF2886}</RtlUpgradeCode>
2525
<AndroidPlatformUpgradeCode>{313B9C1F-D5B5-4FED-B7E0-138F1EE6B26A}</AndroidPlatformUpgradeCode>
2626
<WindowsPlatformUpgradeCode>{01AFF1CF-A025-41B6-BCBC-728D794353FD}</WindowsPlatformUpgradeCode>
27+
<PythonUpgradeCode>{5FC42BA9-ABF5-4CCD-B93B-BDFED936BA37}</PythonUpgradeCode>
2728
</PropertyGroup>
2829

2930
<PropertyGroup Condition="'$(MajorMinorProductVersion)' == '0.0'">
@@ -61,6 +62,7 @@
6162
RtlUpgradeCode=$(RtlUpgradeCode);
6263
AndroidPlatformUpgradeCode=$(AndroidPlatformUpgradeCode);
6364
WindowsPlatformUpgradeCode=$(WindowsPlatformUpgradeCode);
65+
PythonUpgradeCode=$(PythonUpgradeCode);
6466
</DefineConstants>
6567
</PropertyGroup>
6668
</Project>

platforms/Windows/bundle/installer.wixproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<ProjectReference Include="..\dbg\dbg.wixproj" BindName="dbg" />
2222
<ProjectReference Include="..\ide\ide.wixproj" BindName="ide" />
2323
<ProjectReference Include="..\rtl\msi\rtlmsi.wixproj" BindName="rtl" />
24+
<ProjectReference Include="..\python\python.wixproj" BindName="python" />
2425
</ItemGroup>
2526

2627
<ItemGroup Condition=" $(Platforms.Contains('android')) ">

platforms/Windows/bundle/installer.wxs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<Variable Name="OptionsInstallBLD" Value="1" />
3232
<Variable Name="OptionsInstallCLI" bal:Overridable="yes" Persisted="yes" Value="1" />
3333
<Variable Name="OptionsInstallDBG" bal:Overridable="yes" Persisted="yes" Value="1" />
34+
<Variable Name="OptionsInstallPy" bal:Overridable="yes" Persisted="yes" Value="1" />
3435
<Variable Name="OptionsInstallIDE" bal:Overridable="yes" Persisted="yes" Value="1" />
3536
<Variable Name="OptionsInstallRTL" Value="1" />
3637

@@ -101,6 +102,13 @@
101102
<MsiProperty Name="INSTALLROOT" Value="[InstallRoot]" />
102103
</MsiPackage>
103104

105+
<MsiPackage
106+
SourceFile="!(bindpath.python)\python.msi"
107+
InstallCondition="OptionsInstallDBG = 1 and OptionsInstallPy = 1"
108+
DownloadUrl="$(BaseReleaseDownloadUrl)/{2}">
109+
<MsiProperty Name="INSTALLROOT" Value="[InstallRoot]" />
110+
</MsiPackage>
111+
104112
<MsiPackage
105113
SourceFile="!(bindpath.ide)\ide.msi"
106114
InstallCondition="OptionsInstallIDE = 1"

platforms/Windows/bundle/theme.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
<Font Id="2" Height="-18" Weight="500" Foreground="graytext">Segoe UI</Font>
1010
<Font Id="3" Height="-12" Weight="500" Foreground="windowtext" Background="window">Segoe UI</Font>
1111

12-
<Window Width="614" Height="456" HexStyle="100a0000" FontId="0" Caption="#(loc.Caption)">
13-
<ImageControl X="0" Y="0" Width="165" Height="456" ImageFile="swift_side.png"/>
14-
<Label X="176" Y="11" Width="-11" Height="32" FontId="1" DisablePrefix="yes">#(loc.Title)</Label>
12+
<Window Width="630" Height="530" HexStyle="100a0000" FontId="0" Caption="#(loc.Caption)">
13+
<ImageControl X="0" Y="0" Width="181" Height="530" ImageFile="swift_side.png"/>
14+
<Label X="192" Y="11" Width="-11" Height="32" FontId="1" DisablePrefix="yes">#(loc.Title)</Label>
1515

1616
<Page Name="Help">
1717
<Label X="176" Y="50" Width="-11" Height="32" FontId="2" DisablePrefix="yes">#(loc.HelpHeader)</Label>
@@ -59,6 +59,7 @@
5959
<Checkbox Name="OptionsInstallBLD" X="176" Y="111" Width="-11" Height="17" TabStop="yes" FontId="3" EnableCondition="0">#(loc.Bld_ProductName)</Checkbox>
6060
<Checkbox Name="OptionsInstallCLI" X="176" Y="129" Width="-11" Height="17" TabStop="yes" FontId="3">#(loc.Cli_ProductName)</Checkbox>
6161
<Checkbox Name="OptionsInstallDBG" X="176" Y="147" Width="-11" Height="17" TabStop="yes" FontId="3">#(loc.Dbg_ProductName)</Checkbox>
62+
<Checkbox Name="OptionsInstallPy" X="210" Y="165" Width="-11" Height="17" TabStop="yes" FontId="3" EnableCondition="OptionsInstallDBG">#(loc.EmbeddedPython_ProductName)</Checkbox>
6263
<Checkbox Name="OptionsInstallIDE" X="176" Y="165" Width="-11" Height="17" TabStop="yes" FontId="3">#(loc.Ide_ProductName)</Checkbox>
6364
<Checkbox Name="OptionsInstallRTL" X="176" Y="183" Width="-11" Height="17" TabStop="yes" FontId="3" EnableCondition="0">#(loc.Rtl_ProductName)</Checkbox>
6465
<Checkbox Name="OptionsInstallWindowsPlatform" X="176" Y="201" Width="-11" Height="17" TabStop="yes" FontId="3">#(loc.Plt_ProductName_Windows)</Checkbox>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Project Sdk="WixToolset.Sdk/4.0.5">
2+
<PropertyGroup>
3+
<OutputName>python</OutputName>
4+
</PropertyGroup>
5+
</Project>
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2+
<?define PythonRoot = "$(ImageRoot)\Python-$(PythonVersion)"?>
3+
<?if $(ProductArchitecture) = "arm64"?>
4+
<?define ArchSuffix = "-arm64"?>
5+
<?else?>
6+
<?define ArchSuffix = ""?>
7+
<?endif?>
8+
<?define VariantProductName = !(loc.IdeAsserts_ProductName)?>
9+
10+
<Package
11+
Language="1033"
12+
Manufacturer="!(loc.ManufacturerName)"
13+
Name="!(loc.EmbeddedPython_ProductName)"
14+
UpgradeCode="$(PythonUpgradeCode)"
15+
Version="$(NonSemVerProductVersion)"
16+
Scope="$(PackageScope)">
17+
18+
<Media Id="1" Cabinet="python.cab" EmbedCab="$(ArePackageCabsEmbedded)" />
19+
20+
<WixVariable Id="SideBySidePackageUpgradeCode" Value="$(PythonUpgradeCode)" />
21+
<FeatureGroupRef Id="SideBySideUpgradeStrategy" />
22+
23+
<DirectoryRef Id="INSTALLROOT">
24+
<Directory Id="python" Name="Python-$(PythonVersion)" />
25+
</DirectoryRef>
26+
27+
<ComponentGroup Id="EmbeddedPython" Directory="python">
28+
<Component>
29+
<File Source="$(PythonRoot)\libcrypto-1_1$(ArchSuffix).dll" />
30+
</Component>
31+
<Component>
32+
<File Source="$(PythonRoot)\libffi-7.dll" />
33+
</Component>
34+
<Component>
35+
<File Source="$(PythonRoot)\libssl-1_1$(ArchSuffix).dll" />
36+
</Component>
37+
<Component>
38+
<File Source="$(PythonRoot)\pyexpat.pyd" />
39+
</Component>
40+
<Component>
41+
<File Source="$(PythonRoot)\python.cat" />
42+
</Component>
43+
<Component>
44+
<File Source="$(PythonRoot)\python.exe" />
45+
</Component>
46+
<Component>
47+
<File Source="$(PythonRoot)\python3.dll" />
48+
</Component>
49+
<Component>
50+
<File Source="$(PythonRoot)\python310.dll" />
51+
</Component>
52+
<Component>
53+
<File Source="$(PythonRoot)\python310.zip" />
54+
</Component>
55+
<Component>
56+
<File Source="$(PythonRoot)\python310._pth" />
57+
</Component>
58+
<Component>
59+
<File Source="$(PythonRoot)\pythonw.exe" />
60+
</Component>
61+
<Component>
62+
<File Source="$(PythonRoot)\select.pyd" />
63+
</Component>
64+
<Component>
65+
<File Source="$(PythonRoot)\sqlite3.dll" />
66+
</Component>
67+
<Component>
68+
<File Source="$(PythonRoot)\unicodedata.pyd" />
69+
</Component>
70+
<Component>
71+
<File Source="$(PythonRoot)\vcruntime140.dll" />
72+
</Component>
73+
<Component>
74+
<File Source="$(PythonRoot)\vcruntime140_1.dll" />
75+
</Component>
76+
<Component>
77+
<File Source="$(PythonRoot)\winsound.pyd" />
78+
</Component>
79+
<Component>
80+
<File Source="$(PythonRoot)\_asyncio.pyd" />
81+
</Component>
82+
<Component>
83+
<File Source="$(PythonRoot)\_bz2.pyd" />
84+
</Component>
85+
<Component>
86+
<File Source="$(PythonRoot)\_ctypes.pyd" />
87+
</Component>
88+
<Component>
89+
<File Source="$(PythonRoot)\_decimal.pyd" />
90+
</Component>
91+
<Component>
92+
<File Source="$(PythonRoot)\_elementtree.pyd" />
93+
</Component>
94+
<Component>
95+
<File Source="$(PythonRoot)\_hashlib.pyd" />
96+
</Component>
97+
<Component>
98+
<File Source="$(PythonRoot)\_lzma.pyd" />
99+
</Component>
100+
<Component>
101+
<File Source="$(PythonRoot)\_msi.pyd" />
102+
</Component>
103+
<Component>
104+
<File Source="$(PythonRoot)\_multiprocessing.pyd" />
105+
</Component>
106+
<Component>
107+
<File Source="$(PythonRoot)\_overlapped.pyd" />
108+
</Component>
109+
<Component>
110+
<File Source="$(PythonRoot)\_queue.pyd" />
111+
</Component>
112+
<Component>
113+
<File Source="$(PythonRoot)\_socket.pyd" />
114+
</Component>
115+
<Component>
116+
<File Source="$(PythonRoot)\_sqlite3.pyd" />
117+
</Component>
118+
<Component>
119+
<File Source="$(PythonRoot)\_ssl.pyd" />
120+
</Component>
121+
<Component>
122+
<File Source="$(PythonRoot)\_uuid.pyd" />
123+
</Component>
124+
<Component>
125+
<File Source="$(PythonRoot)\_zoneinfo.pyd" />
126+
</Component>
127+
</ComponentGroup>
128+
129+
<ComponentGroup Id="EmbeddedPythonLicense">
130+
<Component Directory="_usr_share_licenses">
131+
<File Source="$(PythonRoot)\LICENSE.txt" />
132+
</Component>
133+
</ComponentGroup>
134+
135+
<Feature Id="EmbeddedPython" AllowAbsent="no" Title="$(VariantProductName)">
136+
<ComponentGroupRef Id="EmbeddedPython" />
137+
<ComponentGroupRef Id="EmbeddedPythonLicense" />
138+
</Feature>
139+
</Package>
140+
</Wix>

platforms/Windows/readme.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ The bundle authoring (in `installer.wxs`) drives optional install directory and
3434
| InstallRoot | A formatted string variable that specifies the installation root directory. The default value specified in `installer.wxs` should match the equivalent `INSTALLROOT` authoring in `shared.wxs`. The bundle variable is passed to each `MsiPackage` so overwrites the default directory authored in the MSI packages -- but keeping them in sync avoids the confusion if the default directory should change. |
3535
| OptionsInstallCLI | Controls whether command-line tools will be installed. |
3636
| OptionsInstallDBG | Controls whether debugging tools will be installed. |
37+
| OptionsInstallPy | Controls whether embeddable Python will be installed. |
3738
| OptionsInstallIDE | Controls whether IDE integration tools will be installed. |
3839
| OptionsInstallUtilties | Controls whether additional utilities will be installed. |
3940
| OptionsInstallAndroidPlatform | Controls whether the Android platform will be installed. |
@@ -149,6 +150,7 @@ To support the three architecture flavors of the SDK and RTL MSI packages, you n
149150
| MSBuild property | Description |
150151
| ---------------- | ----------- |
151152
| ImageRoot | Path to the root of the installed Swift image to package |
153+
| PythonVersion | Version of the Embeddable Python to package |
152154
| Platforms | Semicolon delimited list of platforms to package (android;windows) |
153155
| AndroidArchitectures | Semicolon delimited list of architectures the Android platform supports (aarch54;armv7;i686;x86_64) |
154156
| WindowsArchitectures | Semicolon delimited list of architectures the Windows platform supports (aarch64;i686;x86_64) |
@@ -165,10 +167,11 @@ msbuild %SourceRoot%\swift-installer-scripts\platforms\Windows\bundle\installer.
165167
-p:Configuration=Release ^
166168
-p:BaseOutputPath=%PackageRoot%\online\ ^
167169
-p:ImageRoot=%ImageRoot%\Program Files\Swift ^
170+
-p:PythonVersion=3.10.1 ^
168171
-p:Platforms="android;windows" ^
169172
-p:AndroidArchitectures="aarch64;armv7;i686;x86_64" ^
170173
-p:WindowsArchitectures="aarch64;i686;x86_64" ^
171-
-p:WindowsRuntimeARM64=%ImageRoot%\Prograam Files (Arm64)\Swift\Runtimes\0.0.0 ^
174+
-p:WindowsRuntimeARM64=%ImageRoot%\Program Files (Arm64)\Swift\Runtimes\0.0.0 ^
172175
-p:WindowsRuntimeX64=%ImageRoot%\Program Files\Swift\Runtimes\0.0.0 ^
173176
-p:WindowsRuntimeX86=%ImageRoot%\Program Files (x86)\Swift\Runtimes\0.0.0
174177
```
@@ -216,7 +219,7 @@ Note that these GUIDs are substituted at bind time so they skip the normal valid
216219

217220
| Property | Description |
218221
| -------- | ----------- |
219-
| BldUpgradeCode, CliUpgradeCode, DbgUpgradeCode, IdeUpgradeCode, RtlUpgradeCode, WindowsSDKUpgradeCode, AndroidSDKUpgradeCode | Upgrade codes for individual packages. Packages keep the same upgrade codes "forever" because MSI lets you specify version ranges for upgrades, which you can find in `shared/shared.wxs`. |
222+
| BldUpgradeCode, CliUpgradeCode, DbgUpgradeCode, IdeUpgradeCode, RtlUpgradeCode, WindowsSDKUpgradeCode, AndroidSDKUpgradeCode, PythonUpgradeCode | Upgrade codes for individual packages. Packages keep the same upgrade codes "forever" because MSI lets you specify version ranges for upgrades, which you can find in `shared/shared.wxs`. |
220223
| BundleUpgradeCode | Upgrade codes for the bundle. Bundles don't support upgrade version ranges, so the bundle upgrade code must change for every minor version _and_ stay the same for the entire lifetime of that minor version (e.g., v5.10.0 through v5.10.9999). You can keep the history of upgrade codes using a condition like `Condition="'$(MajorMinorProductVersion)' == '5.10'` or just replace BundleUpgradeCode when forking to a new minor version. |
221224

222225

platforms/Windows/shared/shared.wxs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
<Directory Id="_usr_share_docc" Name="docc">
5353
<Directory Id="_usr_share_docc_render" Name="render" />
5454
</Directory>
55+
<Directory Id="_usr_share_licenses" Name="licenses" />
5556
</Directory>
5657
</Directory>
5758
</Directory>

platforms/Windows/shared/swift.en-us.wxl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<String Id="Bld_ProductName" Value="Swift Build Tools" />
66
<String Id="Cli_ProductName" Value="Swift Command Line Tools" />
77
<String Id="Dbg_ProductName" Value="Swift Debugging Tools" />
8+
<String Id="EmbeddedPython_ProductName" Value="Embedded Python" />
89
<String Id="Ide_ProductName" Value="Swift IDE Integration Tools" />
910
<String Id="Rtl_ProductName" Value="Swift Windows Runtime" />
1011
<String Id="VCRuntime_ProductName_arm64" Value="Visual C++ Runtime (ARM64)" />

0 commit comments

Comments
 (0)