Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4962141

Browse files
committed
Removes versioning from py.exe launcher installer and ensures that old launchers are replaced by newer ones.
1 parent 1cea70f commit 4962141

6 files changed

Lines changed: 26 additions & 12 deletions

File tree

Tools/msi/common.wxs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
<UpgradeVersion Property="UPGRADE" Minimum="$(var.UpgradeMinimumVersion)" IncludeMinimum="yes" Maximum="$(var.Version)" IncludeMaximum="no" />
2222
</Upgrade>
2323

24+
<?ifdef CoreUpgradeCode ?>
2425
<?if $(var.UpgradeCode)!=$(var.CoreUpgradeCode) ?>
25-
<?ifndef SkipMissingCore ?>
2626
<Upgrade Id="$(var.CoreUpgradeCode)">
2727
<UpgradeVersion Property="MISSING_CORE" Minimum="$(var.Version)" IncludeMinimum="yes" Maximum="$(var.Version)" IncludeMaximum="yes" OnlyDetect="yes" />
2828
</Upgrade>
@@ -47,9 +47,11 @@
4747
</Fragment>
4848

4949
<Fragment>
50+
<?ifdef InstallDirectoryGuidSeed ?>
5051
<Directory Id="TARGETDIR" Name="SourceDir">
5152
<Directory Id="InstallDirectory" ComponentGuidGenerationSeed="$(var.InstallDirectoryGuidSeed)" />
5253
</Directory>
54+
<?endif ?>
5355
</Fragment>
5456

5557
<!-- Top-level directories -->

Tools/msi/launcher/launcher.wixproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
<SchemaVersion>2.0</SchemaVersion>
66
<OutputName>launcher</OutputName>
77
<OutputType>Package</OutputType>
8-
<DefineConstants>SkipMissingCore=1;$(DefineConstants)</DefineConstants>
8+
<DefineConstants>UpgradeCode=1B68A0EC-4DD3-5134-840E-73854B0863F1;$(DefineConstants)</DefineConstants>
9+
<IgnoreCommonWxlTemplates>true</IgnoreCommonWxlTemplates>
910
</PropertyGroup>
1011
<Import Project="..\msi.props" />
1112
<ItemGroup>

Tools/msi/launcher/launcher.wxs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
<MediaTemplate EmbedCab="yes" CompressionLevel="high" />
66

77
<Property Id="Suppress_TARGETDIR_Check" Value="1" />
8-
<PropertyRef Id="UpgradeTable" />
98
<PropertyRef Id="ARPPRODUCTICON" />
109

1110
<Feature Id="DefaultFeature" AllowAdvertise="no" Title="!(loc.Title)" Description="!(loc.Description)">
@@ -27,12 +26,18 @@
2726
<Custom Before="SetLauncherInstallDirectoryLM" Action="SetLauncherInstallDirectoryCU">NOT Installed AND NOT ALLUSERS=1</Custom>
2827
<Custom Before="CostFinalize" Action="SetLauncherInstallDirectoryLM">NOT Installed AND ALLUSERS=1</Custom>
2928

30-
<RemoveExistingProducts After="InstallInitialize">UPGRADE or REMOVE_OLD_LAUNCHER</RemoveExistingProducts>
29+
<RemoveExistingProducts After="InstallValidate">UPGRADE or REMOVE_350_LAUNCHER</RemoveExistingProducts>
3130
</InstallExecuteSequence>
3231

33-
<!-- Python 3.5.0 shipped with an incorrect UpgradeCode -->
32+
<!-- Python 3.5.0 shipped with a different UpgradeCode -->
3433
<Upgrade Id="A71530B9-E89D-53DB-9C2D-C6D7551876D8">
35-
<UpgradeVersion Maximum="$(var.Version)" Property="REMOVE_OLD_LAUNCHER" />
34+
<UpgradeVersion Minimum="0.0.0.0" Property="REMOVE_350_LAUNCHER" />
3635
</Upgrade>
36+
<!-- Python 3.6.0a1 shipped with a different UpgradeCode -->
37+
<Upgrade Id="394750C0-7880-5A8F-999F-933965FBCFB4">
38+
<UpgradeVersion Maximum="$(var.Version)" Property="REMOVE_360A1_LAUNCHER" />
39+
<UpgradeVersion Minimum="$(var.Version)" Property="BLOCK_360A1_LAUNCHER" />
40+
</Upgrade>
41+
<Condition Message="!(loc.NoDowngrade)">Installed OR NOT BLOCK_360A1_LAUNCHER</Condition>
3742
</Product>
3843
</Wix>

Tools/msi/launcher/launcher_en-US.wxl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<WixLocalization Culture="en-us" xmlns="http://schemas.microsoft.com/wix/2006/localization">
3-
<String Id="Descriptor">Launcher</String>
4-
<String Id="ShortDescriptor">launcher</String>
3+
<String Id="LCID">1033</String>
4+
<String Id="Culture">en-us</String>
5+
<String Id="ProductName">Python Launcher</String>
6+
<String Id="Title">Python Launcher</String>
7+
<String Id="Description">Python Launcher</String>
8+
<String Id="Manufacturer">Python Software Foundation</String>
9+
<String Id="NoDowngrade">A newer version of the Python launcher is already installed.</String>
10+
<String Id="NoTargetDir">The TARGETDIR variable must be provided when invoking this installer.</String>
511
<String Id="PythonFileDescription">Python File</String>
612
<String Id="PythonNoConFileDescription">Python File (no console)</String>
713
<String Id="PythonCompiledFileDescription">Compiled Python File</String>

Tools/msi/msi.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
<ItemGroup>
4141
<Compile Include="$(MSBuildThisFileDirectory)common.wxs" />
42-
<WxlTemplate Include="$(MSBuildThisFileDirectory)\*.wxl_template" />
42+
<WxlTemplate Include="$(MSBuildThisFileDirectory)\*.wxl_template" Condition="$(IgnoreCommonWxlTemplates) != 'true'" />
4343
<WixExtension Include="WixUtilExtension">
4444
<HintPath>WixUtilExtension</HintPath>
4545
<Name>WixUtilExtension</Name>
@@ -150,7 +150,7 @@
150150
<Uri>lib2to3/pickles</Uri>
151151
</_Uuid>
152152
</ItemGroup>
153-
<Target Name="_GenerateGuids" AfterTargets="PrepareForBuild">
153+
<Target Name="_GenerateGuids" AfterTargets="PrepareForBuild" Condition="$(TargetName) != 'launcher'">
154154
<PropertyGroup>
155155
<_Uuids>@(_Uuid->'("%(Identity)", "$(MajorVersionNumber).$(MinorVersionNumber)/%(Uri)")',',')</_Uuids>
156156
<_GenerateCommand>import uuid; print('\n'.join('{}={}'.format(i, uuid.uuid5(uuid.UUID('c8d9733e-a70c-43ff-ab0c-e26456f11083'), '$(ReleaseUri.Replace(`{arch}`, `$(ArchName)`))' + j)) for i,j in [$(_Uuids.Replace(`"`,`'`))]))</_GenerateCommand>

Tools/msi/msi.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</Target>
2626

2727
<Target Name="_TransformWxlTemplates" AfterTargets="PrepareForBuild" Inputs="@(WxlTemplate);$(PySourcePath)include\patchlevel.h" Outputs="$(IntermediateOutputPath)%(Filename).wxl">
28-
<PropertyGroup>
28+
<PropertyGroup Condition="'@(WxlTemplate)' != ''">
2929
<_Content>$([System.IO.File]::ReadAllText(%(WxlTemplate.FullPath)).Replace(`{{ShortVersion}}`, `$(MajorVersionNumber).$(MinorVersionNumber)$(PyTestExt)`).Replace(`{{LongVersion}}`, `$(PythonVersion)$(PyTestExt)`).Replace(`{{Bitness}}`, `$(Bitness)`))</_Content>
3030
<_ExistingContent Condition="Exists('$(IntermediateOutputPath)%(WxlTemplate.Filename).wxl')">$([System.IO.File]::ReadAllText($(IntermediateOutputPath)%(WxlTemplate.Filename).wxl))</_ExistingContent>
3131
</PropertyGroup>
@@ -35,7 +35,7 @@
3535
Overwrite="true"
3636
Condition="$(_Content) != $(_ExistingContent)" />
3737

38-
<ItemGroup>
38+
<ItemGroup Condition="'@(WxlTemplate)' != ''">
3939
<EmbeddedResource Include="$(IntermediateOutputPath)%(WxlTemplate.Filename).wxl" />
4040
<FileWrites Include="$(IntermediateOutputPath)%(WxlTemplate.Filename).wxl" />
4141
</ItemGroup>

0 commit comments

Comments
 (0)